//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and //! contain revealed `impl Trait` values). <ins> use crate::type_check::constraint_conversion::ConstraintConversion; </ins> use rustc_index::vec::Idx; use rustc_infer::infer::LateBoundRegionConversionTime; use rustc_middle::mir::*; <del> use rustc_middle::traits::ObligationCause; use rustc_middle::ty::{self, Ty}; </del> <ins> use rustc_middle::ty::Ty; </ins> use rustc_span::Span; <del> use rustc_trait_selection::traits::query::normalize::AtExt; </del> <ins> use rustc_span::DUMMY_SP; use rustc_trait_selection::traits::query::type_op::{self, TypeOp}; use rustc_trait_selection::traits::query::Fallible; use type_op::TypeOpOutput; </ins> use crate::universal_regions::UniversalRegions;


let (&normalized_output_ty, normalized_input_tys) = normalized_inputs_and_output.split_last().unwrap(); <ins> debug!(?normalized_output_ty); debug!(?normalized_input_tys); </ins> let mir_def_id = body.source.def_id().expect_local(); // If the user explicitly annotated the input types, extract


.delay_span_bug(body.span, "found more normalized_input_ty than local_decls"); break; } // In MIR, argument N is stored in local N+1. let local = Local::new(argument_index + 1); let mir_input_ty = body.local_decls[local].ty; let mir_input_span = body.local_decls[local].source_info.span; self.equate_normalized_input_or_output( normalized_input_ty,


// If the user explicitly annotated the input types, enforce those. let user_provided_input_ty = self.normalize(user_provided_input_ty, Locations::All(mir_input_span)); self.equate_normalized_input_or_output( user_provided_input_ty, mir_input_ty,


// `rustc_traits::normalize_after_erasing_regions`. Ideally, we'd // like to normalize *before* inserting into `local_decls`, but // doing so ends up causing some other trouble. <del> let b = match self .infcx .at(&ObligationCause::dummy(), ty::ParamEnv::empty()) .normalize(b) { Ok(n) => { debug!("equate_inputs_and_outputs: {:?}", n); if n.obligations.iter().all(|o| { matches!( o.predicate.kind().skip_binder(), ty::PredicateKind::RegionOutlives(_) | ty::PredicateKind::TypeOutlives(_) ) }) { n.value } else { b } } </del> <ins> let b = match self.normalize_and_add_constraints(b) { Ok(n) => n, </ins> Err(_) => { debug!("equate_inputs_and_outputs: NoSolution"); b } }; // Note: if we have to introduce new placeholders during normalization above, then we won't have // added those universes to the universe info, which we would want in `relate_tys`. if let Err(terr) =


} } } <ins> pub(crate) fn normalize_and_add_constraints(&mut self, t: Ty<'tcx>) -> Fallible<Ty<'tcx>> { let TypeOpOutput { output: norm_ty, constraints, .. } = self.param_env.and(type_op::normalize::Normalize::new(t)).fully_perform(self.infcx)?; debug!("{:?} normalized to {:?}", t, norm_ty); for data in constraints.into_iter().collect::<Vec<_>>() { ConstraintConversion::new( self.infcx, &self.borrowck_context.universal_regions, &self.region_bound_pairs, Some(self.implicit_region_bound), self.param_env, Locations::All(DUMMY_SP), ConstraintCategory::Internal, &mut self.borrowck_context.constraints, ) .convert_all(&*data); } Ok(norm_ty) } </ins> }


} struct BorrowCheckContext<'a, 'tcx> { <del> universal_regions: &'a UniversalRegions<'tcx>, </del> <ins> pub(crate) universal_regions: &'a UniversalRegions<'tcx>, </ins> location_table: &'a LocationTable, all_facts: &'a mut Option<AllFacts>, borrow_set: &'a BorrowSet<'tcx>, <del> constraints: &'a mut MirTypeckRegionConstraints<'tcx>, </del> <ins> pub(crate) constraints: &'a mut MirTypeckRegionConstraints<'tcx>, </ins> upvars: &'a [Upvar<'tcx>], }


self.relate_types(sup, ty::Variance::Contravariant, sub, locations, category) } <ins> #[instrument(skip(self, category), level = "debug")] </ins> fn eq_types( &mut self, expected: Ty<'tcx>,


<ins> // check-pass #![feature(generic_associated_types)] use std::marker::PhantomData; trait Family: Sized { type Item<'a>; fn apply_all<F>(&self, f: F) where F: FamilyItemFn<Self> { } } struct Array<T>(PhantomData<T>); impl<T: 'static> Family for Array<T> { type Item<'a> = &'a T; } trait FamilyItemFn<T: Family> { fn apply(&self, item: T::Item<'_>); } impl<T, F> FamilyItemFn<T> for F where T: Family, for<'a> F: Fn(T::Item<'a>) { fn apply(&self, item: T::Item<'_>) { (*self)(item); } } fn process<T: 'static>(array: Array<T>) { // Works array.apply_all(|x: &T| { }); // ICE: NoSolution array.apply_all(|x: <Array<T> as Family>::Item<'_>| { }); } fn main() {} </ins>


<ins> //check-pass #![feature(generic_associated_types)] trait Yokeable<'a>: 'static { type Output: 'a; } trait IsCovariant<'a> {} struct Yoke<Y: for<'a> Yokeable<'a>> { data: Y, } impl<Y: for<'a> Yokeable<'a>> Yoke<Y> { fn project<Y2: for<'a> Yokeable<'a>>(&self, _f: for<'a> fn(<Y as Yokeable<'a>>::Output, &'a ()) -> <Y2 as Yokeable<'a>>::Output) -> Yoke<Y2> { unimplemented!() } } fn _upcast<Y>(x: Yoke<Y>) -> Yoke<Box<dyn IsCovariant<'static> + 'static>> where Y: for<'a> Yokeable<'a>, for<'a> <Y as Yokeable<'a>>::Output: IsCovariant<'a> { x.project(|data, _| { Box::new(data) }) } impl<'a> Yokeable<'a> for Box<dyn IsCovariant<'static> + 'static> { type Output = Box<dyn IsCovariant<'a> + 'a>; } fn main() {} </ins>


let inline_attr = attrs.lists(sym::doc).get_word_attr(sym::inline); let pub_underscore = visibility.is_public() && name == kw::Underscore; let current_mod = cx.tcx.parent_module_from_def_id(import.def_id); <ins> // The parent of the module in which this import resides. This // is the same as `current_mod` if that's already the top // level module. </ins> let parent_mod = cx.tcx.parent_module_from_def_id(current_mod); <ins> // This checks if the import can be seen from a higher level module. // In other words, it checks if the visibility is the equivalent of // `pub(super)` or higher. If the current module is the top level // module, there isn't really a parent module, which makes the results // meaningless. In this case, we make sure the answer is `false`. let is_visible_from_parent_mod = visibility.is_accessible_from(parent_mod.to_def_id(), cx.tcx) && !current_mod.is_top_level_module(); </ins> if pub_underscore { if let Some(ref inline) = inline_attr { rustc_errors::struct_span_err!(


// #[doc(no_inline)] attribute is present. // Don't inline doc(hidden) imports so they can be stripped at a later stage. let mut denied = !(visibility.is_public() <del> || (cx.render_options.document_private && visibility.is_accessible_from(parent_mod.to_def_id(), cx.tcx))) </del> <ins> || (cx.render_options.document_private && is_visible_from_parent_mod)) </ins> || pub_underscore || attrs.iter().any(|a| { a.has_name(sym::doc)


&raw const $place } <ins> pub macro addr_of_crate($place:expr) { &raw const $place } pub macro addr_of_super($place:expr) { &raw const $place } </ins> pub macro addr_of_self($place:expr) { &raw const $place } <del> pub macro addr_of_crate($place:expr) { </del> <ins> pub macro addr_of_local($place:expr) { </ins> &raw const $place } pub struct Foo; <del> pub struct FooSelf; </del> pub struct FooCrate; <ins> pub struct FooSuper; pub struct FooSelf; pub struct FooLocal; </ins> pub enum Bar { Foo, } <del> pub enum BarSelf { Foo, } </del> pub enum BarCrate { Foo, } <ins> pub enum BarSuper { Foo, } pub enum BarSelf { Foo, } pub enum BarLocal { Foo, } </ins> pub fn foo() {} <del> pub fn foo_self() {} </del> pub fn foo_crate() {} <ins> pub fn foo_super() {} pub fn foo_self() {} pub fn foo_local() {} </ins> pub type Type = i32; <del> pub type TypeSelf = i32; </del> pub type TypeCrate = i32; <ins> pub type TypeSuper = i32; pub type TypeSelf = i32; pub type TypeLocal = i32; </ins> pub union Union { a: i8, b: i8, } <ins> pub union UnionCrate { a: i8, b: i8, } pub union UnionSuper { a: i8, b: i8, } </ins> pub union UnionSelf { a: i8, b: i8, } <del> pub union UnionCrate { </del> <ins> pub union UnionLocal { </ins> a: i8, b: i8, }


// @has 'foo/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {' pub use reexports::addr_of; <del> // @has 'foo/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {' </del> <ins> // @!has 'foo/macro.addr_of_crate.html' </ins> pub(crate) use reexports::addr_of_crate; <del> // @has 'foo/macro.addr_of_self.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_self($place : expr) {' </del> <ins> // @!has 'foo/macro.addr_of_self.html' </ins> pub(self) use reexports::addr_of_self; <ins> // @!has 'foo/macro.addr_of_local.html' use reexports::addr_of_local; </ins> // @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' pub use reexports::Foo; <del> // @has 'foo/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;' </del> <ins> // @!has 'foo/struct.FooCrate.html' </ins> pub(crate) use reexports::FooCrate; <del> // @has 'foo/struct.FooSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooSelf;' </del> <ins> // @!has 'foo/struct.FooSelf.html' </ins> pub(self) use reexports::FooSelf; <ins> // @!has 'foo/struct.FooLocal.html' use reexports::FooLocal; </ins> // @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' pub use reexports::Bar; <del> // @has 'foo/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {' </del> <ins> // @!has 'foo/enum.BarCrate.html' </ins> pub(crate) use reexports::BarCrate; <del> // @has 'foo/enum.BarSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarSelf {' </del> <ins> // @!has 'foo/enum.BarSelf.html' </ins> pub(self) use reexports::BarSelf; <ins> // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; </ins> // @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' pub use reexports::foo; <del> // @has 'foo/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()' </del> <ins> // @!has 'foo/fn.foo_crate.html' </ins> pub(crate) use reexports::foo_crate; <del> // @has 'foo/fn.foo_self.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_self()' </del> <ins> // @!has 'foo/fn.foo_self.html' </ins> pub(self) use reexports::foo_self; <ins> // @!has 'foo/fn.foo_local.html' use reexports::foo_local; </ins> // @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' pub use reexports::Type; <del> // @has 'foo/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate =' </del> <ins> // @!has 'foo/type.TypeCrate.html' </ins> pub(crate) use reexports::TypeCrate; <del> // @has 'foo/type.TypeSelf.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeSelf =' </del> <ins> // @!has 'foo/type.TypeSelf.html' </ins> pub(self) use reexports::TypeSelf; <ins> // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; </ins> // @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' pub use reexports::Union; <del> // @has 'foo/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {' </del> <ins> // @!has 'foo/union.UnionCrate.html' </ins> pub(crate) use reexports::UnionCrate; <del> // @has 'foo/union.UnionSelf.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionSelf {' </del> <ins> // @!has 'foo/union.UnionSelf.html' </ins> pub(self) use reexports::UnionSelf; <ins> // @!has 'foo/union.UnionLocal.html' use reexports::UnionLocal; </ins> <del> pub mod foo { // @!has 'foo/foo/union.Union.html' use crate::reexports::Union; </del> <ins> pub mod outer { pub mod inner { // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {' pub use reexports::addr_of; // @has 'foo/outer/inner/macro.addr_of_crate.html' '//*[@class="docblock item-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {' pub(crate) use reexports::addr_of_crate; // @has 'foo/outer/inner/macro.addr_of_super.html' '//*[@class="docblock item-decl"]' 'pub(in outer) macro addr_of_super($place : expr) {' pub(super) use reexports::addr_of_super; // @!has 'foo/outer/inner/macro.addr_of_self.html' pub(self) use reexports::addr_of_self; // @!has 'foo/outer/inner/macro.addr_of_local.html' use reexports::addr_of_local; // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' pub use reexports::Foo; // @has 'foo/outer/inner/struct.FooCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) struct FooCrate;' pub(crate) use reexports::FooCrate; // @has 'foo/outer/inner/struct.FooSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) struct FooSuper;' pub(super) use reexports::FooSuper; // @!has 'foo/outer/inner/struct.FooSelf.html' pub(self) use reexports::FooSelf; // @!has 'foo/outer/inner/struct.FooLocal.html' use reexports::FooLocal; // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @has 'foo/outer/inner/enum.BarCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) enum BarCrate {' pub(crate) use reexports::BarCrate; // @has 'foo/outer/inner/enum.BarSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) enum BarSuper {' pub(super) use reexports::BarSuper; // @!has 'foo/outer/inner/enum.BarSelf.html' pub(self) use reexports::BarSelf; // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' pub use reexports::foo; // @has 'foo/outer/inner/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()' pub(crate) use reexports::foo_crate; // @has 'foo/outer/inner/fn.foo_super.html' '//*[@class="rust fn"]' 'pub(in outer) fn foo_super()' pub(super) use::reexports::foo_super; // @!has 'foo/outer/inner/fn.foo_self.html' pub(self) use reexports::foo_self; // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' pub use reexports::Type; // @has 'foo/outer/inner/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate =' pub(crate) use reexports::TypeCrate; // @has 'foo/outer/inner/type.TypeSuper.html' '//*[@class="rust typedef"]' 'pub(in outer) type TypeSuper =' pub(super) use reexports::TypeSuper; // @!has 'foo/outer/inner/type.TypeSelf.html' pub(self) use reexports::TypeSelf; // @!has 'foo/outer/inner/type.TypeLocal.html' use reexports::TypeLocal; // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' pub use reexports::Union; // @has 'foo/outer/inner/union.UnionCrate.html' '//*[@class="docblock item-decl"]' 'pub(crate) union UnionCrate {' pub(crate) use reexports::UnionCrate; // @has 'foo/outer/inner/union.UnionSuper.html' '//*[@class="docblock item-decl"]' 'pub(in outer) union UnionSuper {' pub(super) use reexports::UnionSuper; // @!has 'foo/outer/inner/union.UnionSelf.html' pub(self) use reexports::UnionSelf; // @!has 'foo/outer/inner/union.UnionLocal.html' use reexports::UnionLocal; } } mod re_re_exports { // @!has 'foo/re_re_exports/union.Union.html' use crate::reexports::Union; </ins> }


pub(crate) use reexports::addr_of_crate; // @!has 'foo/macro.addr_of_self.html' pub(self) use reexports::addr_of_self; <ins> // @!has 'foo/macro.addr_of_local.html' use reexports::addr_of_local; </ins> // @has 'foo/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' pub use reexports::Foo;


pub(crate) use reexports::FooCrate; // @!has 'foo/struct.FooSelf.html' pub(self) use reexports::FooSelf; <ins> // @!has 'foo/struct.FooLocal.html' use reexports::FooLocal; </ins> // @has 'foo/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' pub use reexports::Bar;


pub(crate) use reexports::BarCrate; // @!has 'foo/enum.BarSelf.html' pub(self) use reexports::BarSelf; <ins> // @!has 'foo/enum.BarLocal.html' use reexports::BarLocal; </ins> // @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' pub use reexports::foo;


pub(crate) use reexports::foo_crate; // @!has 'foo/fn.foo_self.html' pub(self) use reexports::foo_self; <ins> // @!has 'foo/fn.foo_local.html' use reexports::foo_local; </ins> // @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' pub use reexports::Type;


pub(crate) use reexports::TypeCrate; // @!has 'foo/type.TypeSelf.html' pub(self) use reexports::TypeSelf; <ins> // @!has 'foo/type.TypeLocal.html' use reexports::TypeLocal; </ins> // @has 'foo/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' pub use reexports::Union;


pub(crate) use reexports::UnionCrate; // @!has 'foo/union.UnionSelf.html' pub(self) use reexports::UnionSelf; <ins> // @!has 'foo/union.UnionLocal.html' use reexports::UnionLocal; pub mod outer { pub mod inner { // @has 'foo/outer/inner/macro.addr_of.html' '//*[@class="docblock item-decl"]' 'pub macro addr_of($place : expr) {' pub use reexports::addr_of; // @!has 'foo/outer/inner/macro.addr_of_crate.html' pub(crate) use reexports::addr_of_crate; // @!has 'foo/outer/inner/macro.addr_of_super.html' pub(super) use reexports::addr_of_super; // @!has 'foo/outer/inner/macro.addr_of_self.html' pub(self) use reexports::addr_of_self; // @!has 'foo/outer/inner/macro.addr_of_local.html' use reexports::addr_of_local; // @has 'foo/outer/inner/struct.Foo.html' '//*[@class="docblock item-decl"]' 'pub struct Foo;' pub use reexports::Foo; // @!has 'foo/outer/inner/struct.FooCrate.html' pub(crate) use reexports::FooCrate; // @!has 'foo/outer/inner/struct.FooSuper.html' pub(super) use reexports::FooSuper; // @!has 'foo/outer/inner/struct.FooSelf.html' pub(self) use reexports::FooSelf; // @!has 'foo/outer/inner/struct.FooLocal.html' use reexports::FooLocal; // @has 'foo/outer/inner/enum.Bar.html' '//*[@class="docblock item-decl"]' 'pub enum Bar {' pub use reexports::Bar; // @!has 'foo/outer/inner/enum.BarCrate.html' pub(crate) use reexports::BarCrate; // @!has 'foo/outer/inner/enum.BarSuper.html' pub(super) use reexports::BarSuper; // @!has 'foo/outer/inner/enum.BarSelf.html' pub(self) use reexports::BarSelf; // @!has 'foo/outer/inner/enum.BarLocal.html' use reexports::BarLocal; // @has 'foo/outer/inner/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' pub use reexports::foo; // @!has 'foo/outer/inner/fn.foo_crate.html' pub(crate) use reexports::foo_crate; // @!has 'foo/outer/inner/fn.foo_super.html' pub(super) use::reexports::foo_super; // @!has 'foo/outer/inner/fn.foo_self.html' pub(self) use reexports::foo_self; // @!has 'foo/outer/inner/fn.foo_local.html' use reexports::foo_local; // @has 'foo/outer/inner/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' pub use reexports::Type; // @!has 'foo/outer/inner/type.TypeCrate.html' pub(crate) use reexports::TypeCrate; // @!has 'foo/outer/inner/type.TypeSuper.html' pub(super) use reexports::TypeSuper; // @!has 'foo/outer/inner/type.TypeSelf.html' pub(self) use reexports::TypeSelf; // @!has 'foo/outer/inner/type.TypeLocal.html' use reexports::TypeLocal; // @has 'foo/outer/inner/union.Union.html' '//*[@class="docblock item-decl"]' 'pub union Union {' pub use reexports::Union; // @!has 'foo/outer/inner/union.UnionCrate.html' pub(crate) use reexports::UnionCrate; // @!has 'foo/outer/inner/union.UnionSuper.html' pub(super) use reexports::UnionSuper; // @!has 'foo/outer/inner/union.UnionSelf.html' pub(self) use reexports::UnionSelf; // @!has 'foo/outer/inner/union.UnionLocal.html' use reexports::UnionLocal; } } </ins>


<ins> // check-pass pub trait Associate { type Associated; } pub struct Wrap<'a> { pub field: &'a i32, } pub trait Create<T> { fn create() -> Self; } pub fn oh_no<'a, T>() where Wrap<'a>: Associate, <Wrap<'a> as Associate>::Associated: Create<T>, { <Wrap<'a> as Associate>::Associated::create(); } pub fn main() {} </ins>


<ins> // check-pass #![feature(generic_associated_types)] trait Foo<T> { type Type<'a> where T: 'a; } impl<T> Foo<T> for () { type Type<'a> where T: 'a, = (); } fn foo<T>() { let _: for<'a> fn(<() as Foo<T>>::Type<'a>, &'a T) = |_, _| (); } pub fn main() {} </ins>


(active, c_unwind, "1.52.0", Some(74990), None), /// Allows using C-variadics. (active, c_variadic, "1.34.0", Some(44930), None), <ins> /// Allows the use of `#[cfg(overflow_checks)` to check if integer overflow behaviour. (active, cfg_overflow_checks, "CURRENT_RUSTC_VERSION", Some(111466), None), </ins> /// Allows the use of `#[cfg(sanitize = "option")]`; set when -Zsanitizer is used. (active, cfg_sanitize, "1.41.0", Some(39699), None), /// Allows `cfg(target_abi = "...")`.


/// `cfg(...)`'s that are feature gated. const GATED_CFGS: &[GatedCfg] = &[ // (name in cfg, feature, function to check if the feature is enabled) <ins> (sym::overflow_checks, sym::cfg_overflow_checks, cfg_fn!(cfg_overflow_checks)), </ins> (sym::target_abi, sym::cfg_target_abi, cfg_fn!(cfg_target_abi)), (sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)), (


if sess.opts.debug_assertions { ret.insert((sym::debug_assertions, None)); } <ins> if sess.overflow_checks() { ret.insert((sym::overflow_checks, None)); } </ins> // JUSTIFICATION: before wrapper fn is available #[allow(rustc::bad_opt_access)] if sess.opts.crate_types.contains(&CrateType::ProcMacro) {


sym::windows, sym::proc_macro, sym::debug_assertions, <ins> sym::overflow_checks, </ins> sym::target_thread_local, ] { self.expecteds.entry(name).or_insert_with(no_values);


cfg_doctest, cfg_eval, cfg_hide, <ins> cfg_overflow_checks, </ins> cfg_panic, cfg_sanitize, cfg_target_abi,


or_patterns, other, out, <ins> overflow_checks, </ins> overlapping_marker_traits, owned_box, packed,


<ins> #![crate_type = "lib"] #[cfg(overflow_checks)] //~ ERROR `cfg(overflow_checks)` is experimental pub fn cast(v: i64)->u32{ todo!() } </ins>


<ins> error[E0658]: `cfg(overflow_checks)` is experimental and subject to change --> $DIR/feature-gate-cfg_overflow_checks.rs:3:7 | LL | #[cfg(overflow_checks)] |       ^^^^^^^^^^^^^^^ | = note: see issue #111466 <https://github.com/rust-lang/rust/issues/111466> for more information = help: add `#![feature(cfg_overflow_checks)]` to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. </ins>


<ins> // run-pass // compile-flags: -C overflow_checks=true #![feature(cfg_overflow_checks)] fn main() { assert!(cfg!(overflow_checks)); assert!(compiles_differently()); } #[cfg(overflow_checks)] fn compiles_differently()->bool { true } #[cfg(not(overflow_checks))] fn compiles_differently()->bool { false } </ins>


<ins> // run-pass // compile-flags: -C overflow_checks=false #![feature(cfg_overflow_checks)] fn main() { assert!(!cfg!(overflow_checks)); assert!(!compiles_differently()); } #[cfg(overflow_checks)] fn compiles_differently()->bool { true } #[cfg(not(overflow_checks))] fn compiles_differently()->bool { false } </ins>


// substitutions. use crate::check::FnCtxt; use hir::def_id::LocalDefId; use rustc_data_structures::fx::FxHashMap; use rustc_errors::ErrorGuaranteed;


use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCast}; use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable}; use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable}; <ins> use rustc_middle::ty::TypeckResults; </ins> use rustc_middle::ty::{self, ClosureSizeProfileData, Ty, TyCtxt}; use rustc_span::symbol::sym; use rustc_span::Span;


} } <ins> // (ouz-a 1005988): Normally `[T] : std::ops::Index<usize>` should be normalized // into [T] but currently `Where` clause stops the normalization process for it, // here we compare types of expr and base in a code without `Where` clause they would be equal // if they are not we don't modify the expr, hence we bypass the ICE fn is_builtin_index( &mut self, typeck_results: &TypeckResults<'tcx>, e: &hir::Expr<'_>, base_ty: Ty<'tcx>, index_ty: Ty<'tcx>, ) -> bool { if let Some(elem_ty) = base_ty.builtin_index() { let Some(exp_ty) = typeck_results.expr_ty_opt(e) else {return false;}; let resolved_exp_ty = self.resolve(exp_ty, &e.span); elem_ty == resolved_exp_ty && index_ty == self.fcx.tcx.types.usize } else { false } } </ins> // Similar to operators, indexing is always assumed to be overloaded // Here, correct cases where an indexing expression can be simplified // to use builtin indexing because the index type is known to be


) }); let index_ty = self.fcx.resolve_vars_if_possible(index_ty); <ins> let resolved_base_ty = self.resolve(*base_ty, &base.span); </ins> <del> if base_ty.builtin_index().is_some() && index_ty == self.fcx.tcx.types.usize { </del> <ins> if self.is_builtin_index(&typeck_results, e, resolved_base_ty, index_ty) { </ins> // Remove the method call record typeck_results.type_dependent_defs_mut().remove(e.hir_id); typeck_results.node_substs_mut().remove(e.hir_id);


<ins> // compile-flags: -Z mir-opt-level=0 // EMIT_MIR issue_91633.hey.mir_map.0.mir fn hey<T> (it: &[T]) where [T] : std::ops::Index<usize>, { let _ = &it[0]; } // EMIT_MIR issue_91633.bar.mir_map.0.mir fn bar<T> (it: Box<[T]>) where [T] : std::ops::Index<usize>, { let _ = it[0]; } // EMIT_MIR issue_91633.fun.mir_map.0.mir fn fun<T> (it: &[T]) -> &T { let f = &it[0]; f } // EMIT_MIR issue_91633.foo.mir_map.0.mir fn foo<T: Clone> (it: Box<[T]>) -> T { let f = it[0].clone(); f } fn main(){} </ins>


<ins> // MIR for `bar` 0 mir_map fn bar(_1: Box<[T]>) -> () { debug it => _1;                      // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14 let mut _0: ();                      // return place in scope 0 at $DIR/issue-91633.rs:+1:2: +1:2 let mut _2: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue-91633.rs:+4:14: +4:19 let mut _3: &[T];                    // in scope 0 at $DIR/issue-91633.rs:+4:14: +4:16 scope 1 { } bb0: { StorageLive(_2);                 // scope 0 at $DIR/issue-91633.rs:+4:14: +4:19 StorageLive(_3);                 // scope 0 at $DIR/issue-91633.rs:+4:14: +4:16 _3 = &(*_1);                     // scope 0 at $DIR/issue-91633.rs:+4:14: +4:16 _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue-91633.rs:+4:14: +4:19 // mir::Constant // + span: $DIR/issue-91633.rs:15:14: 15:19 // + literal: Const { ty: for<'r> fn(&'r [T], usize) -> &'r <[T] as Index<usize>>::Output {<[T] as Index<usize>>::index}, val: Value(<ZST>) } } bb1: { StorageDead(_3);                 // scope 0 at $DIR/issue-91633.rs:+4:18: +4:19 StorageDead(_2);                 // scope 0 at $DIR/issue-91633.rs:+4:19: +4:20 _0 = const ();                   // scope 0 at $DIR/issue-91633.rs:+3:2: +5:3 drop(_1) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/issue-91633.rs:+5:2: +5:3 } bb2: { return;                          // scope 0 at $DIR/issue-91633.rs:+5:3: +5:3 } bb3 (cleanup): { drop(_1) -> bb4;                 // scope 0 at $DIR/issue-91633.rs:+5:2: +5:3 } bb4 (cleanup): { resume;                          // scope 0 at $DIR/issue-91633.rs:+0:1: +5:3 } } </ins>


<ins> // MIR for `foo` 0 mir_map fn foo(_1: Box<[T]>) -> T { debug it => _1;                      // in scope 0 at $DIR/issue-91633.rs:+0:19: +0:21 let mut _0: T;                       // return place in scope 0 at $DIR/issue-91633.rs:+0:36: +0:37 let _2: T;                           // in scope 0 at $DIR/issue-91633.rs:+2:10: +2:11 let mut _3: &T;                      // in scope 0 at $DIR/issue-91633.rs:+2:14: +2:27 let _4: usize;                       // in scope 0 at $DIR/issue-91633.rs:+2:17: +2:18 let mut _5: usize;                   // in scope 0 at $DIR/issue-91633.rs:+2:14: +2:19 let mut _6: bool;                    // in scope 0 at $DIR/issue-91633.rs:+2:14: +2:19 scope 1 { debug f => _2;                   // in scope 1 at $DIR/issue-91633.rs:+2:10: +2:11 } bb0: { StorageLive(_2);                 // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11 StorageLive(_3);                 // scope 0 at $DIR/issue-91633.rs:+2:14: +2:27 StorageLive(_4);                 // scope 0 at $DIR/issue-91633.rs:+2:17: +2:18 _4 = const 0_usize;              // scope 0 at $DIR/issue-91633.rs:+2:17: +2:18 _5 = Len((*_1));                 // scope 0 at $DIR/issue-91633.rs:+2:14: +2:19 _6 = Lt(_4, _5);                 // scope 0 at $DIR/issue-91633.rs:+2:14: +2:19 assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind: bb5]; // scope 0 at $DIR/issue-91633.rs:+2:14: +2:19 } bb1: { _3 = &(*_1)[_4];                 // scope 0 at $DIR/issue-91633.rs:+2:14: +2:27 _2 = <T as Clone>::clone(move _3) -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/issue-91633.rs:+2:14: +2:27 // mir::Constant // + span: $DIR/issue-91633.rs:28:20: 28:25 // + literal: Const { ty: for<'r> fn(&'r T) -> T {<T as Clone>::clone}, val: Value(<ZST>) } } bb2: { StorageDead(_3);                 // scope 0 at $DIR/issue-91633.rs:+2:26: +2:27 FakeRead(ForLet(None), _2);      // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11 StorageDead(_4);                 // scope 0 at $DIR/issue-91633.rs:+2:27: +2:28 _0 = move _2;                    // scope 1 at $DIR/issue-91633.rs:+3:6: +3:7 drop(_2) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3 } bb3: { StorageDead(_2);                 // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3 drop(_1) -> [return: bb4, unwind: bb6]; // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3 } bb4: { return;                          // scope 0 at $DIR/issue-91633.rs:+4:3: +4:3 } bb5 (cleanup): { drop(_1) -> bb6;                 // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3 } bb6 (cleanup): { resume;                          // scope 0 at $DIR/issue-91633.rs:+0:1: +4:3 } } </ins>


<ins> // MIR for `fun` 0 mir_map fn fun(_1: &[T]) -> &T { debug it => _1;                      // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14 let mut _0: &T;                      // return place in scope 0 at $DIR/issue-91633.rs:+0:25: +0:27 let _2: &T;                          // in scope 0 at $DIR/issue-91633.rs:+2:10: +2:11 let _3: usize;                       // in scope 0 at $DIR/issue-91633.rs:+2:18: +2:19 let mut _4: usize;                   // in scope 0 at $DIR/issue-91633.rs:+2:15: +2:20 let mut _5: bool;                    // in scope 0 at $DIR/issue-91633.rs:+2:15: +2:20 scope 1 { debug f => _2;                   // in scope 1 at $DIR/issue-91633.rs:+2:10: +2:11 } bb0: { StorageLive(_2);                 // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11 StorageLive(_3);                 // scope 0 at $DIR/issue-91633.rs:+2:18: +2:19 _3 = const 0_usize;              // scope 0 at $DIR/issue-91633.rs:+2:18: +2:19 _4 = Len((*_1));                 // scope 0 at $DIR/issue-91633.rs:+2:15: +2:20 _5 = Lt(_3, _4);                 // scope 0 at $DIR/issue-91633.rs:+2:15: +2:20 assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue-91633.rs:+2:15: +2:20 } bb1: { _2 = &(*_1)[_3];                 // scope 0 at $DIR/issue-91633.rs:+2:14: +2:20 FakeRead(ForLet(None), _2);      // scope 0 at $DIR/issue-91633.rs:+2:10: +2:11 _0 = &(*_2);                     // scope 1 at $DIR/issue-91633.rs:+3:6: +3:7 StorageDead(_3);                 // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3 StorageDead(_2);                 // scope 0 at $DIR/issue-91633.rs:+4:2: +4:3 return;                          // scope 0 at $DIR/issue-91633.rs:+4:3: +4:3 } bb2 (cleanup): { resume;                          // scope 0 at $DIR/issue-91633.rs:+0:1: +4:3 } } </ins>


<ins> // MIR for `hey` 0 mir_map fn hey(_1: &[T]) -> () { debug it => _1;                      // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14 let mut _0: ();                      // return place in scope 0 at $DIR/issue-91633.rs:+1:2: +1:2 let mut _2: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue-91633.rs:+4:14: +4:20 let _3: &<[T] as std::ops::Index<usize>>::Output; // in scope 0 at $DIR/issue-91633.rs:+4:15: +4:20 let mut _4: &[T];                    // in scope 0 at $DIR/issue-91633.rs:+4:15: +4:17 scope 1 { } bb0: { StorageLive(_2);                 // scope 0 at $DIR/issue-91633.rs:+4:14: +4:20 StorageLive(_3);                 // scope 0 at $DIR/issue-91633.rs:+4:15: +4:20 StorageLive(_4);                 // scope 0 at $DIR/issue-91633.rs:+4:15: +4:17 _4 = &(*_1);                     // scope 0 at $DIR/issue-91633.rs:+4:15: +4:17 _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/issue-91633.rs:+4:15: +4:20 // mir::Constant // + span: $DIR/issue-91633.rs:7:15: 7:20 // + literal: Const { ty: for<'r> fn(&'r [T], usize) -> &'r <[T] as Index<usize>>::Output {<[T] as Index<usize>>::index}, val: Value(<ZST>) } } bb1: { StorageDead(_4);                 // scope 0 at $DIR/issue-91633.rs:+4:19: +4:20 _2 = &(*_3);                     // scope 0 at $DIR/issue-91633.rs:+4:14: +4:20 StorageDead(_2);                 // scope 0 at $DIR/issue-91633.rs:+4:20: +4:21 _0 = const ();                   // scope 0 at $DIR/issue-91633.rs:+3:2: +5:3 StorageDead(_3);                 // scope 0 at $DIR/issue-91633.rs:+5:2: +5:3 return;                          // scope 0 at $DIR/issue-91633.rs:+5:3: +5:3 } bb2 (cleanup): { resume;                          // scope 0 at $DIR/issue-91633.rs:+0:1: +5:3 } } </ins>


<ins> // check-pass fn f<T> (it: &[T]) where [T] : std::ops::Index<usize>, { let _ = &it[0]; } fn main(){} </ins>


db.span_note(glob_reexport_span, format!("the name `{}` in the {} namespace is supposed to be publicly re-exported here", name, namespace)); db.span_note(private_item_span, "but the private item here shadows it".to_owned()); } <ins> BuiltinLintDiagnostics::UnusedQualifications { path_span, unqualified_path } => { db.span_suggestion_verbose( path_span, "replace it with the unqualified path", unqualified_path, Applicability::MachineApplicable ); } </ins> } // Rewrap `db`, and pass control to the user. decorate(db)


/// The local binding that shadows the glob reexport. private_item_span: Span, }, <ins> UnusedQualifications { /// The span of the unnecessarily-qualified path. path_span: Span, /// The replacement unqualified path. unqualified_path: Ident, }, </ins> } /// Lints that are buffered up early on in the `Session` before the


}; if res == unqualified_result { let lint = lint::builtin::UNUSED_QUALIFICATIONS; <del> self.r.lint_buffer.buffer_lint( </del> <ins> self.r.lint_buffer.buffer_lint_with_diagnostic( </ins> lint, finalize.node_id, finalize.path_span, "unnecessary qualification", <ins> lint::BuiltinLintDiagnostics::UnusedQualifications { path_span: finalize.path_span, unqualified_path: path.last().unwrap().ident } </ins> ) } }


| LL | #![deny(unused_qualifications)] |         ^^^^^^^^^^^^^^^^^^^^^ <ins> help: replace it with the unqualified path | LL |     bar(); |     ~~~ </ins> error: aborting due to previous error


<ins> // run-rustfix #![deny(unused_qualifications)] mod foo { pub fn bar() {} } mod baz { pub mod qux { pub fn quux() {} } } fn main() { use foo::bar; bar(); //~^ ERROR unnecessary qualification use baz::qux::quux; quux(); //~^ ERROR unnecessary qualification } </ins>


<ins> // run-rustfix #![deny(unused_qualifications)] mod foo { pub fn bar() {} } mod baz { pub mod qux { pub fn quux() {} } } fn main() { use foo::bar; foo::bar(); //~^ ERROR unnecessary qualification use baz::qux::quux; baz::qux::quux(); //~^ ERROR unnecessary qualification } </ins>


<ins> error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:17:5 | LL |     foo::bar(); |     ^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-qualifications-suggestion.rs:3:9 | LL | #![deny(unused_qualifications)] |         ^^^^^^^^^^^^^^^^^^^^^ help: replace it with the unqualified path | LL |     bar(); |     ~~~ error: unnecessary qualification --> $DIR/unused-qualifications-suggestion.rs:21:5 | LL |     baz::qux::quux(); |     ^^^^^^^^^^^^^^ | help: replace it with the unqualified path | LL |     quux(); |     ~~~~ error: aborting due to 2 previous errors </ins>


<ins> // edition:2021 use std::iter; fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> { //~^ ERROR: missing generics for struct `Vec` [E0107] iter::empty() //~ ERROR: type annotations needed [E0282] } fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> { //~^ ERROR: type annotations needed [E0282] f(data).filter(|x| x == target) } fn main() {} </ins>


<ins> error[E0107]: missing generics for struct `Vec` --> $DIR/issue-92305.rs:5:45 | LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> { |                                             ^^^ expected at least 1 generic argument | note: struct defined here, with at least 1 generic parameter: `T` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { |            ^^^ - help: add missing generic argument | LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> { |                                             ~~~~~~ error[E0282]: type annotations needed --> $DIR/issue-92305.rs:7:5 | LL |     iter::empty() |     ^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the function `empty` error[E0282]: type annotations needed --> $DIR/issue-92305.rs:10:35 | LL | fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> { |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type error: aborting due to 3 previous errors Some errors have detailed explanations: E0107, E0282. For more information about an error, try `rustc --explain E0107`. </ins>


saved_locals: &GeneratorSavedLocals, ) { let did = body.source.def_id(); <del> let allowed_upvars = tcx.erase_regions(upvars); </del> <ins> let param_env = tcx.param_env(did); let allowed_upvars = tcx.normalize_erasing_regions(param_env, upvars); </ins> let allowed = match witness.kind() { <del> &ty::GeneratorWitness(s) => tcx.erase_late_bound_regions(s), </del> <ins> &ty::GeneratorWitness(interior_tys) => { tcx.normalize_erasing_late_bound_regions(param_env, interior_tys) } </ins> _ => { tcx.sess.delay_span_bug( body.span,


} }; <del> let param_env = tcx.param_env(did); </del> for (local, decl) in body.local_decls.iter_enumerated() { // Ignore locals which are internal or not saved between yields. if !saved_locals.contains(local) || decl.internal {


<ins> // edition:2018 // run-pass #![allow(incomplete_features)] #![feature(generic_const_exprs)] #![allow(unused)] fn main() { let x = test(); } fn concat<const A: usize, const B: usize>(a: [f32; A], b: [f32; B]) -> [f32; A + B] { todo!() } async fn reverse<const A: usize>(x: [f32; A]) -> [f32; A] { todo!() } async fn test() { let a = [0.0]; let b = [1.0, 2.0]; let ab = concat(a,b); let ba = reverse(ab).await; println!("{:?}", ba); } </ins>


Extern functions may be called directly from Rust code as Rust uses large, contiguous stack segments like C. <del> ### Type definitions </del> <ins> ### Type aliases </ins> <del> A _type definition_ defines a new name for an existing [type](#types). Type definitions are declared with the keyword `type`. Every value has a single, </del> <ins> A _type alias_ defines a new name for an existing [type](#types). Type aliases are declared with the keyword `type`. Every value has a single, </ins> specific type; the type-specified aspects of a value include: * Whether the value is composed of sub-values or is indivisible.


<ins> // Regression test for <https://github.com/rust-lang/rust/issues/92859>. #![allow(incomplete_features)] #![feature(generic_const_exprs)] #![crate_name = "foo"] // @has 'foo/trait.Foo.html' pub trait Foo: Sized { const WIDTH: usize; fn arrayify(self) -> [Self; Self::WIDTH]; } impl<T: Sized> Foo for T { const WIDTH: usize = 1; // @has - '//*[@id="tymethod.arrayify"]/*[@class="code-header"]'  // 'fn arrayify(self) -> [Self; Self::WIDTH]' fn arrayify(self) -> [Self; Self::WIDTH] { [self] } } </ins>


"clippy_utils", "if_chain", "itertools 0.10.1", <del> "pulldown-cmark 0.9.0", </del> <ins> "pulldown-cmark", </ins> "quine-mc_cluskey", "regex-syntax", "rustc-semver",


[[package]] name = "mdbook" <del> version = "0.4.14" </del> <ins> version = "0.4.15" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "f6e77253c46a90eb7e96b2807201dab941a4db5ea05eca5aaaf7027395f352b3" </del> <ins> checksum = "241f10687eb3b4e0634b3b4e423f97c5f1efbd69dc9522e24a8b94583eeec3c6" </ins> dependencies = [ "ammonia", "anyhow",


"log", "memchr", "opener", <del> "pulldown-cmark 0.8.0", </del> <ins> "pulldown-cmark", </ins> "regex", "serde", "serde_derive",


[[package]] name = "pulldown-cmark" <del> version = "0.8.0" </del> <ins> version = "0.9.1" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" </del> <ins> checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6" </ins> dependencies = [ "bitflags", "getopts",


] [[package]] <del> name = "pulldown-cmark" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acd16514d1af5f7a71f909a44ef253cdb712a376d7ebc8ae4a471a9be9743548" dependencies = [ "bitflags", "memchr", "unicase", ] [[package]] </del> name = "punycode" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index"


"expect-test", "itertools 0.9.0", "minifier", <del> "pulldown-cmark 0.9.0", </del> <ins> "pulldown-cmark", </ins> "rayon", "regex", "rustdoc-json-types",


debug!(?result, "CACHE MISS"); self.insert_evaluation_cache(param_env, fresh_trait_pred, dep_node, result); <del> stack.cache().on_completion(stack.dfn, |fresh_trait_pred, provisional_result| { self.insert_evaluation_cache( param_env, fresh_trait_pred, dep_node, provisional_result.max(result), ); }); </del> <ins> stack.cache().on_completion( stack.dfn, |fresh_trait_pred, provisional_result, provisional_dep_node| { // Create a new `DepNode` that has dependencies on: // * The `DepNode` for the original evaluation that resulted in a provisional cache // entry being crated // * The `DepNode` for the *current* evaluation, which resulted in us completing // provisional caches entries and inserting them into the evaluation cache // // This ensures that when a query reads this entry from the evaluation cache, // it will end up (transitively) dependening on all of the incr-comp dependencies // created during the evaluation of this trait. For example, evaluating a trait // will usually require us to invoke `type_of(field_def_id)` to determine the // constituent types, and we want any queries reading from this evaluation // cache entry to end up with a transitive `type_of(field_def_id`)` dependency. // // By using `in_task`, we're also creating an edge from the *current* query // to the newly-created `combined_dep_node`. This is probably redundant, // but it's better to add too many dep graph edges than to add too few // dep graph edges. let ((), combined_dep_node) = self.in_task(|this| { this.tcx().dep_graph.read_index(provisional_dep_node); this.tcx().dep_graph.read_index(dep_node); }); self.insert_evaluation_cache( param_env, fresh_trait_pred, combined_dep_node, provisional_result.max(result), ); }, ); </ins> } else { debug!(?result, "PROVISIONAL"); debug!(


fresh_trait_pred, stack.depth, reached_depth, ); <del> stack.cache().insert_provisional(stack.dfn, reached_depth, fresh_trait_pred, result); </del> <ins> stack.cache().insert_provisional( stack.dfn, reached_depth, fresh_trait_pred, result, dep_node, ); </ins> } Ok(result)


from_dfn: usize, reached_depth: usize, result: EvaluationResult, <ins> /// The `DepNodeIndex` created for the `evaluate_stack` call for this provisional /// evaluation. When we create an entry in the evaluation cache using this provisional /// cache entry (see `on_completion`), we use this `dep_node` to ensure that future reads from /// the cache will have all of the necessary incr comp dependencies tracked. dep_node: DepNodeIndex, </ins> } impl<'tcx> Default for ProvisionalEvaluationCache<'tcx> {


reached_depth: usize, fresh_trait_pred: ty::PolyTraitPredicate<'tcx>, result: EvaluationResult, <ins> dep_node: DepNodeIndex, </ins> ) { debug!(?from_dfn, ?fresh_trait_pred, ?result, "insert_provisional");


} } <del> map.insert(fresh_trait_pred, ProvisionalEvaluation { from_dfn, reached_depth, result }); </del> <ins> map.insert( fresh_trait_pred, ProvisionalEvaluation { from_dfn, reached_depth, result, dep_node }, ); </ins> } /// Invoked when the node with dfn `dfn` does not get a successful


fn on_completion( &self, dfn: usize, <del> mut op: impl FnMut(ty::PolyTraitPredicate<'tcx>, EvaluationResult), </del> <ins> mut op: impl FnMut(ty::PolyTraitPredicate<'tcx>, EvaluationResult, DepNodeIndex), </ins> ) { debug!(?dfn, "on_completion");


{ debug!(?fresh_trait_pred, ?eval, "on_completion"); <del> op(fresh_trait_pred, eval.result); </del> <ins> op(fresh_trait_pred, eval.result, eval.dep_node); </ins> } } }


<ins> // revisions: rpass1 rpass2 // Regression test for issue #92987 // Tests that we properly manage `DepNode`s during trait evaluation // involing an auto-trait cycle. #[cfg(rpass1)] struct CycleOne(Box<CycleTwo>); #[cfg(rpass2)] enum CycleOne { Variant(Box<CycleTwo>) } struct CycleTwo(CycleOne); fn assert_send<T: Send>() {} fn bar() { assert_send::<CycleOne>(); assert_send::<CycleTwo>(); } fn main() {} </ins>


 {#- -#} <form class="search-form"> {#- -#}
 {#- -#}   {#- This empty span is a hacky fix for Safari - See #93184 -#}  <input {# -#} class="search-input" {# -#} name="search" {# -#}


<ins> // Regression test for #93205 #![crate_name = "foo"] mod generated { pub struct MyNewType; impl MyNewType { pub const FOO: Self = Self; } } pub use generated::MyNewType; mod prelude { impl super::MyNewType { /// An alias for [`Self::FOO`]. // @has 'foo/struct.MyNewType.html' '//a[@href="struct.MyNewType.html#associatedconstant.FOO"]' 'Self::FOO' pub const FOO2: Self = Self::FOO; } } </ins>


self } <ins> /// Clear any existing suggestions. pub fn clear_suggestions(&mut self) -> &mut Self { if let Ok(suggestions) = &mut self.suggestions { suggestions.clear(); } self } </ins> /// Helper for pushing to `self.suggestions`, if available (not disable). fn push_suggestion(&mut self, suggestion: CodeSuggestion) { if let Ok(suggestions) = &mut self.suggestions {


forward!(pub fn set_is_lint(&mut self,) -> &mut Self); forward!(pub fn disable_suggestions(&mut self,) -> &mut Self); <ins> forward!(pub fn clear_suggestions(&mut self,) -> &mut Self); </ins> forward!(pub fn multipart_suggestion( &mut self,


//    | //    = note: cannot satisfy `_: Tt` <ins> // Clear any more general suggestions in favor of our specific one err.clear_suggestions(); </ins> err.span_suggestion_verbose( span.shrink_to_hi(), &format!(


| = help: normalized in stderr note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` <del> --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:538:19 </del> <ins> --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:539:19 </ins> | LL |         arg: impl IntoDiagnosticArg, |                   ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg`


| LL | fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> { |                 ^^^^^^^ required by this bound in `foo` <del> help: consider giving `foo` an explicit type, where the type for type parameter `W` is specified | LL |     let foo: Foo<i32, &str, W, Z> = foo(1, ""); |            ++++++++++++++++++++++ </del> help: consider specifying the type arguments in the function call | LL |     let foo = foo::<T, K, W, Z>(1, "");


| LL | fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { |                 ^^^^^^^ required by this bound in `bar` <del> help: consider giving `bar` an explicit type, where the type for type parameter `Z` is specified | LL |     let bar: Bar<i32, &str, Z> = bar(1, ""); |            +++++++++++++++++++ </del> help: consider specifying the type arguments in the function call | LL |     let bar = bar::<T, K, Z>(1, "");


| LL |         K: Borrow<Q>, |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` <del> help: consider specifying the generic argument | LL |         .get::<Q>(&"key".into()) |             +++++ </del> help: consider specifying the type argument in the function call | LL |         .get::<Q>(&"key".into())


| LL |         K: Borrow<Q>, |            ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` <del> help: consider specifying the generic argument | LL |     opts.get::<Q>(opt.as_ref()); |             +++++ </del> help: consider specifying the type argument in the function call | LL |     opts.get::<Q>(opt.as_ref());


|    ---- required by a bound in this LL | where T : Convert<U> |           ^^^^^^^^^^ required by this bound in `test` <del> help: consider specifying the generic arguments | LL |     test::<i32, U>(22, std::default::Default::default()); |         ++++++++++ </del> help: consider specifying the type arguments in the function call | LL |     test::<T, U>(22, std::default::Default::default());


| LL | fn foo<T: Into<String>>(x: i32) {} |           ^^^^^^^^^^^^ required by this bound in `foo` <del> help: consider specifying the generic argument | LL |     foo::<T>(42); |        +++++ </del> help: consider specifying the type argument in the function call | LL |     foo::<T>(42);


if self.has_root() { return false; } <del> let mut iter = self.path[self.prefix_len()..].iter(); </del> <ins> let mut iter = self.path[self.prefix_remaining()..].iter(); </ins> match (iter.next(), iter.next()) { (Some(&b'.'), None) => true, (Some(&b'.'), Some(&b)) => self.is_sep_byte(b),


assert_eq!(prefix, parse_prefix(r"/?C:windowssystem32notepad.exe")); assert_eq!(prefix, parse_prefix(r"?/C:windowssystem32notepad.exe")); } <ins> // See #93586 for more infomation. #[test] fn test_windows_prefix_components() { use crate::path::Path; let path = Path::new("C:"); let mut components = path.components(); let drive = components.next().expect("drive is expected here"); assert_eq!(drive.as_os_str(), OsStr::new("C:")); assert_eq!(components.as_path(), Path::new("")); } </ins>


this.visit_ty(&ty); } } <del> GenericParamKind::Const { ref ty, .. } => { </del> <ins> GenericParamKind::Const { ref ty, default } => { </ins> let was_in_const_generic = this.is_in_const_generic; this.is_in_const_generic = true; walk_list!(this, visit_param_bound, param.bounds); this.visit_ty(&ty); <ins> if let Some(default) = default { this.visit_body(this.tcx.hir().body(default.body)); } </ins> this.is_in_const_generic = was_in_const_generic; } }


<ins> struct X<const N: usize = { (||1usize)() //~^ ERROR calls in constants are limited to }>; fn main() {} </ins>


<ins> error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-93647.rs:2:5 | LL |     (||1usize)() |     ^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0015`. </ins>


<ins> struct Foo< 'a, const N: usize = { let x: &'a (); //~^ ERROR use of non-static lifetime `'a` in const generic 3 }, >(&'a ()); fn main() {} </ins>


<ins> error[E0771]: use of non-static lifetime `'a` in const generic --> $DIR/outer-lifetime-in-const-generic-default.rs:4:17 | LL |         let x: &'a (); |                 ^^ | = note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052> error: aborting due to previous error For more information about this error, try `rustc --explain E0771`. </ins>


// The new pass manager is enabled by default for LLVM >= 13. // This matches Clang, which also enables it since Clang 13. <del> // FIXME: There are some perf issues with the new pass manager // when targeting s390x, so it is temporarily disabled for that // arch, see https://github.com/rust-lang/rust/issues/89609 user_opt.unwrap_or_else(|| target_arch != "s390x" && llvm_util::get_version() >= (13, 0, 0)) </del> <ins> // There are some perf issues with the new pass manager when targeting // s390x with LLVM 13, so enable the new pass manager only with LLVM 14. // See https://github.com/rust-lang/rust/issues/89609. let min_version = if target_arch == "s390x" { 14 } else { 13 }; user_opt.unwrap_or_else(|| llvm_util::get_version() >= (min_version, 0, 0)) </ins> }


<del> Subproject commit e29ac13bc97e26f886c3bfe72f9135e994c3cd0a </del> <ins> Subproject commit c8eccf626fb5bb851b2ade93af8851ca1523807f </ins>


// run-pass <del> // ignore-wasm32-bare FIXME(#93923) llvm miscompilation </del> use std::collections::HashMap; use std::path::Path;


<ins> // Issue #94176: wrong span for the error message of a mismatched type error, // if the function uses a `let else` construct. #![feature(let_else)] pub fn test(a: Option<u32>) -> Option<u32> { //~ ERROR mismatched types let Some(_) = a else { return None; }; println!("Foo"); } fn main() {} </ins>


<ins> error[E0308]: mismatched types --> $DIR/issue-94176.rs:5:32 | LL | pub fn test(a: Option<u32>) -> Option<u32> { |        ----                    ^^^^^^^^^^^ expected enum `Option`, found `()` |        | |        implicitly returns `()` as its body has no tail or `return` expression | = note:   expected enum `Option<u32>` found unit type `()` help: consider returning the local binding `a` | LL ~     println!("Foo"); LL +     a | error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>


<ins> // // popped up in in #94012, where an alternative desugaring was // causing unreachable code errors #![feature(let_else)] #![deny(unused_variables)] #![deny(unreachable_code)] fn let_else_diverge() -> bool { let Some(_) = Some("test") else { let x = 5; //~ ERROR unused variable: `x` return false; }; return true; } fn main() { let_else_diverge(); } </ins>


<ins> error: unused variable: `x` --> $DIR/let-else-then-diverge.rs:11:13 | LL |         let x = 5; |             ^ help: if this is intentional, prefix it with an underscore: `_x` | note: the lint level is defined here --> $DIR/let-else-then-diverge.rs:6:9 | LL | #![deny(unused_variables)] |         ^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>


<ins> // check-pass #![feature(generic_const_exprs)] #![allow(incomplete_features)] #![deny(const_evaluatable_unchecked)] pub struct If<const CONDITION: bool>; pub trait True {} impl True for If<true> {} pub struct FixedI8<const FRAC: u32> { pub bits: i8, } impl<const FRAC_LHS: u32, const FRAC_RHS: u32> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS> where If<{ FRAC_RHS <= 8 }>: True, { fn eq(&self, _rhs: &FixedI8<FRAC_RHS>) -> bool { unimplemented!() } } impl<const FRAC: u32> PartialEq<i8> for FixedI8<FRAC> { fn eq(&self, rhs: &i8) -> bool { let rhs_as_fixed = FixedI8::<0> { bits: *rhs }; PartialEq::eq(self, &rhs_as_fixed) } } fn main() {} </ins>


target: Target, item: Option<ItemLike<'_>>, ) -> bool { <del> let is_function = matches!(target, Target::Fn | Target::Method(..)); </del> <ins> let is_function = matches!(target, Target::Fn); </ins> if !is_function { self.tcx .sess


#[rustc_legacy_const_generics(0)] //~ ERROR #[rustc_legacy_const_generics] functions must only have fn foo8<X>() {} <ins> impl S { #[rustc_legacy_const_generics(0)] //~ ERROR attribute should be applied to a function fn foo9<const X: usize>() {} } </ins> #[rustc_legacy_const_generics] //~ ERROR malformed `rustc_legacy_const_generics` attribute fn bar1() {}


= help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.) error: malformed `rustc_legacy_const_generics` attribute input <del> --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:32:1 </del> <ins> --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:37:1 </ins> | LL | #[rustc_legacy_const_generics] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_legacy_const_generics(N)]` error: malformed `rustc_legacy_const_generics` attribute input <del> --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:35:1 </del> <ins> --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:40:1 </ins> | LL | #[rustc_legacy_const_generics = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_legacy_const_generics(N)]`


|         - non-const generic parameter error: attribute should be applied to a function <ins> --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:33:5 | LL |     #[rustc_legacy_const_generics(0)] |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL |     fn foo9<const X: usize>() {} |     ---------------------------- not a function error: attribute should be applied to a function </ins> --> $DIR/invalid-rustc_legacy_const_generics-arguments.rs:25:5 | LL |     #[rustc_legacy_const_generics(1)]


| = help: replace the const parameters with concrete consts <del> error: aborting due to 12 previous errors </del> <ins> error: aborting due to 13 previous errors </ins> For more information about this error, try `rustc --explain E0044`.


// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` <del> #[cfg(stage0, not(test))] use core::raw; #[cfg(stage0, not(test))] use util; </del> /// Returns a pointer to `size` bytes of memory. /// /// Behavior is undefined if the requested size is 0 or the alignment is not a


deallocate(ptr, size, align); } <del> #[cfg(stage0, not(test))] #[lang="closure_exchange_malloc"] #[inline] #[allow(deprecated)] unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *mut u8 { let total_size = util::get_box_size(size, align); let p = allocate(total_size, 8); let alloc = p as *mut raw::Box<()>; (*alloc).drop_glue = drop_glue; alloc as *mut u8 } </del> // The minimum alignment guaranteed by the architecture. This value is used to // add fast paths for low alignment values. In practice, the alignment is a // constant at the call site and the branch will be optimized out.


flags: c_int) -> *mut c_void; fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t; <del> #[cfg(stage0)] fn je_dallocx(ptr: *mut c_void, flags: c_int); #[cfg(not(stage0))] </del> fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); fn je_nallocx(size: size_t, flags: c_int) -> size_t; fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void,


} #[inline] <del> #[cfg(stage0)] pub unsafe fn deallocate(ptr: *mut u8, _size: uint, align: uint) { let flags = align_to_flags(align); je_dallocx(ptr as *mut c_void, flags) } #[inline] #[cfg(not(stage0))] </del> pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) { let flags = align_to_flags(align); je_sdallocx(ptr as *mut c_void, size as size_t, flags)


//! These definitions are similar to their `ct` equivalents, but differ in that //! these can be statically allocated and are slightly optimized for the runtime <del> #[cfg(stage0)] #[doc(hidden)] pub enum Piece<'a> { String(&'a str), Argument(Argument<'a>), } </del> #[doc(hidden)] pub struct Argument<'a> { pub position: Position,


<ins> S 2014-09-16 828e075 winnt-x86_64 ce1e9d7f6967bfa368853e7c968e1626cc319951 winnt-i386 a8bd994666dfe683a5d7922c7998500255780724 linux-x86_64 88ff474db96c6ffc5c1dc7a43442cbe1cd88c8a2 linux-i386 7a731891f726c8a0590b142a4e8924c5e8b22e8d freebsd-x86_64 e67a56f76484f775cd4836dedb2d1069ab5d7921 macos-i386 f48023648a77e89086f4a2b39d76b09e4fff032d macos-x86_64 2ad6457b2b3036f87eae7581d64ee5341a07fb06 </ins> S 2014-09-10 6faa4f3 winnt-x86_64 939eb546469cb936441cff3b6f2478f562f77c46 winnt-i386 cfe4f8b519bb9d62588f9310a8f94bc919d5423b


use crate::collections::TryReserveError; use crate::fmt; use crate::hash::{Hash, Hasher}; <del> use crate::iter::FromIterator; </del> <ins> use crate::iter::{FromIterator, FusedIterator}; </ins> use crate::mem; use crate::ops; use crate::rc::Rc;


} } <ins> #[stable(feature = "encode_wide_fused_iterator", since = "1.62.0")] impl FusedIterator for EncodeWide<'_> {} </ins> impl Hash for CodePoint { #[inline] fn hash<H: Hasher>(&self, state: &mut H) {


| PathSource::Struct | PathSource::TupleStruct(..) => false, }; <del> let mut error = false; </del> <ins> let mut res = LifetimeRes::Error; </ins> for rib in self.lifetime_ribs.iter().rev() { match rib.kind { // In create-parameter mode we error here because we don't want to support


//     impl Foo for std::cell::Ref<u32> // note lack of '_ //     async fn foo(_: std::cell::Ref<u32>) { ... } LifetimeRibKind::AnonymousCreateParameter(_) => { <del> error = true; </del> break; } // `PassThrough` is the normal case.


// `PathSegment`, for which there is no associated `'_` or `&T` with no explicit // lifetime. Instead, we simply create an implicit lifetime, which will be checked // later, at which point a suitable error will be emitted. <del> LifetimeRibKind::AnonymousPassThrough(..) | LifetimeRibKind::AnonymousReportError | LifetimeRibKind::Item => break, </del> <ins> LifetimeRibKind::AnonymousPassThrough(binder) => { res = LifetimeRes::Anonymous { binder, elided: true }; break; } LifetimeRibKind::AnonymousReportError | LifetimeRibKind::Item => { // FIXME(cjgillot) This resolution is wrong, but this does not matter // since these cases are erroneous anyway.  Lifetime resolution should // emit a "missing lifetime specifier" diagnostic. res = LifetimeRes::Anonymous { binder: DUMMY_NODE_ID, elided: true }; break; } </ins> _ => {} } } <del> let res = if error { LifetimeRes::Error } else { LifetimeRes::Anonymous { binder: segment_id, elided: true } }; </del> let node_ids = self.r.next_node_ids(expected_lifetimes); self.record_lifetime_res( segment_id,


// originating from macros, since the segment's span might be from a macro arg. segment.ident.span.find_ancestor_inside(path_span).unwrap_or(path_span) }; <del> if error { </del> <ins> if let LifetimeRes::Error = res { </ins> let sess = self.r.session; let mut err = rustc_errors::struct_span_err!( sess,


<ins> // check-pass struct Foo<'a>(&'a ()); fn with_fn() -> fn(Foo) { |_| () } fn with_impl_fn() -> impl Fn(Foo) { |_| () } fn with_where_fn<T>() where T: Fn(Foo), { } fn main() {} </ins>


); err.span_label(self.span, "invalid cast"); if self.expr_ty.is_numeric() { <del> err.span_help( self.span, if self.expr_ty == fcx.tcx.types.i8 { "try casting from `u8` instead" } else if self.expr_ty == fcx.tcx.types.u32 { "try `char::from_u32` instead" } else { "try `char::from_u32` instead (via a `u32`)" }, ); </del> <ins> if self.expr_ty == fcx.tcx.types.u32 { match fcx.tcx.sess.source_map().span_to_snippet(self.expr.span) { Ok(snippet) => err.span_suggestion( self.span, "try `char::from_u32` instead", format!("char::from_u32({snippet})"), Applicability::MachineApplicable, ), Err(_) => err.span_help(self.span, "try `char::from_u32` instead"), }; } else if self.expr_ty == fcx.tcx.types.i8 { err.span_help(self.span, "try casting from `u8` instead"); } else { err.span_help(self.span, "try `char::from_u32` instead (via a `u32`)"); }; </ins> } err.emit(); }


--> $DIR/E0604.rs:2:5 | LL |     1u32 as char; <del> |     ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead --> $DIR/E0604.rs:2:5 | LL |     1u32 as char; </del> |     ^^^^^^^^^^^^ <ins> |     | |     invalid cast |     help: try `char::from_u32` instead: `char::from_u32(1u32)` </ins> error: aborting due to previous error


--> $DIR/error-festival.rs:25:5 | LL |     0u32 as char; <del> |     ^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead --> $DIR/error-festival.rs:25:5 | LL |     0u32 as char; </del> |     ^^^^^^^^^^^^ <ins> |     | |     invalid cast |     help: try `char::from_u32` instead: `char::from_u32(0u32)` </ins> error[E0605]: non-primitive cast: `u8` as `Vec<u8>` --> $DIR/error-festival.rs:29:5


--> $DIR/cast-rfc0401.rs:41:13 | LL |     let _ = 0x61u32 as char; <del> |             ^^^^^^^^^^^^^^^ invalid cast | help: try `char::from_u32` instead --> $DIR/cast-rfc0401.rs:41:13 | LL |     let _ = 0x61u32 as char; </del> |             ^^^^^^^^^^^^^^^ <ins> |             | |             invalid cast |             help: try `char::from_u32` instead: `char::from_u32(0x61u32)` </ins> error[E0606]: casting `bool` as `f32` is invalid --> $DIR/cast-rfc0401.rs:43:13


let second_input_ty = self.resolve_vars_if_possible(expected_input_tys[second_idx]); let third_input_ty = <del> self.resolve_vars_if_possible(expected_input_tys[second_idx]); </del> <ins> self.resolve_vars_if_possible(expected_input_tys[third_idx]); </ins> let span = if third_idx < provided_arg_count { let first_arg_span = provided_args[first_idx].span; let third_arg_span = provided_args[third_idx].span;


} missing_idxs => { let first_idx = *missing_idxs.first().unwrap(); <del> let second_idx = *missing_idxs.last().unwrap(); </del> <ins> let last_idx = *missing_idxs.last().unwrap(); </ins> // NOTE: Because we might be re-arranging arguments, might have extra arguments, etc. // It's hard to *really* know where we should provide this error label, so this is a // decent heuristic <del> let span = if first_idx < provided_arg_count { </del> <ins> let span = if last_idx < provided_arg_count { </ins> let first_arg_span = provided_args[first_idx].span; <del> let second_arg_span = provided_args[second_idx].span; </del> <ins> let last_arg_span = provided_args[last_idx].span; </ins> Span::new( first_arg_span.lo(), <del> second_arg_span.hi(), </del> <ins> last_arg_span.hi(), </ins> first_arg_span.ctxt(), None, )


<ins> fn main() { g((), ()); //~^ ERROR this function takes 6 arguments but 2 arguments were supplied } pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {} </ins>


<ins> error[E0061]: this function takes 6 arguments but 2 arguments were supplied --> $DIR/issue-97197.rs:2:5 | LL |     g((), ()); |     ^-------- multiple arguments are missing | note: function defined here --> $DIR/issue-97197.rs:6:8 | LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {} |        ^ ------  --------  --------  --------  --------  ------ help: provide the arguments | LL |     g((), {bool}, {bool}, {bool}, {bool}, ()); |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to previous error For more information about this error, try `rustc --explain E0061`. </ins>


--> $DIR/missing_arguments.rs:39:3 | LL |   complex(   1,                     ""   ); <del> |   ^^^^^^^--------------------------------- three arguments of type `f32`, `i32`, and `i32` are missing </del> <ins> |   ^^^^^^^--------------------------------- three arguments of type `f32`, `i32`, and `f32` are missing </ins> | note: function defined here --> $DIR/missing_arguments.rs:7:4


<del> Subproject commit 47848665966fc7393cb6f898077994f6dec2b591 </del> <ins> Subproject commit c9e2e89ed3aa5a3be77143aa0c86906b4138374a </ins>


"libc", "once_cell", "opener", <del> "pretty_assertions", </del> <ins> "pretty_assertions 0.7.2", </ins> "serde", "serde_json", "tar",


] [[package]] <ins> name = "crossbeam" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" dependencies = [ "cfg-if 1.0.0", "crossbeam-channel", "crossbeam-deque", "crossbeam-epoch", "crossbeam-queue", "crossbeam-utils", ] [[package]] </ins> name = "crossbeam-channel" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index"


] [[package]] <ins> name = "crossbeam-queue" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", ] [[package]] </ins> name = "crossbeam-utils" version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index"


version = "0.1.0" dependencies = [ "colored", <del> "compiletest_rs", </del> "env_logger 0.9.0", "getrandom 0.2.0", <ins> "lazy_static", </ins> "libc", "log", "measureme 9.1.2", "rand 0.8.5", <ins> "regex", </ins> "rustc-workspace-hack", <del> "rustc_version", </del> "shell-escape", "smallvec", <ins> "ui_test", </ins> ] [[package]]


] [[package]] <ins> name = "pretty_assertions" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563" dependencies = [ "ansi_term", "ctor", "diff", "output_vt100", ] [[package]] </ins> name = "pretty_env_logger" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index"


checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] <ins> name = "ui_test" version = "0.1.0" dependencies = [ "colored", "crossbeam", "lazy_static", "pretty_assertions 1.2.1", "regex", "rustc_version", ] [[package]] </ins> name = "unic-char-property" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index"


return; } <del> // # Run `cargo test` with `-Zmir-opt-level=4`. cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4"); if !try_run(builder, &mut cargo) { return; } </del> // # Done! builder.save_toolstate("miri", ToolState::TestPass); } else {


<del> Subproject commit 22c97b33e470d0b7c085e98417bef8b362d43d4e </del> <ins> Subproject commit 065ff89e33b67b3527fcdd56cf8b432e593e32d4 </ins>


<ins> // check-pass #[allow(unused)] fn test<T, F, U>(f: F) -> Box<dyn Fn(T) -> U + 'static> where F: 'static + Fn(T) -> U, for<'a> U: 'a, // < This is the problematic line, see #97607 { Box::new(move |t| f(t)) } fn main() {} </ins>


let llvm_selfprofiler = llvm_profiler.as_mut().map(|s| s as *mut _ as *mut c_void).unwrap_or(std::ptr::null_mut()); <del> let extra_passes = config.passes.join(","); </del> <ins> let extra_passes = if !is_lto { config.passes.join(",") } else { "".to_string() }; </ins> let llvm_plugins = config.llvm_plugins.join(",");


} fn variances_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[ty::Variance] { <ins> // Skip items with no generics - there's nothing to infer in them. if tcx.generics_of(item_def_id).count() == 0 { return &[]; } </ins> match tcx.def_kind(item_def_id) { DefKind::Fn | DefKind::AssocFn


<ins> fn main() {} trait A { fn a(aa: B) -> Result<_, B> { //~^ ERROR: the placeholder `_` is not allowed within types on item signatures for return types [E0121] Ok(()) } } enum B {} </ins>


<ins> error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/issue-98260.rs:3:27 | LL |     fn a(aa: B) -> Result<_, B> { |                    -------^---- |                    |      | |                    |      not allowed in type signatures |                    help: replace with the correct return type: `Result<(), B>` error: aborting due to previous error For more information about this error, try `rustc --explain E0121`. </ins>


Self::with_capacity_in(capacity, Global) } <del> /// Creates a `Vec<T>` directly from the raw components of another vector. </del> <ins> /// Creates a `Vec<T>` directly from a pointer, a capacity, and a length. </ins> /// /// # Safety /// /// This is highly unsafe, due to the number of invariants that aren't /// checked: /// <del> /// * `ptr` needs to have been previously allocated via [`String`]/`Vec<T>` ///   (at least, it's highly likely to be incorrect if it wasn't). </del> /// * `T` needs to have the same alignment as what `ptr` was allocated with. ///   (`T` having a less strict alignment is not sufficient, the alignment really ///   needs to be equal to satisfy the [`dealloc`] requirement that memory must be


///   to be the same size as the pointer was allocated with. (Because similar to ///   alignment, [`dealloc`] must be called with the same layout `size`.) /// * `length` needs to be less than or equal to `capacity`. <ins> /// * The first `length` values must be properly initialized values of type `T`. /// * `capacity` needs to be the capacity that the pointer was allocated with. /// * The allocated size in bytes must be no larger than `isize::MAX`. ///   See the safety documentation of [`pointer::offset`]. /// /// These requirements are always upheld by any `ptr` that has been allocated /// via `Vec<T>`. Other allocation sources are allowed if the invariants are /// upheld. </ins> /// /// Violating these may cause problems like corrupting the allocator's /// internal data structures. For example it is normally **not** safe


///     assert_eq!(rebuilt, [4, 5, 6]); /// } /// ``` <ins> /// /// Using memory that was allocated elsewhere: /// /// ```rust /// #![feature(allocator_api)] /// /// use std::alloc::{AllocError, Allocator, Global, Layout}; /// /// fn main() { ///     let layout = Layout::array::<u32>(16).expect("overflow cannot happen"); /// ///     let vec = unsafe { ///         let mem = match Global.allocate(layout) { ///             Ok(mem) => mem.cast::<u32>().as_ptr(), ///             Err(AllocError) => return, ///         }; /// ///         mem.write(1_000_000); /// ///         Vec::from_raw_parts_in(mem, 1, 16, Global) ///     }; /// ///     assert_eq!(vec, &[1_000_000]); ///     assert_eq!(vec.capacity(), 16); /// } /// ``` </ins> #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn from_raw_parts(ptr: *mut T, length: usize, capacity: usize) -> Self {


Vec { buf: RawVec::with_capacity_in(capacity, alloc), len: 0 } } <del> /// Creates a `Vec<T, A>` directly from the raw components of another vector. </del> <ins> /// Creates a `Vec<T, A>` directly from a pointer, a capacity, a length, /// and an allocator. </ins> /// /// # Safety /// /// This is highly unsafe, due to the number of invariants that aren't /// checked: /// <del> /// * `ptr` needs to have been previously allocated via [`String`]/`Vec<T>` ///   (at least, it's highly likely to be incorrect if it wasn't). /// * `T` needs to have the same size and alignment as what `ptr` was allocated with. </del> <ins> /// * `T` needs to have the same alignment as what `ptr` was allocated with. </ins> ///   (`T` having a less strict alignment is not sufficient, the alignment really ///   needs to be equal to satisfy the [`dealloc`] requirement that memory must be ///   allocated and deallocated with the same layout.) <ins> /// * The size of `T` times the `capacity` (ie. the allocated size in bytes) needs ///   to be the same size as the pointer was allocated with. (Because similar to ///   alignment, [`dealloc`] must be called with the same layout `size`.) </ins> /// * `length` needs to be less than or equal to `capacity`. <del> /// * `capacity` needs to be the capacity that the pointer was allocated with. </del> <ins> /// * The first `length` values must be properly initialized values of type `T`. /// * `capacity` needs to [*fit*] the layout size that the pointer was allocated with. /// * The allocated size in bytes must be no larger than `isize::MAX`. ///   See the safety documentation of [`pointer::offset`]. /// /// These requirements are always upheld by any `ptr` that has been allocated /// via `Vec<T, A>`. Other allocation sources are allowed if the invariants are /// upheld. </ins> /// /// Violating these may cause problems like corrupting the allocator's /// internal data structures. For example it is **not** safe


/// /// [`String`]: crate::string::String /// [`dealloc`]: crate::alloc::GlobalAlloc::dealloc <ins> /// [*fit*]: crate::alloc::Allocator#memory-fitting </ins> /// /// # Examples ///


///     assert_eq!(rebuilt, [4, 5, 6]); /// } /// ``` <ins> /// /// Using memory that was allocated elsewhere: /// /// ```rust /// use std::alloc::{alloc, Layout}; /// /// fn main() { ///     let layout = Layout::array::<u32>(16).expect("overflow cannot happen"); ///     let vec = unsafe { ///         let mem = alloc(layout).cast::<u32>(); ///         if mem.is_null() { ///             return; ///         } /// ///         mem.write(1_000_000); /// ///         Vec::from_raw_parts(mem, 1, 16) ///     }; /// ///     assert_eq!(vec, &[1_000_000]); ///     assert_eq!(vec.capacity(), 16); /// } /// ``` </ins> #[inline] #[unstable(feature = "allocator_api", issue = "32838")] pub unsafe fn from_raw_parts_in(ptr: *mut T, length: usize, capacity: usize, alloc: A) -> Self {


} #[instrument(skip(self, expr), level = "debug")] <del> pub(super) fn check_expr_kind( </del> <ins> fn check_expr_kind( </ins> &self, expr: &'tcx hir::Expr<'tcx>, expected: Expectation<'tcx>,


self.set_tainted_by_errors(); let tcx = self.tcx; <ins> // Precompute the provided types and spans, since that's all we typically need for below let provided_arg_tys: IndexVec<ProvidedIdx, (Ty<'tcx>, Span)> = provided_args .iter() .map(|expr| { let ty = self .typeck_results .borrow() .expr_ty_adjusted_opt(*expr) .unwrap_or_else(|| tcx.ty_error()); (self.resolve_vars_if_possible(ty), expr.span) }) .collect(); </ins> // A "softer" version of the `demand_compatible`, which checks types without persisting them, // and treats error types differently // This will allow us to "probe" for other argument orders that would likely have been correct


return Compatibility::Incompatible(None); } <del> let provided_arg: &hir::Expr<'tcx> = &provided_args[provided_idx]; let expectation = Expectation::rvalue_hint(self, expected_input_ty); // FIXME: check that this is safe; I don't believe this commits any of the obligations, but I can't be sure. // //   I had another method of "soft" type checking before, //   but it was failing to find the type of some expressions (like "") //   so I prodded this method and made it pub(super) so I could call it, and it seems to work well. let checked_ty = self.check_expr_kind(provided_arg, expectation); </del> <ins> let (arg_ty, arg_span) = provided_arg_tys[provided_idx]; let expectation = Expectation::rvalue_hint(self, expected_input_ty); </ins> let coerced_ty = expectation.only_has_type(self).unwrap_or(formal_input_ty); <del> let can_coerce = self.can_coerce(checked_ty, coerced_ty); </del> <ins> let can_coerce = self.can_coerce(arg_ty, coerced_ty); </ins> if !can_coerce { return Compatibility::Incompatible(None); } // Using probe here, since we don't want this subtyping to affect inference. let subtyping_error = self.probe(|_| { <del> self.at(&self.misc(provided_arg.span), self.param_env) .sup(formal_input_ty, coerced_ty) .err() </del> <ins> self.at(&self.misc(arg_span), self.param_env).sup(formal_input_ty, coerced_ty).err() </ins> }); // Same as above: if either the coerce type or the checked type is an error type, // consider them *not* compatible. <del> let references_error = (coerced_ty, checked_ty).references_error(); </del> <ins> let references_error = (coerced_ty, arg_ty).references_error(); </ins> match (references_error, subtyping_error) { (false, None) => Compatibility::Compatible, (_, subtyping_error) => Compatibility::Incompatible(subtyping_error),


ArgMatrix::new(provided_args.len(), formal_and_expected_inputs.len(), check_compatible) .find_errors(); <del> // Precompute the provided types and spans, since that's all we typically need for below let provided_arg_tys: IndexVec<ProvidedIdx, (Ty<'tcx>, Span)> = provided_args .iter() .map(|expr| { let ty = self .typeck_results .borrow() .expr_ty_adjusted_opt(*expr) .unwrap_or_else(|| tcx.ty_error()); (self.resolve_vars_if_possible(ty), expr.span) }) .collect(); </del> // First, check if we just need to wrap some arguments in a tuple. if let Some((mismatch_idx, terr)) = compatibility_diagonal.iter().enumerate().find_map(|(i, c)| {


fn main() { let needlesArr: Vec<char> = vec!['a', 'f']; needlesArr.iter().fold(|x, y| { <ins> //~^ ERROR this function takes 2 arguments but 1 argument was supplied </ins> }); <del> //~^^ ERROR mismatched types //~| ERROR this function takes 2 arguments but 1 argument was supplied </del> }


<del> error[E0308]: mismatched types --> $DIR/issue-3044.rs:3:35 | LL |       needlesArr.iter().fold(|x, y| { |  ____________________________------_^ | |                            | | |                            the expected closure LL | |     }); | |_____^ expected closure, found `()` | = note: expected closure `[closure@$DIR/issue-3044.rs:3:28: 3:34]` found unit type `()` </del> error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/issue-3044.rs:3:23 | LL |       needlesArr.iter().fold(|x, y| { |  _______________________^^^^- <ins> LL | | </ins> LL | |     }); | |______- an argument is missing |


help: provide the argument | LL ~     needlesArr.iter().fold(|x, y| { <ins> LL + </ins> LL ~     }, /* value */); | <del> error: aborting due to 2 previous errors </del> <ins> error: aborting due to previous error </ins> <del> Some errors have detailed explanations: E0061, E0308. For more information about an error, try `rustc --explain E0061`. </del> <ins> For more information about this error, try `rustc --explain E0061`. </ins>


use rustc_lint_defs::builtin::NAMED_ARGUMENTS_USED_POSITIONALLY; use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiagnostics, LintId}; <del> use rustc_parse_format::{Count, FormatSpec}; </del> <ins> use rustc_parse_format::Count; </ins> use std::borrow::Cow; use std::collections::hash_map::Entry;


} _ => {} }; <del> match a.format { FormatSpec { width: Count::CountIsName(s, _), .. } | FormatSpec { precision: Count::CountIsName(s, _), .. } => { used_argument_names.insert(s); } _ => {} }; </del> <ins> if let Count::CountIsName(s, _) = a.format.width { used_argument_names.insert(s); } if let Count::CountIsName(s, _) = a.format.precision { used_argument_names.insert(s); } </ins> } } for (symbol, (index, span)) in names { if !used_argument_names.contains(symbol.as_str()) { let msg = format!("named argument `{}` is not used by name", symbol.as_str()); <del> let arg_span = cx.arg_spans[index]; </del> <ins> let arg_span = cx.arg_spans.get(index).copied(); </ins> cx.ecx.buffered_early_lint.push(BufferedEarlyLint { span: MultiSpan::from_span(span), msg: msg.clone(),


}, BuiltinLintDiagnostics::NamedArgumentUsedPositionally(positional_arg, named_arg, name) => { db.span_label(named_arg, "this named argument is only referred to by position in formatting string"); <del> let msg = format!("this formatting argument uses named argument `{}` by position", name); db.span_label(positional_arg, msg); db.span_suggestion_verbose( positional_arg, "use the named argument by name to avoid ambiguity", format!("{{{}}}", name), Applicability::MaybeIncorrect, ); </del> <ins> if let Some(positional_arg) = positional_arg { let msg = format!("this formatting argument uses named argument `{}` by position", name); db.span_label(positional_arg, msg); db.span_suggestion_verbose( positional_arg, "use the named argument by name to avoid ambiguity", format!("{{{}}}", name), Applicability::MaybeIncorrect, ); } </ins> } } // Rewrap `db`, and pass control to the user.


/// If true, the lifetime will be fully elided. use_span: Option<(Span, bool)>, }, <del> NamedArgumentUsedPositionally(Span, Span, String), </del> <ins> NamedArgumentUsedPositionally(Option<Span>, Span, String), </ins> } /// Lints that are buffered up early on in the `Session` before the


<ins> // check-pass #![deny(named_arguments_used_positionally)] fn main() { let value: f64 = 314.15926; let digits_before_decimal = 1; let digits_after_decimal = 2; let width = digits_before_decimal + 1 + digits_after_decimal; println!( "{value:0>width$.digits_after_decimal$}", value = value, width = width, digits_after_decimal = digits_after_decimal, ); } </ins>


/// Parses an enum declaration. fn parse_item_enum(&mut self) -> PResult<'a, ItemInfo> { <ins> if self.token.is_keyword(kw::Struct) { let mut err = self.struct_span_err( self.prev_token.span.to(self.token.span), "`enum` and `struct` are mutually exclusive", ); err.span_suggestion( self.prev_token.span.to(self.token.span), "replace `enum struct` with", "enum", Applicability::MachineApplicable, ); if self.look_ahead(1, |t| t.is_ident()) { self.bump(); err.emit(); } else { return Err(err); } } </ins> let id = self.parse_ident()?; let mut generics = self.parse_generics()?; generics.where_clause = self.parse_where_clause()?;


<ins> // run-rustfix pub enum Range { //~^ ERROR `enum` and `struct` are mutually exclusive Valid { begin: u32, len: u32, }, Out, } fn main() { } </ins>


<ins> // run-rustfix pub enum struct Range { //~^ ERROR `enum` and `struct` are mutually exclusive Valid { begin: u32, len: u32, }, Out, } fn main() { } </ins>


<ins> error: `enum` and `struct` are mutually exclusive --> $DIR/issue-99625-enum-struct-mutually-exclusive.rs:3:5 | LL | pub enum struct Range { |     ^^^^^^^^^^^ help: replace `enum struct` with: `enum` error: aborting due to previous error </ins>


} else { if matches!(def_kind, DefKind::AnonConst) && tcx.lazy_normalization() { let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local()); <ins> let parent_def_id = tcx.hir().get_parent_item(hir_id); </ins> if tcx.hir().opt_const_param_default_param_hir_id(hir_id).is_some() { // In `generics_of` we set the generics' parent to be our parent's parent which means that // we lose out on the predicates of our actual parent if we dont return those predicates here.


//        parent of generics returned by `generics_of` // // In the above code we want the anon const to have predicates in its param env for `T: Trait` <del> let item_def_id = tcx.hir().get_parent_item(hir_id); // In the above code example we would be calling `explicit_predicates_of(Foo)` here </del> <ins> // and we would be calling `explicit_predicates_of(Foo)` here return tcx.explicit_predicates_of(parent_def_id); } let parent_def_kind = tcx.def_kind(parent_def_id); if matches!(parent_def_kind, DefKind::OpaqueTy) { // In `instantiate_identity` we inherit the predicates of our parent. // However, opaque types do not have a parent (see `gather_explicit_predicates_of`), which means // that we lose out on the predicates of our actual parent if we dont return those predicates here. // // // fn foo<T: Trait>() -> impl Iterator<Output = Another<{ <T as Trait>::ASSOC }> > { todo!() } //                                                        ^^^^^^^^^^^^^^^^^^^ the def id we are calling //                                                                            explicit_predicates_of on // // In the above code we want the anon const to have predicates in its param env for `T: Trait`. // However, the anon const cannot inherit predicates from its parent since it's opaque. // // To fix this, we call `explicit_predicates_of` directly on `foo`, the parent's parent. // In the above example this is `foo::{opaque#0}` or `impl Iterator` let parent_hir_id = tcx.hir().local_def_id_to_hir_id(parent_def_id.def_id); // In the above example this is the function `foo` let item_def_id = tcx.hir().get_parent_item(parent_hir_id); // In the above code example we would be calling `explicit_predicates_of(foo)` here </ins> return tcx.explicit_predicates_of(item_def_id); } }


<ins> // check-pass #![crate_type = "lib"] #![feature(generic_const_exprs)] #![allow(incomplete_features)] pub trait MyIterator { type Output; } pub trait Foo { const ABC: usize; } pub struct IteratorStruct<const N: usize>{ } pub struct Bar<const N: usize> { pub data: [usize; N] } impl<const N: usize> MyIterator for IteratorStruct<N> { type Output = Bar<N>; } pub fn test1<T: Foo>() -> impl MyIterator<Output = Bar<{T::ABC}>> where [(); T::ABC]: Sized { IteratorStruct::<{T::ABC}>{} } pub trait Baz<const N: usize>{} impl<const N: usize> Baz<N> for Bar<N> {} pub fn test2<T: Foo>() -> impl MyIterator<Output = impl Baz<{ T::ABC }>> where [(); T::ABC]: Sized { IteratorStruct::<{T::ABC}>{} } </ins>


builder.update_submodule(&Path::new("library").join("stdarch")); <ins> // Profiler information requires LLVM's compiler-rt if builder.config.profiler { builder.update_submodule(&Path::new("src/llvm-project")); } </ins> let mut target_deps = builder.ensure(StartupObjects { compiler, target }); let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);