} _ => { // FIXME <del> bug!(); </del> <ins> bug!("invalid expression: {:?}", expr); </ins> } } }


<ins> // compile-flags: -Zsave-analysis use {self}; //~ ERROR E0431 fn main () { } </ins>


<ins> error[E0431]: `self` import can only appear in an import list with a non-empty prefix --> $DIR/issue-73020.rs:2:6 | LL | use {self}; |      ^^^^ can only appear in an import list with a non-empty prefix error: aborting due to previous error For more information about this error, try `rustc --explain E0431`. </ins>


<ins> // build-pass // compile-flags: -Zsave-analysis enum Enum2 { Variant8 { _field: bool }, } impl Enum2 { fn new_variant8() -> Enum2 { Self::Variant8 { _field: true } } } fn main() {} </ins>


debug = false debug-assertions = false <ins> [profile.release.package.compiler_builtins] # For compiler-builtins we always use a high number of codegen units. # The goal here is to place every single intrinsic into its own object # file to avoid symbol clashes with the system libgcc if possible. Note # that this number doesn't actually produce this many object files, we # just don't create more than this number of object files. # # It's a bit of a bummer that we have to pass this here, unfortunately. # Ideally this would be specified through an env var to Cargo so Cargo # knows how many CGUs are for this specific crate, but for now # per-crate configuration isn't specifiable in the environment. codegen-units = 10000 </ins> # We want the RLS to use the version of Cargo that we've got vendored in this # repository to ensure that the same exact version of Cargo is used by both the # RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository


fn merge_codegen_units<'tcx>( tcx: TyCtxt<'tcx>, initial_partitioning: &mut PreInliningPartitioning<'tcx>, <del> mut target_cgu_count: usize, </del> <ins> target_cgu_count: usize, </ins> ) { assert!(target_cgu_count >= 1); let codegen_units = &mut initial_partitioning.codegen_units; <del> if tcx.is_compiler_builtins(LOCAL_CRATE) { // Compiler builtins require some degree of control over how mono items // are partitioned into compilation units. Provide it by keeping the // original partitioning when compiling the compiler builtins crate. target_cgu_count = codegen_units.len(); } </del> // Note that at this point in time the `codegen_units` here may not be in a // deterministic order (but we know they're deterministically the same set). // We want this merging to produce a deterministic ordering of codegen units


<del> // Verifies that during compiler_builtins compilation the codegen units are kept // unmerged. Even when only a single codegen unit is requested with -Ccodegen-units=1. // // compile-flags: -Zprint-mono-items=eager -Ccodegen-units=1 #![compiler_builtins] #![crate_type="lib"] #![feature(compiler_builtins)] mod atomics { //~ MONO_ITEM fn compiler_builtins::atomics[0]::sync_1[0] @@ compiler_builtins-cgu.0[External] #[no_mangle] pub extern "C" fn sync_1() {} //~ MONO_ITEM fn compiler_builtins::atomics[0]::sync_2[0] @@ compiler_builtins-cgu.0[External] #[no_mangle] pub extern "C" fn sync_2() {} //~ MONO_ITEM fn compiler_builtins::atomics[0]::sync_3[0] @@ compiler_builtins-cgu.0[External] #[no_mangle] pub extern "C" fn sync_3() {} } mod x { //~ MONO_ITEM fn compiler_builtins::x[0]::x[0] @@ compiler_builtins-cgu.1[External] #[no_mangle] pub extern "C" fn x() {} } mod y { //~ MONO_ITEM fn compiler_builtins::y[0]::y[0] @@ compiler_builtins-cgu.2[External] #[no_mangle] pub extern "C" fn y() {} } mod z { //~ MONO_ITEM fn compiler_builtins::z[0]::z[0] @@ compiler_builtins-cgu.3[External] #[no_mangle] pub extern "C" fn z() {} } </del>


ValueNS } <ins> #[deriving(Eq)] pub enum NamespaceError { NoError, ModuleError, TypeError, ValueError } </ins> /// A NamespaceResult represents the result of resolving an import in /// a particular namespace. The result is either definitely-resolved, /// definitely- unresolved, or unknown.


} <del> pub fn namespace_to_str(ns: Namespace) -> ~str { </del> <ins> pub fn namespace_error_to_str(ns: NamespaceError) -> &'static str { </ins> match ns { <del> TypeNS  => ~"type", ValueNS => ~"value", </del> <ins> NoError     => "", ModuleError => "module", TypeError   => "type", ValueError  => "value", </ins> } }


// * If no duplicate checking was requested at all, do //   nothing. <del> let mut is_duplicate = false; </del> <ins> let mut duplicate_type = NoError; </ins> let ns = match duplicate_checking_mode { ForbidDuplicateModules => { <del> is_duplicate = child.get_module_if_available().is_some(); </del> <ins> if (child.get_module_if_available().is_some()) { duplicate_type = ModuleError; } </ins> Some(TypeNS) } ForbidDuplicateTypes => { match child.def_for_namespace(TypeNS) { Some(def_mod(_)) | None => {} <del> Some(_) => is_duplicate = true </del> <ins> Some(_) => duplicate_type = TypeError </ins> } Some(TypeNS) } ForbidDuplicateValues => { <del> is_duplicate = child.defined_in_namespace(ValueNS); </del> <ins> if child.defined_in_namespace(ValueNS) { duplicate_type = ValueError; } </ins> Some(ValueNS) } ForbidDuplicateTypesAndValues => {


Some(def_mod(_)) | None => {} Some(_) => { n = Some(TypeNS); <del> is_duplicate = true; </del> <ins> duplicate_type = TypeError; </ins> } }; if child.defined_in_namespace(ValueNS) { <del> is_duplicate = true; </del> <ins> duplicate_type = ValueError; </ins> n = Some(ValueNS); } n } OverwriteDuplicates => None }; <del> if is_duplicate { </del> <ins> if (duplicate_type != NoError) { </ins> // Return an error here by looking up the namespace that // had the duplicate. let ns = ns.unwrap(); self.session.span_err(sp, fmt!("duplicate definition of %s `%s`", <del> namespace_to_str(ns), </del> <ins> namespace_error_to_str(duplicate_type), </ins> self.session.str_of(name))); { let r = child.span_for_namespace(ns); for r.iter().advance |sp| { self.session.span_note(*sp, <del> fmt!("first definition of %s %s here:", namespace_to_str(ns), </del> <ins> fmt!("first definition of %s `%s` here", namespace_error_to_str(duplicate_type), </ins> self.session.str_of(name))); } }


pub mod a {} <del> pub mod a {} //~ ERROR duplicate definition of type `a` </del> <ins> pub mod a {} //~ ERROR duplicate definition of module `a` </ins> fn main() {}


impl<'mir, 'tcx, Tag, Extra> Frame<'mir, 'tcx, Tag, Extra> { /// Return the `SourceInfo` of the current instruction. <del> pub fn current_source_info(&self) -> Option<mir::SourceInfo> { self.loc.map(|loc| { let block = &self.body.basic_blocks()[loc.block]; if loc.statement_index < block.statements.len() { block.statements[loc.statement_index].source_info } else { block.terminator().source_info } }) </del> <ins> pub fn current_source_info(&self) -> Option<&mir::SourceInfo> { self.loc.map(|loc| self.body.source_info(loc)) </ins> } }


}) // Assert that there is always such a frame. .unwrap(); <ins> // Assert that the frame we look at is actually executing code currently // (`current_source_info` is None when we are unwinding and the frame does // not require cleanup). </ins> let loc = frame.loc.unwrap(); <ins> // If this is a `Call` terminator, use the `fn_span` instead. </ins> let block = &frame.body.basic_blocks()[loc.block]; <del> assert_eq!(block.statements.len(), loc.statement_index); debug!( "find_closest_untracked_caller_location:: got terminator {:?} ({:?})", block.terminator(), block.terminator().kind ); if let TerminatorKind::Call { fn_span, .. } = block.terminator().kind { return fn_span; </del> <ins> if loc.statement_index == block.statements.len() { debug!( "find_closest_untracked_caller_location:: got terminator {:?} ({:?})", block.terminator(), block.terminator().kind ); if let TerminatorKind::Call { fn_span, .. } = block.terminator().kind { return fn_span; } </ins> } <del> unreachable!(); </del> <ins> // This is a different terminator (such as `Drop`) or not a terminator at all // (such as `box`). Use the normal span. frame.body.source_info(loc).span </ins> } /// Allocate a `const core::panic::Location` with the provided filename and line/column numbers.


impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { fn visit_local(&mut self, local: &Local, context: PlaceContext, location: Location) { <ins> if self.body.local_decls.get(*local).is_none() { self.fail( location, format!("local {:?} has no corresponding declaration in `body.local_decls`", local), ); } </ins> if self.reachable_blocks.contains(location.block) && context.is_use() { // Uses of locals must occur while the local's storage is allocated. self.storage_liveness.seek_after_primary_effect(location);


<ins> // Disabling on android for the time being // See https://github.com/rust-lang/rust/issues/73535#event-3477699747 #![cfg(not(target_os = "android"))] </ins> #![feature(btree_drain_filter)] #![feature(map_first_last)] #![feature(repr_simd)]


// std testing crates, okay for now at least "src/libcore/tests", "src/liballoc/tests/lib.rs", <ins> "src/liballoc/benches/lib.rs", </ins> // The `VaList` implementation must have platform specific code. // The Windows implementation of a `va_list` is always a character // pointer regardless of the target architecture. As a result,


/// Inline asm operand type must be `Sized`. InlineAsmSized, /// `[T, ..n]` implies that `T` must be `Copy`. <del> RepeatVec, </del> <ins> /// If the function in the array repeat expression is a `const fn`, /// display a help message suggesting to move the function call to a /// new `const` item while saying that `T` doesn't implement `Copy`. RepeatVec(bool), </ins> /// Types of fields (other than the last, except for packed structs) in a struct must be sized. FieldSized {


use crate::dataflow::impls::MaybeInitializedPlaces; use crate::dataflow::move_paths::MoveData; use crate::dataflow::ResultsCursor; <ins> use crate::transform::{ check_consts::ConstCx, promote_consts::is_const_fn_in_array_repeat_expression, }; </ins> use crate::borrow_check::{ borrow_set::BorrowSet,


Operand::Copy(..) | Operand::Constant(..) => { // These are always okay: direct use of a const, or a value that can evidently be copied. } <del> Operand::Move(_) => { </del> <ins> Operand::Move(place) => { </ins> // Make sure that repeated elements implement `Copy`. let span = body.source_info(location).span; let ty = operand.ty(body, tcx); if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty, span) { <ins> let ccx = ConstCx::new_with_param_env(tcx, body, self.param_env); let is_const_fn = is_const_fn_in_array_repeat_expression(&ccx, &place, &body); debug!("check_rvalue: is_const_fn={:?}", is_const_fn); </ins> let def_id = body.source.def_id().expect_local(); self.infcx.report_selection_error( &traits::Obligation::new( ObligationCause::new( span, self.tcx().hir().local_def_id_to_hir_id(def_id), <del> traits::ObligationCauseCode::RepeatVec, </del> <ins> traits::ObligationCauseCode::RepeatVec(is_const_fn), </ins> ), self.param_env, ty::Binder::bind(ty::TraitRef::new(


promotions } <ins> /// This function returns `true` if the function being called in the array /// repeat expression is a `const` function. crate fn is_const_fn_in_array_repeat_expression<'tcx>( ccx: &ConstCx<'_, 'tcx>, place: &Place<'tcx>, body: &Body<'tcx>, ) -> bool { match place.as_local() { // rule out cases such as: `let my_var = some_fn(); [my_var; N]` Some(local) if body.local_decls[local].is_user_variable() => return false, None => return false, _ => {} } for block in body.basic_blocks() { if let Some(Terminator { kind: TerminatorKind::Call { func, destination, .. }, .. }) = &block.terminator { if let Operand::Constant(box Constant { literal: ty::Const { ty, .. }, .. }) = func { if let ty::FnDef(def_id, _) = *ty.kind() { if let Some((destination_place, _)) = destination { if destination_place == place { if is_const_fn(ccx.tcx, def_id) { return true; } } } } } } } false } </ins>


ObligationCauseCode::Coercion { source: _, target } => { err.note(&format!("required by cast to type `{}`", self.ty_to_string(target))); } <del> ObligationCauseCode::RepeatVec => { </del> <ins> ObligationCauseCode::RepeatVec(is_const_fn) => { </ins> err.note( "the `Copy` trait is required because the repeated element will be copied", ); <ins> if is_const_fn { err.help( "consider creating a new `const` item and initializing with the result  of the function call to be used in the repeat position, like  `const VAL: Type = const_fn();` and `let x = [VAL; 42];`", ); } if self.tcx.sess.is_nightly_build() && is_const_fn { err.help( "create an inline `const` block, see PR  #2920 <https://github.com/rust-lang/rfcs/pull/2920>  for more information", ); } </ins> } ObligationCauseCode::VariableType(hir_id) => { let parent_node = self.tcx.hir().get_parent_node(hir_id);


This directory contains the source code of the rust project, including: - The test suite - The bootstrapping build system - Various submodules for tools, like rustdoc, rls, etc.


= help: the following implementations were found: <Option<T> as Copy> = note: the `Copy` trait is required because the repeated element will be copied <ins> = help: consider creating a new `const` item and initializing with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];` = help: create an inline `const` block, see PR #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information </ins> error: aborting due to previous error


<ins> fn main() { // should hint to create an inline `const` block // or to create a new `const` item let strings: [String; 5] = [String::new(); 5]; //~^ ERROR the trait bound `String: Copy` is not satisfied println!("{:?}", strings); } </ins>


<ins> error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:4:32 | LL |     let strings: [String; 5] = [String::new(); 5]; |                                ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | = note: the `Copy` trait is required because the repeated element will be copied = help: consider creating a new `const` item and initializing with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];` = help: create an inline `const` block, see PR #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>


use rustc_infer::infer::{self, InferOk, TyCtxtInferExt}; use rustc_middle::ty; use rustc_middle::ty::error::{ExpectedFound, TypeError}; <del> use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef}; </del> <ins> use rustc_middle::ty::subst::{InternalSubsts, Subst}; </ins> use rustc_middle::ty::util::ExplicitSelf; <del> use rustc_middle::ty::{GenericParamDefKind, ToPredicate, TyCtxt, WithConstness}; </del> <ins> use rustc_middle::ty::{GenericParamDefKind, ToPredicate, TyCtxt}; </ins> use rustc_span::Span; use rustc_trait_selection::traits::error_reporting::InferCtxtExt; use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use super::{potentially_plural_count, FnCtxt, Inherited}; <del> use std::iter; </del> /// Checks that a method from an impl conforms to the signature of /// the same method as declared in the trait.


return Ok(()); } <del> let param_env = tcx.param_env(impl_ty.def_id); </del> // Given // // impl<A, B> Foo<u32> for (A, B) {


impl_ty_substs.rebase_onto(tcx, impl_ty.container.id(), impl_trait_ref.substs); let impl_ty_value = tcx.type_of(impl_ty.def_id); <del> // Map the predicate from the trait to the corresponding one for the impl. // For example: </del> <ins> let param_env = tcx.param_env(impl_ty.def_id); // When checking something like </ins> // <del> // trait X<A> { type Y<'a>: PartialEq<A> } impl X for T { type Y<'a> = &'a S; } // impl<'x> X<&'x u32> for () { type Y<'c> = &'c u32; } </del> <ins> // trait X { type Y: PartialEq<<Self as X>::Y> } // impl X for T { default type Y = S; } </ins> // <del> // For the `for<'a> <<Self as X<A>>::Y<'a>: PartialEq<A>` bound, this // function would translate and partially normalize // `[<Self as X<A>>::Y<'a>, A]` to `[&'a u32, &'x u32]`. let translate_predicate_substs = move |predicate_substs: SubstsRef<'tcx>| { tcx.mk_substs( iter::once(impl_ty_value.into()) .chain(predicate_substs[1..].iter().map(|s| s.subst(tcx, rebased_substs))), ) </del> <ins> // We will have to prove the bound S: PartialEq<<T as X>::Y>. In this case // we want <T as X>::Y to normalize to S. This is valid because we are // checking the default value specifically here. Add this equality to the // ParamEnv for normalization specifically. let normalize_param_env = { let mut predicates = param_env.caller_bounds().iter().collect::<Vec<_>>(); predicates.push( ty::Binder::dummy(ty::ProjectionPredicate { projection_ty: ty::ProjectionTy { item_def_id: trait_ty.def_id, substs: rebased_substs, }, ty: impl_ty_value, }) .to_predicate(tcx), ); ty::ParamEnv::new(tcx.intern_predicates(&predicates), Reveal::UserFacing, None) </ins> }; tcx.infer_ctxt().enter(move |infcx| {


); let predicates = tcx.projection_predicates(trait_ty.def_id); debug!("compare_projection_bounds: projection_predicates={:?}", predicates); for predicate in predicates { <del> let concrete_ty_predicate = match predicate.kind() { ty::PredicateKind::Trait(poly_tr, c) => poly_tr .map_bound(|tr| { let trait_substs = translate_predicate_substs(tr.trait_ref.substs); ty::TraitRef { def_id: tr.def_id(), substs: trait_substs } }) .with_constness(*c) .to_predicate(tcx), ty::PredicateKind::Projection(poly_projection) => poly_projection .map_bound(|projection| { let projection_substs = translate_predicate_substs(projection.projection_ty.substs); ty::ProjectionPredicate { projection_ty: ty::ProjectionTy { substs: projection_substs, item_def_id: projection.projection_ty.item_def_id, }, ty: projection.ty.subst(tcx, rebased_substs), } }) .to_predicate(tcx), ty::PredicateKind::TypeOutlives(poly_outlives) => poly_outlives .map_bound(|outlives| { ty::OutlivesPredicate(impl_ty_value, outlives.1.subst(tcx, rebased_substs)) }) .to_predicate(tcx), _ => bug!("unexepected projection predicate kind: `{:?}`", predicate), }; </del> <ins> let concrete_ty_predicate = predicate.subst(tcx, rebased_substs); debug!("compare_projection_bounds: concrete predicate = {:?}", concrete_ty_predicate); </ins> let traits::Normalized { value: normalized_predicate, obligations } = traits::normalize( &mut selcx, <del> param_env, </del> <ins> normalize_param_env, </ins> normalize_cause.clone(), &concrete_ty_predicate, ); debug!("compare_projection_bounds: normalized predicate = {:?}", normalized_predicate); inh.register_predicates(obligations);


<ins> // Test that associated type bounds are correctly normalized when checking // default associated type values. // check-pass #![allow(incomplete_features)] #![feature(specialization)] #[derive(PartialEq)] enum Never {} trait Foo { type Assoc: PartialEq; // PartialEq<<Self as Foo>::Assoc> } impl<T> Foo for T { default type Assoc = Never; } trait Trait1 { type Selection: PartialEq; } trait Trait2: PartialEq<Self> {} impl<T: Trait2> Trait1 for T { default type Selection = T; } fn main() {} </ins>


/// N.B., **No cleanup is scheduled for this temporary.** You should /// call `schedule_drop` once the temporary is initialized. crate fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx> { <del> let temp = self.local_decls.push(LocalDecl::new(ty, span)); </del> <ins> // Mark this local as internal to avoid temporaries with types not present in the // user's code resulting in ICEs from the generator transform. let temp = self.local_decls.push(LocalDecl::new(ty, span).internal()); </ins> let place = Place::from(temp); debug!("temp: created temp {:?} with type {:?}", place, self.local_decls[temp].ty); place


<ins> // build-pass // compile-flags:-Copt-level=0 // edition:2018 struct S<T>(std::marker::PhantomData<T>); impl<T> std::ops::Deref for S<T> { type Target = T; fn deref(&self) -> &Self::Target { todo!() } } impl<T> std::ops::DerefMut for S<T> { fn deref_mut(&mut self) -> &mut Self::Target { todo!() } } async fn new() -> S<u64> { todo!() } async fn crash() { *new().await = 1 + 1; } fn main() { let _ = crash(); } </ins>


pre.rust .comment, pre.rust .doccomment { color: #788797; <del> font-style: italic; </del> } nav:not(.sidebar) {


<ins> #![feature(associated_type_defaults)] #![feature(generic_associated_types)] #![allow(incomplete_features)] trait Trait1 { fn foo(); } trait Trait2 { type Associated: Trait1 = Self; //~^ ERROR: the trait bound `Self: Trait1` is not satisfied //~| the size for values of type `Self` cannot be known } impl Trait2 for () {} fn call_foo<T: Trait2>() { T::Associated::foo() } fn main() { call_foo::<()>() } </ins>


<ins> error[E0277]: the trait bound `Self: Trait1` is not satisfied --> $DIR/issue-74816.rs:10:5 | LL |     type Associated: Trait1 = Self; |     ^^^^^^^^^^^^^^^^^------^^^^^^^^ |     |                | |     |                required by this bound in `Trait2::Associated` |     the trait `Trait1` is not implemented for `Self` | help: consider further restricting `Self` | LL | trait Trait2: Trait1 { |             ^^^^^^^^ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-74816.rs:10:5 | LL |     type Associated: Trait1 = Self; |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |     | |     doesn't have a size known at compile-time |     required by this bound in `Trait2::Associated` | help: consider further restricting `Self` | LL | trait Trait2: Sized { |             ^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>


<ins> #![feature(type_alias_impl_trait)] #![feature(impl_trait_in_bindings)] #![allow(incomplete_features)] type FooArg<'a> = &'a dyn ToString; type FooRet = impl std::fmt::Debug; type FooItem = Box<dyn Fn(FooArg) -> FooRet>; type Foo = impl Iterator<Item = FooItem>; //~ ERROR: type mismatch #[repr(C)] struct Bar(u8); impl Iterator for Bar { type Item = FooItem; fn next(&mut self) -> Option<Self::Item> { Some(Box::new(quux)) } } fn quux(st: FooArg) -> FooRet { Some(st.to_string()) } fn ham() -> Foo { Bar(1) } fn oof() -> impl std::fmt::Debug { let mut bar = ham(); let func = bar.next().unwrap(); return func(&"oof"); } fn main() { let _ = oof(); } </ins>


<ins> error[E0271]: type mismatch resolving `<Bar as Iterator>::Item == Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> Option<String> + 'static)>` --> $DIR/issue-70877.rs:9:12 | LL | type FooRet = impl std::fmt::Debug; |               -------------------- the expected opaque type ... LL | type Foo = impl Iterator<Item = FooItem>; |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected opaque type, found enum `Option` | = note: expected struct `Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> impl Debug + 'static)>` found struct `Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> Option<String> + 'static)>` error: aborting due to previous error For more information about this error, try `rustc --explain E0271`. </ins>


<ins> // check-pass // Regression test of #70944, should compile fine. use std::ops::Index; pub struct KeyA; pub struct KeyB; pub struct KeyC; pub trait Foo: Index<KeyA> + Index<KeyB> + Index<KeyC> {} pub trait FooBuilder { type Inner: Foo; fn inner(&self) -> &Self::Inner; } pub fn do_stuff(foo: &impl FooBuilder) { let inner = foo.inner(); &inner[KeyA]; &inner[KeyB]; &inner[KeyC]; } fn main() {} </ins>


<ins> // check-pass #![feature(trait_alias)] struct Bar; trait Foo {} impl Foo for Bar {} trait Baz = Foo where Bar: Foo; fn new() -> impl Baz { Bar } fn main() { let _ = new(); } </ins>


<ins> #![feature(unsize)] use std::marker::Unsize; pub trait CastTo<T: ?Sized>: Unsize<T> { fn cast_to(&self) -> &T; } impl<T: ?Sized, U: ?Sized + Unsize<T>> CastTo<T> for U { fn cast_to(&self) -> &T { self } } impl<T: ?Sized> Cast for T {} pub trait Cast { fn cast<T: ?Sized>(&self) -> &T where Self: CastTo<T>, { self } } pub trait Foo: CastTo<[i32]> {} impl Foo for [i32; 0] {} fn main() { let x: &dyn Foo = &[]; let x = x.cast::<[i32]>(); //~^ ERROR: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied } </ins>


<ins> error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied --> $DIR/issue-71659.rs:30:15 | LL |     let x = x.cast::<[i32]>(); |               ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>


<ins> pub trait Callback { fn cb(); } pub trait Processing { type Call: Callback; } fn f<P: Processing + ?Sized>() { P::Call::cb(); } fn main() { struct MyCall; f::<dyn Processing<Call = MyCall>>(); //~^ ERROR: the trait bound `MyCall: Callback` is not satisfied } </ins>


<ins> error[E0277]: the trait bound `MyCall: Callback` is not satisfied --> $DIR/issue-75707.rs:15:5 | LL | fn f<P: Processing + ?Sized>() { |         ---------- required by this bound in `f` ... LL |     f::<dyn Processing<Call = MyCall>>(); |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Callback` is not implemented for `MyCall` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>


use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::lexical_region_resolve::RegionResolutionError; <del> use crate::infer::{Subtype, TyCtxtInferExt, ValuePairs}; </del> <ins> use crate::infer::{Subtype, ValuePairs}; </ins> use crate::traits::ObligationCauseCode::CompareImplMethodObligation; use rustc_errors::ErrorReported; use rustc_hir as hir;


} fn emit_err(&self, sp: Span, expected: Ty<'tcx>, found: Ty<'tcx>, trait_def_id: DefId) { <del> let tcx = self.tcx(); </del> let trait_sp = self.tcx().def_span(trait_def_id); let mut err = self .tcx()


); } <del> if let Some((expected, found)) = tcx .infer_ctxt() .enter(|infcx| infcx.expected_found_str_ty(&ExpectedFound { expected, found })) </del> <ins> if let Some((expected, found)) = self.infcx.expected_found_str_ty(&ExpectedFound { expected, found }) </ins> { // Highlighted the differences when showing the "expected/found" note. err.note_expected_found(&"", expected, &"", found);


<ins> // Regression test for issue #74918 // Tests that we don't ICE after emitting an error struct ChunkingIterator<T, S: 'static + Iterator<Item = T>> { source: S, } impl<T, S: Iterator<Item = T>> Iterator for ChunkingIterator<T, S> { type Item = IteratorChunk<T, S>; //~ ERROR missing lifetime fn next(&mut self) -> Option<IteratorChunk<T, S>> { //~ ERROR `impl` todo!() } } struct IteratorChunk<'a, T, S: Iterator<Item = T>> { source: &'a mut S, } impl<T, S: Iterator<Item = T>> Iterator for IteratorChunk<'_, T, S> { type Item = T; fn next(&mut self) -> Option<T> { todo!() } } fn main() {} </ins>


<ins> error[E0106]: missing lifetime specifier --> $DIR/issue-74918-missing-lifetime.rs:9:31 | LL |     type Item = IteratorChunk<T, S>; |                               ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | LL |     type Item<'a> = IteratorChunk<<'a>T, S>; |              ^^^^                 ^^^^ error: `impl` item signature doesn't match `trait` item signature --> $DIR/issue-74918-missing-lifetime.rs:11:5 | LL |     fn next(&mut self) -> Option<IteratorChunk<T, S>> { |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&mut ChunkingIterator<T, S>) -> std::option::Option<IteratorChunk<'_, T, S>>` | ::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | LL |     fn next(&mut self) -> Option<Self::Item>; |     ----------------------------------------- expected `fn(&mut ChunkingIterator<T, S>) -> std::option::Option<IteratorChunk<'static, _, _>>` | = note: expected `fn(&mut ChunkingIterator<T, S>) -> std::option::Option<IteratorChunk<'static, _, _>>` found `fn(&mut ChunkingIterator<T, S>) -> std::option::Option<IteratorChunk<'_, _, _>>` = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0106`. </ins>


<ins> // Regresison test for issue #75361 // Tests that we don't ICE on mismatched types with inference variables trait MyTrait { type Item; } pub trait Graph { type EdgeType; fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType>>; } impl<T> Graph for T { type EdgeType = T; fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType> + '_> { //~ ERROR `impl` panic!() } } fn main() {} </ins>


<ins> error: `impl` item signature doesn't match `trait` item signature --> $DIR/issue-75361-mismatched-impl.rs:18:3 | LL |   fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType>>; |   --------------------------------------------------------------------- expected `fn(&T) -> std::boxed::Box<(dyn MyTrait<Item = &_> + 'static)>` ... LL |   fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType> + '_> { |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&T) -> std::boxed::Box<dyn MyTrait<Item = &_>>` | = note: expected `fn(&T) -> std::boxed::Box<(dyn MyTrait<Item = &T> + 'static)>` found `fn(&T) -> std::boxed::Box<dyn MyTrait<Item = &T>>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/issue-75361-mismatched-impl.rs:12:55 | LL |   fn adjacent_edges(&self) -> Box<dyn MyTrait<Item = &Self::EdgeType>>; |                                                       ^^^^^^^^^^^^^^ consider borrowing this type parameter in the trait error: aborting due to previous error </ins>


use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::util; use rustc_session::config::EntryFnType; <del> use rustc_span::{Span, DUMMY_SP}; </del> <ins> use rustc_span::{symbol::sym, Span, DUMMY_SP}; </ins> use rustc_target::spec::abi::Abi; use rustc_trait_selection::traits::error_reporting::InferCtxtExt as _; use rustc_trait_selection::traits::{


.emit(); error = true; } <ins> for attr in it.attrs { if attr.check_name(sym::track_caller) { tcx.sess .struct_span_err( attr.span, "`main` function is not allowed to be `#[track_caller]`", ) .span_label( main_span, "`main` function is not allowed to be `#[track_caller]`", ) .emit(); error = true; } } </ins> if error { return; }


tcx.sess, span, E0752, <del> "start is not allowed to be `async`" </del> <ins> "`start` is not allowed to be `async`" </ins> ) <del> .span_label(span, "start is not allowed to be `async`") </del> <ins> .span_label(span, "`start` is not allowed to be `async`") </ins> .emit(); error = true; } <ins> for attr in it.attrs { if attr.check_name(sym::track_caller) { tcx.sess .struct_span_err( attr.span, "`start` is not allowed to be `#[track_caller]`", ) .span_label( start_span, "`start` is not allowed to be `#[track_caller]`", ) .emit(); error = true; } } </ins> if error { return; }


#[start] pub async fn start(_: isize, _: *const *const u8) -> isize { <del> //~^ ERROR start is not allowed to be `async` </del> <ins> //~^ ERROR `start` is not allowed to be `async` </ins> 0 }


<del> error[E0752]: start is not allowed to be `async` </del> <ins> error[E0752]: `start` is not allowed to be `async` </ins> --> $DIR/issue-68523-start.rs:6:1 | LL | pub async fn start(_: isize, _: *const *const u8) -> isize { <del> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ start is not allowed to be `async` </del> <ins> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `start` is not allowed to be `async` </ins> error: aborting due to previous error


<ins> #[track_caller] //~ ERROR `main` function is not allowed to be fn main() { panic!("{}: oh no", std::panic::Location::caller()); } </ins>


<ins> error: `main` function is not allowed to be `#[track_caller]` --> $DIR/error-with-main.rs:1:1 | LL |   #[track_caller] |   ^^^^^^^^^^^^^^^ LL | / fn main() { LL | |     panic!("{}: oh no", std::panic::Location::caller()); LL | | } | |_- `main` function is not allowed to be `#[track_caller]` error: aborting due to previous error </ins>


<ins> #![feature(start)] #[start] #[track_caller] //~ ERROR `start` is not allowed to be `#[track_caller]` fn start(_argc: isize, _argv: *const *const u8) -> isize { panic!("{}: oh no", std::panic::Location::caller()); } </ins>


<ins> error: `start` is not allowed to be `#[track_caller]` --> $DIR/error-with-start.rs:4:1 | LL |   #[track_caller] |   ^^^^^^^^^^^^^^^ LL | / fn start(_argc: isize, _argv: *const *const u8) -> isize { LL | |     panic!("{}: oh no", std::panic::Location::caller()); LL | | } | |_- `start` is not allowed to be `#[track_caller]` error: aborting due to previous error </ins>


return Ok(expr); } } <ins> if (op.node == AssocOp::Equal || op.node == AssocOp::NotEqual) && self.token.kind == token::Eq && self.prev_token.span.hi() == self.token.span.lo() { // Look for JS' `===` and `!==` and recover 😇 let sp = op.span.to(self.token.span); let sugg = match op.node { AssocOp::Equal => "==", AssocOp::NotEqual => "!=", _ => unreachable!(), }; self.struct_span_err(sp, &format!("invalid comparison operator `{}=`", sugg)) .span_suggestion_short( sp, &format!("`{s}=` is not a valid comparison operator, use `{s}`", s = sugg), sugg.to_string(), Applicability::MachineApplicable, ) .emit(); self.bump(); } </ins> let op = op.node; // Special cases: if op == AssocOp::As {


<ins> fn main() { if 1 == = 1 { //~ ERROR expected expression println!("yup!"); } } </ins>


<ins> error: expected expression, found `=` --> $DIR/js-style-comparison-op-separate-eq-token.rs:2:13 | LL |     if 1 == = 1 { |             ^ expected expression error: aborting due to previous error </ins>


<ins> // run-rustfix fn main() { if 1 == 1 { //~ ERROR invalid comparison operator `===` println!("yup!"); } else if 1 != 1 { //~ ERROR invalid comparison operator `!==` println!("nope!"); } } </ins>


<ins> // run-rustfix fn main() { if 1 === 1 { //~ ERROR invalid comparison operator `===` println!("yup!"); } else if 1 !== 1 { //~ ERROR invalid comparison operator `!==` println!("nope!"); } } </ins>


<ins> error: invalid comparison operator `===` --> $DIR/js-style-comparison-op.rs:3:10 | LL |     if 1 === 1 { |          ^^^ help: `===` is not a valid comparison operator, use `==` error: invalid comparison operator `!==` --> $DIR/js-style-comparison-op.rs:5:17 | LL |     } else if 1 !== 1 { |                 ^^^ help: `!==` is not a valid comparison operator, use `!=` error: aborting due to 2 previous errors </ins>


self.variants.iter().flat_map(|v| v.fields.iter()) } <ins> /// Whether the ADT lacks fields. Note that this includes uninhabited enums, /// e.g., `enum Void {}` is considered payload free as well. </ins> pub fn is_payloadfree(&self) -> bool { <del> !self.variants.is_empty() && self.variants.iter().all(|v| v.fields.is_empty()) </del> <ins> self.variants.iter().all(|v| v.fields.is_empty()) </ins> } /// Return a `VariantDef` given a variant id.


// # First handle non-scalar source values. <del> // Handle cast from a univariant (ZST) enum. </del> <ins> // Handle cast from a ZST enum (0 or 1 variants). </ins> match src.layout.variants { Variants::Single { index } => { <ins> if src.layout.abi.is_uninhabited() { // This is dead code, because an uninhabited enum is UB to // instantiate. throw_ub!(Unreachable); } </ins> if let Some(discr) = src.layout.ty.discriminant_for_variant(*self.tcx, index) { assert!(src.layout.is_zst()); let discr_layout = self.layout_of(discr.ty)?;


<ins> // check-pass </ins> enum E {} fn f(e: E) { <del> println!("{}", (e as isize).to_string());   //~ ERROR non-primitive cast </del> <ins> println!("{}", (e as isize).to_string()); </ins> } fn main() {}


<del> error[E0605]: non-primitive cast: `E` as `isize` --> $DIR/uninhabited-enum-cast.rs:4:20 | LL |     println!("{}", (e as isize).to_string()); |                    ^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object error: aborting due to previous error For more information about this error, try `rustc --explain E0605`. </del>


} #theme-choices > button:hover, #theme-choices > button:focus { <del> background-color: rgba(70, 70, 70, 0.33); </del> <ins> background-color: rgba(110, 110, 110, 0.33); </ins> } @media (max-width: 700px) {


use tracing::debug; macro_rules! gate_feature_fn { <ins> ($visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr, $help: expr) => {{ let (visitor, has_feature, span, name, explain, help) = (&*$visitor, $has_feature, $span, $name, $explain, $help); let has_feature: bool = has_feature(visitor.features); debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", name, span, has_feature); if !has_feature && !span.allows_unstable($name) { feature_err_issue(&visitor.sess.parse_sess, name, span, GateIssue::Language, explain) .help(help) .emit(); } }}; </ins> ($visitor: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => {{ let (visitor, has_feature, span, name, explain) = (&*$visitor, $has_feature, $span, $name, $explain);


} macro_rules! gate_feature_post { <ins> ($visitor: expr, $feature: ident, $span: expr, $explain: expr, $help: expr) => { gate_feature_fn!($visitor, |x: &Features| x.$feature, $span, sym::$feature, $explain, $help) }; </ins> ($visitor: expr, $feature: ident, $span: expr, $explain: expr) => { gate_feature_fn!($visitor, |x: &Features| x.$feature, $span, sym::$feature, $explain) };


let spans = sess.parse_sess.gated_spans.spans.borrow(); macro_rules! gate_all { <ins> ($gate:ident, $msg:literal, $help:literal) => { if let Some(spans) = spans.get(&sym::$gate) { for span in spans { gate_feature_post!(&visitor, $gate, *span, $msg, $help); } } }; </ins> ($gate:ident, $msg:literal) => { if let Some(spans) = spans.get(&sym::$gate) { for span in spans {


} gate_all!(if_let_guard, "`if let` guard is not implemented"); gate_all!(let_chains, "`let` expressions in this position are experimental"); <del> gate_all!(async_closure, "async closures are unstable"); </del> <ins> gate_all!( async_closure, "async closures are unstable", "to use an async block, remove the `||`: `async {`" ); </ins> gate_all!(generators, "yield syntax is experimental"); gate_all!(or_patterns, "or-patterns syntax is experimental"); gate_all!(raw_ref_op, "raw address of syntax is experimental");


} else { Async::No }; <del> if let Async::Yes { span, .. } = asyncness { // Feature-gate `async ||` closures. self.sess.gated_spans.gate(sym::async_closure, span); } </del> let capture_clause = self.parse_capture_clause(); let decl = self.parse_fn_block_decl()?;


} }; <ins> if let Async::Yes { span, .. } = asyncness { // Feature-gate `async ||` closures. self.sess.gated_spans.gate(sym::async_closure, span); } </ins> Ok(self.mk_expr( lo.to(body.span), ExprKind::Closure(capture_clause, asyncness, movability, decl, body, lo.to(decl_hi)),


| = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information = help: add `#![feature(async_closure)]` to the crate attributes to enable <ins> = help: to use an async block, remove the `||`: `async {` </ins> error: aborting due to previous error


} fn f5() { <del> async //~ ERROR async closures are unstable </del> <ins> async </ins> let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let` }


LL |         let x = 0; |         ^^^ unexpected token <del> error[E0658]: async closures are unstable --> $DIR/block-no-opening-brace.rs:29:5 | LL |     async |     ^^^^^ | = note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information = help: add `#![feature(async_closure)]` to the crate attributes to enable error: aborting due to 6 previous errors </del> <ins> error: aborting due to 5 previous errors </ins> <del> For more information about this error, try `rustc --explain E0658`. </del>


trace!("encoding {} further alloc ids", new_n - n); for idx in n..new_n { let id = self.interpret_allocs[idx]; <del> let pos = self.position() as u32; </del> <ins> let pos = self.position() as u64; </ins> interpret_alloc_index.push(pos); interpret::specialized_encode_alloc_id(self, tcx, id); }


traits: LazyArray<DefIndex>, impls: LazyArray<TraitImpls>, incoherent_impls: LazyArray<IncoherentImpls>, <del> interpret_alloc_index: LazyArray<u32>, </del> <ins> interpret_alloc_index: LazyArray<u64>, </ins> proc_macro_data: Option<ProcMacroData>, tables: LazyTables,


// For each `AllocId`, we keep track of which decoding state it's currently in. decoding_state: Vec<Lock<State>>, // The offsets of each allocation in the data stream. <del> data_offsets: Vec<u32>, </del> <ins> data_offsets: Vec<u64>, </ins> } impl AllocDecodingState {


AllocDecodingSession { state: self, session_id } } <del> pub fn new(data_offsets: Vec<u32>) -> Self { </del> <ins> pub fn new(data_offsets: Vec<u64>) -> Self { </ins> let decoding_state = std::iter::repeat_with(|| Lock::new(State::Empty)).take(data_offsets.len()).collect();


query_result_index: EncodedDepNodeIndex, side_effects_index: EncodedDepNodeIndex, // The location of all allocations. <del> interpret_alloc_index: Vec<u32>, </del> <ins> // Most uses only need values up to u32::MAX, but benchmarking indicates that we can use a u64 // without measurable overhead. This permits larger const allocations without ICEing. interpret_alloc_index: Vec<u64>, </ins> // See `OnDiskCache.syntax_contexts` syntax_contexts: FxHashMap<u32, AbsoluteBytePos>, // See `OnDiskCache.expn_data`


interpret_alloc_index.reserve(new_n - n); for idx in n..new_n { let id = encoder.interpret_allocs[idx]; <del> let pos: u32 = encoder.position().try_into().unwrap(); </del> <ins> let pos: u64 = encoder.position().try_into().unwrap(); </ins> interpret_alloc_index.push(pos); interpret::specialized_encode_alloc_id(&mut encoder, tcx, id); }


usize, (), u32, <ins> u64, </ins> bool, std::string::String, crate::metadata::ModChild,


Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins>


{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1;  // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":612,"byte_end":618,"line_start":17,"line_end":17,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String = 1;  // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":621,"byte_end":622,"line_start":17,"line_end":17,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1;  // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:17:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":672,"byte_end":678,"line_start":19,"line_end":19,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":681,"byte_end":682,"line_start":19,"line_end":19,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:19:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1;  // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":735,"byte_end":741,"line_start":22,"line_end":22,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":745,"byte_end":746,"line_start":23,"line_end":23,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1;  // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:23:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":801,"byte_end":809,"line_start":25,"line_end":26,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":"    let s : String = (","highlight_start":22,"highlight_end":23},{"text":"    );  // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf-multifile-aux.rs","byte_start":792,"byte_end":798,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf-multifile-aux.rs:25:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors


{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1;  // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":597,"byte_end":603,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String = 1;  // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1;  // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":657,"byte_end":663,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":666,"byte_end":667,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":"    let s : String = 1","highlight_start":22,"highlight_end":23}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1;  // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected struct `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":720,"byte_end":726,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":730,"byte_end":731,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1;  // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":null,"suggested_replacement":"1.to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types "} {"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":794,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":"    let s : String = (","highlight_start":22,"highlight_end":23},{"text":"    );  // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected struct `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":777,"byte_end":783,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":"    let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types "} {"message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors


{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. <del> Erroneous code example: </del> <ins> Erroneous code examples: </ins> ```compile_fail,E0308 <del> let x: i32 = "I am not a number!"; //     ~~~   ~~~~~~~~~~~~~~~~~~~~ //      |             | //      |    initializing expression; //      |    compiler infers type `&str` //      | //    type `i32` assigned to variable `x` </del> <ins> fn plus_one(x: i32) -> i32 { x + 1 } plus_one("Not a number"); //       ^^^^^^^^^^^^^^ expected `i32`, found `&str` if "Not a bool" { // ^^^^^^^^^^^^ expected `bool`, found `&str` } let x: f32 = "Not a float"; //     ---   ^^^^^^^^^^^^^ expected `f32`, found `&str` //     | //     expected due to this </ins> ``` <del> This error occurs when the compiler is unable to infer the concrete type of a variable. It can occur in several cases, the most common being a mismatch between two types: the type the author explicitly assigned, and the type the compiler inferred. </del> <ins> This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. </ins> "},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":244,"byte_end":246,"line_start":7,"line_end":7,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":"    let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":239,"byte_end":241,"line_start":7,"line_end":7,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":"    let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types --> $DIR/flag-json.rs:7:17 |


self.to_bits().to_ne_bytes() } <del> /// Return the memory representation of this floating point number as a byte array in /// native byte order. /// /// [`to_ne_bytes`] should be preferred over this whenever possible. /// /// [`to_ne_bytes`]: f32::to_ne_bytes /// /// # Examples /// /// ``` /// #![feature(num_as_ne_bytes)] /// let num = 12.5f32; /// let bytes = num.as_ne_bytes(); /// assert_eq!( ///     bytes, ///     if cfg!(target_endian = "big") { ///         &[0x41, 0x48, 0x00, 0x00] ///     } else { ///         &[0x00, 0x00, 0x48, 0x41] ///     } /// ); /// ``` #[unstable(feature = "num_as_ne_bytes", issue = "76976")] #[inline] pub fn as_ne_bytes(&self) -> &[u8; 4] { // SAFETY: `f32` is a plain old datatype so we can always transmute to it unsafe { &*(self as *const Self as *const _) } } </del> /// Create a floating point value from its representation as a byte array in big endian. /// /// # Examples


self.to_bits().to_ne_bytes() } <del> /// Return the memory representation of this floating point number as a byte array in /// native byte order. /// /// [`to_ne_bytes`] should be preferred over this whenever possible. /// /// [`to_ne_bytes`]: f64::to_ne_bytes /// /// # Examples /// /// ``` /// #![feature(num_as_ne_bytes)] /// let num = 12.5f64; /// let bytes = num.as_ne_bytes(); /// assert_eq!( ///     bytes, ///     if cfg!(target_endian = "big") { ///         &[0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] ///     } else { ///         &[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40] ///     } /// ); /// ``` #[unstable(feature = "num_as_ne_bytes", issue = "76976")] #[inline] pub fn as_ne_bytes(&self) -> &[u8; 8] { // SAFETY: `f64` is a plain old datatype so we can always transmute to it unsafe { &*(self as *const Self as *const _) } } </del> /// Create a floating point value from its representation as a byte array in big endian. /// /// # Examples


unsafe { mem::transmute(self) } } <del> /// Return the memory representation of this integer as a byte array in /// native byte order. /// /// [`to_ne_bytes`] should be preferred over this whenever possible. /// /// [`to_ne_bytes`]: Self::to_ne_bytes /// /// # Examples /// /// ``` /// #![feature(num_as_ne_bytes)] #[doc = concat!("let num = ", $swap_op, stringify!($SelfT), ";")] /// let bytes = num.as_ne_bytes(); /// assert_eq!( ///     bytes, ///     if cfg!(target_endian = "big") { #[doc = concat!("        &", $be_bytes)] ///     } else { #[doc = concat!("        &", $le_bytes)] ///     } /// ); /// ``` #[unstable(feature = "num_as_ne_bytes", issue = "76976")] #[inline] pub fn as_ne_bytes(&self) -> &[u8; mem::size_of::<Self>()] { // SAFETY: integers are plain old datatypes so we can always transmute them to // arrays of bytes unsafe { &*(self as *const Self as *const _) } } </del> /// Create an integer value from its representation as a byte array in /// big endian. ///


unsafe { mem::transmute(self) } } <del> /// Return the memory representation of this integer as a byte array in /// native byte order. /// /// [`to_ne_bytes`] should be preferred over this whenever possible. /// /// [`to_ne_bytes`]: Self::to_ne_bytes /// /// # Examples /// /// ``` /// #![feature(num_as_ne_bytes)] #[doc = concat!("let num = ", $swap_op, stringify!($SelfT), ";")] /// let bytes = num.as_ne_bytes(); /// assert_eq!( ///     bytes, ///     if cfg!(target_endian = "big") { #[doc = concat!("        &", $be_bytes)] ///     } else { #[doc = concat!("        &", $le_bytes)] ///     } /// ); /// ``` #[unstable(feature = "num_as_ne_bytes", issue = "76976")] #[inline] pub fn as_ne_bytes(&self) -> &[u8; mem::size_of::<Self>()] { // SAFETY: integers are plain old datatypes so we can always transmute them to // arrays of bytes unsafe { &*(self as *const Self as *const _) } } </del> /// Create a native endian integer value from its representation /// as a byte array in big endian. ///


<del> Subproject commit 3c5d47c81d78e9316e971c9870e8bc7c2c449d24 </del> <ins> Subproject commit 77a0125981b293260c9aec6355dff46ec707ab59 </ins>


)); } } <ins> if let ty::Ref(_, sub_ty, _) = scrut_ty.kind() { if cx.tcx.is_ty_uninhabited_from(cx.module, sub_ty, cx.param_env) { err.note("references are always considered inhabited"); } } </ins> err.emit(); }


| = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `&!` <ins> = note: references are always considered inhabited </ins> error[E0004]: non-exhaustive patterns: type `Foo` is non-empty --> $DIR/always-inhabited-union-ref.rs:27:11


<ins> enum A {} //~^ NOTE `A` defined here fn f(a: &A) { match a {} //~^ ERROR non-exhaustive patterns: type `&A` is non-empty //~| NOTE the matched value is of type `&A` //~| NOTE references are always considered inhabited } fn main() {} </ins>


<ins> error[E0004]: non-exhaustive patterns: type `&A` is non-empty --> $DIR/issue-78123-non-exhaustive-reference.rs:5:11 | LL | enum A {} | --------- `A` defined here ... LL |     match a {} |           ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `&A` = note: references are always considered inhabited error: aborting due to previous error For more information about this error, try `rustc --explain E0004`. </ins>


| = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `&Void` <ins> = note: references are always considered inhabited </ins> error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:18:19


// The type table might not have information for this expression // if it is in a malformed scope. (#66387) if let Some(ty) = self.fcx.typeck_results.borrow().expr_ty_opt(expr) { <ins> if guard_borrowing_from_pattern { // Match guards create references to all the bindings in the pattern that are used // in the guard, e.g. `y if is_even(y) => ...` becomes `is_even(*r_y)` where `r_y` // is a reference to `y`, so we must record a reference to the type of the binding. let tcx = self.fcx.tcx; let ref_ty = tcx.mk_ref( // Use `ReErased` as `resolve_interior` is going to replace all the regions anyway. tcx.mk_region(ty::RegionKind::ReErased), ty::TypeAndMut { ty, mutbl: hir::Mutability::Not }, ); self.record(ref_ty, scope, Some(expr), expr.span, guard_borrowing_from_pattern); } </ins> self.record(ty, scope, Some(expr), expr.span, guard_borrowing_from_pattern); } else { self.fcx.tcx.sess.delay_span_bug(expr.span, "no type for node");


<del> // check-pass </del> <ins> // build-pass </ins> // edition:2018 // This test is derived from


// of the underlying generator. async fn f() -> u8 { 1 } <ins> async fn foo() -> [bool; 10] { [false; 10] } </ins> pub async fn g(x: u8) { match x {


} } <ins> // #78366: check the reference to the binding is recorded even if the binding is not autorefed async fn h(x: usize) { match x { y if foo().await[y] => (), _ => (), } } async fn i(x: u8) { match x { y if f().await == y + 1 => (), _ => (), } } </ins> fn main() { let _ = g(10); <ins> let _ = h(9); let _ = i(8); </ins> }


.with_indent_lines(true) .with_ansi(true) .with_targets(true) <del> .with_thread_ids(true) .with_thread_names(true) </del> .with_wraparound(10) .with_verbose_exit(true) .with_verbose_entry(true) .with_indent_amount(2); <ins> #[cfg(parallel_compiler)] let layer = layer.with_thread_ids(true).with_thread_names(true); </ins> use tracing_subscriber::layer::SubscriberExt; let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer);


Target::Field | Target::Arm | Target::MacroDef => { self.inline_attr_str_error_with_macro_def(hir_id, attr, "no_mangle"); } <ins> // FIXME: #[no_mangle] was previously allowed on non-functions/statics, this should be an error // The error should specify that the item that is wrong is specifically a *foreign* fn/static // otherwise the error seems odd Target::ForeignFn | Target::ForeignStatic => { let foreign_item_kind = match target { Target::ForeignFn => "function", Target::ForeignStatic => "static", _ => unreachable!(), }; self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| { lint.build(&format!( "`#[no_mangle]` has no effect on a foreign {}", foreign_item_kind )) .warn( "this was previously accepted by the compiler but is  being phased out; it will become a hard error in  a future release!", ) .span_label(*span, format!("foreign {}", foreign_item_kind)) .note("symbol names in extern blocks are not mangled") .span_suggestion( attr.span, "remove this attribute", String::new(), Applicability::MachineApplicable, ) .emit(); }); } </ins> _ => { // FIXME: #[no_mangle] was previously allowed on non-functions/statics and some // crates used this, so only emit a warning.


<ins> #![warn(unused_attributes)] // Tests that placing the #[no_mangle] attribute on a foreign fn or static emits // a specialized warning. // The previous warning only talks about a "function or static" but foreign fns/statics // are also not allowed to have #[no_mangle] // build-pass extern "C" { #[no_mangle] //~^ WARNING `#[no_mangle]` has no effect on a foreign static //~^^ WARNING this was previously accepted by the compiler pub static FOO: u8; #[no_mangle] //~^ WARNING `#[no_mangle]` has no effect on a foreign function //~^^ WARNING this was previously accepted by the compiler pub fn bar(); } fn no_new_warn() { // Should emit the generic "not a function or static" warning #[no_mangle] //~^ WARNING attribute should be applied to a free function, impl method or static //~^^ WARNING this was previously accepted by the compiler let x = 0_u8; } fn main() {} </ins>


<ins> warning: attribute should be applied to a free function, impl method or static --> $DIR/extern-no-mangle.rs:24:5 | LL |     #[no_mangle] |     ^^^^^^^^^^^^ ... LL |     let x = 0_u8; |     ------------- not a free function, impl method or static | note: the lint level is defined here --> $DIR/extern-no-mangle.rs:1:9 | LL | #![warn(unused_attributes)] |         ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` has no effect on a foreign static --> $DIR/extern-no-mangle.rs:11:5 | LL |     #[no_mangle] |     ^^^^^^^^^^^^ help: remove this attribute ... LL |     pub static FOO: u8; |     ------------------- foreign static | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: symbol names in extern blocks are not mangled warning: `#[no_mangle]` has no effect on a foreign function --> $DIR/extern-no-mangle.rs:16:5 | LL |     #[no_mangle] |     ^^^^^^^^^^^^ help: remove this attribute ... LL |     pub fn bar(); |     ------------- foreign function | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: symbol names in extern blocks are not mangled warning: 3 warnings emitted </ins>


// ignore-debug: the debug assertions get in the way // compile-flags: -O -Z merge-functions=disabled <ins> // min-llvm-version: 16 </ins> #![crate_type = "lib"] // Ensure that trivial casts of vec elements are O(1) pub struct Wrapper<T>(T); <ins> // previously repr(C) caused the optimization to fail </ins> #[repr(C)] pub struct Foo { a: u64,


d: u64, } <del> // Going from an aggregate struct to another type currently requires Copy to // enable the TrustedRandomAccess specialization. Without it optimizations do not yet // reliably recognize the loops as noop for repr(C) or non-Copy structs. </del> <ins> // implementing Copy exercises the TrustedRandomAccess specialization inside the in-place // specialization </ins> #[derive(Copy, Clone)] pub struct Bar { a: u64,


d: u64, } <ins> // this exercises the try-fold codepath pub struct Baz { a: u64, b: u64, c: u64, d: u64, } </ins> // CHECK-LABEL: @vec_iterator_cast_primitive #[no_mangle] pub fn vec_iterator_cast_primitive(vec: Vec<i8>) -> Vec<u8> {


// CHECK-LABEL: @vec_iterator_cast_aggregate #[no_mangle] pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> { <del> // FIXME These checks should be the same as other functions. // CHECK-NOT: @__rust_alloc // CHECK-NOT: @__rust_alloc </del> <ins> // CHECK-NOT: loop // CHECK-NOT: call </ins> vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect() } <del> // CHECK-LABEL: @vec_iterator_cast_deaggregate </del> <ins> // CHECK-LABEL: @vec_iterator_cast_deaggregate_tra </ins> #[no_mangle] <del> pub fn vec_iterator_cast_deaggregate(vec: Vec<Bar>) -> Vec<[u64; 4]> { // FIXME These checks should be the same as other functions. // CHECK-NOT: @__rust_alloc // CHECK-NOT: @__rust_alloc </del> <ins> pub fn vec_iterator_cast_deaggregate_tra(vec: Vec<Bar>) -> Vec<[u64; 4]> { // CHECK-NOT: loop // CHECK-NOT: call // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4]. // This currently is not guaranteed for repr(Rust) types, but it happens to work here and // the UCG may add additional guarantees for homogenous types in the future that would make this // correct. vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect() } // CHECK-LABEL: @vec_iterator_cast_deaggregate_fold #[no_mangle] pub fn vec_iterator_cast_deaggregate_fold(vec: Vec<Baz>) -> Vec<[u64; 4]> { // CHECK-NOT: loop // CHECK-NOT: call </ins> // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4]. // This currently is not guaranteed for repr(Rust) types, but it happens to work here and


ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.def_path_str(def.did)).into(), ty::Foreign(def_id) => format!("extern type `{}`", tcx.def_path_str(def_id)).into(), ty::Array(t, n) => { <ins> if t.is_simple_ty() { return format!("array `{}`", self).into(); } </ins> let n = tcx.lift(n).unwrap(); <del> match n.try_eval_usize(tcx, ty::ParamEnv::empty()) { _ if t.is_simple_ty() => format!("array `{}`", self).into(), Some(n) => format!("array of {} element{}", n, pluralize!(n)).into(), None => "array".into(), </del> <ins> if let ty::ConstKind::Value(v) = n.val { if let Some(n) = v.try_to_machine_usize(tcx) { return format!("array of {} element{}", n, pluralize!(n)).into(); } </ins> } <ins> "array".into() </ins> } ty::Slice(ty) if ty.is_simple_ty() => format!("slice `{}`", self).into(), ty::Slice(_) => "slice".into(),


tcx: TyCtxt<'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc_middle::mir::interpret::EvalToConstValueResult<'tcx> { <del> // see comment in const_eval_raw_provider for what we're doing here </del> <ins> // see comment in eval_to_allocation_raw_provider for what we're doing here </ins> if key.param_env.reveal() == Reveal::All { let mut key = key; key.param_env = key.param_env.with_user_facing();


<ins> #![feature(const_generics, const_evaluatable_checked)] #![allow(incomplete_features)] // This test is a minimized reproduction for #79518 where // during error handling for the type mismatch we would try // to evaluate std::mem::size_of::<Self::Assoc> causing an ICE trait Foo { type Assoc: PartialEq; const AssocInstance: Self::Assoc; fn foo() where [(); std::mem::size_of::<Self::Assoc>()]: , { Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()]; //~^ Error: mismatched types } } fn main() {} </ins>


<ins> error[E0308]: mismatched types --> $DIR/issue-79518-default_trait_method_normalization.rs:16:32 | LL |         Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()]; |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); _]` | = note: expected associated type `<Self as Foo>::Assoc` found array `[(); _]` = help: consider constraining the associated type `<Self as Foo>::Assoc` to `[(); _]` or calling a method that returns `<Self as Foo>::Assoc` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>


*self = snapshot; Err(err) } <ins> /// Get the diagnostics for the cases where `move async` is found. /// /// `move_async_span` starts at the 'm' of the move keyword and ends with the 'c' of the async keyword pub(super) fn incorrect_move_async_order_found( &self, move_async_span: Span, ) -> DiagnosticBuilder<'a> { let mut err = self.struct_span_err(move_async_span, "the order of `move` and `async` is incorrect"); err.span_suggestion_verbose( move_async_span, "try switching the order", "async move".to_owned(), Applicability::MaybeIncorrect, ); err } </ins> }


self.sess.gated_spans.gate(sym::async_closure, span); } <del> let capture_clause = self.parse_capture_clause(); </del> <ins> let capture_clause = self.parse_capture_clause()?; </ins> let decl = self.parse_fn_block_decl()?; let decl_hi = self.prev_token.span; let body = match decl.output {


} /// Parses an optional `move` prefix to a closure-like construct. <del> fn parse_capture_clause(&mut self) -> CaptureBy { if self.eat_keyword(kw::Move) { CaptureBy::Value } else { CaptureBy::Ref } </del> <ins> fn parse_capture_clause(&mut self) -> PResult<'a, CaptureBy> { if self.eat_keyword(kw::Move) { // Check for `move async` and recover if self.check_keyword(kw::Async) { let move_async_span = self.token.span.with_lo(self.prev_token.span.data().lo); Err(self.incorrect_move_async_order_found(move_async_span)) } else { Ok(CaptureBy::Value) } } else { Ok(CaptureBy::Ref) } </ins> } /// Parses the `|arg, arg|` header of a closure.


fn parse_async_block(&mut self, mut attrs: AttrVec) -> PResult<'a, P<Expr>> { let lo = self.token.span; self.expect_keyword(kw::Async)?; <del> let capture_clause = self.parse_capture_clause(); </del> <ins> let capture_clause = self.parse_capture_clause()?; </ins> let (iattrs, body) = self.parse_inner_attrs_and_block()?; attrs.extend(iattrs); let kind = ExprKind::Async(capture_clause, DUMMY_NODE_ID, body);


<ins> // run-rustfix // edition:2018 // Regression test for issue 79694 fn main() { let _ = async move { }; //~ ERROR 7:13: 7:23: the order of `move` and `async` is incorrect } </ins>


<ins> // run-rustfix // edition:2018 // Regression test for issue 79694 fn main() { let _ = move async { }; //~ ERROR 7:13: 7:23: the order of `move` and `async` is incorrect } </ins>


<ins> error: the order of `move` and `async` is incorrect --> $DIR/incorrect-move-async-order-issue-79694.rs:7:13 | LL |     let _ = move async { }; |             ^^^^^^^^^^ | help: try switching the order | LL |     let _ = async move { }; |             ^^^^^^^^^^ error: aborting due to previous error </ins>


let pred = trait_ref.without_const().to_predicate(tcx).to_string(); let pred = pred.replace(&impl_trait_str, &type_param_name); let mut sugg = vec![ <ins> // Find the last of the generic parameters contained within the span of // the generics </ins> match generics .params .iter() <del> .filter(|p| match p.kind { hir::GenericParamKind::Type { synthetic: Some(hir::SyntheticTyParamKind::ImplTrait), .. } => false, _ => true, }) .last() </del> <ins> .map(|p| p.bounds_span().unwrap_or(p.span)) .filter(|&span| generics.span.contains(span) && span.desugaring_kind().is_none()) .max_by_key(|span| span.hi()) </ins> { // `fn foo(t: impl Trait)` //        ^ suggest `<T: Trait>` here None => (generics.span, format!("<{}>", type_param)), // `fn foo<A>(t: impl Trait)` //        ^^^ suggest `<A, T: Trait>` here <del> Some(param) => ( param.bounds_span().unwrap_or(param.span).shrink_to_hi(), format!(", {}", type_param), ), </del> <ins> Some(span) => (span.shrink_to_hi(), format!(", {}", type_param)), </ins> }, // `fn foo(t: impl Trait)` //                       ^ suggest `where <T as Trait>::A: Bound`


} } <ins> #[rustfmt::skip] fn baw<>(constraints: impl Iterator) { for constraint in constraints { qux(constraint); //~^ ERROR `<impl Iterator as Iterator>::Item` doesn't implement `Debug` } } </ins> fn qux(_: impl std::fmt::Debug) {} fn main() {}


LL | fn bak<I: Iterator + std::fmt::Debug>(constraints: I) where <I as Iterator>::Item: Debug { |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^              ^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <del> error: aborting due to 5 previous errors </del> <ins> error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:45:13 | LL |         qux(constraint); |             ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` ... LL | fn qux(_: impl std::fmt::Debug) {} |                --------------- required by this bound in `qux` | = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | fn baw<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { |       ^^^^^^^^^^^^^              ^  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors </ins> For more information about this error, try `rustc --explain E0277`.


<ins> // Regression test: if we suggest replacing an `impl Trait` argument to an async // fn with a named type parameter in order to add bounds, the suggested function // signature should be well-formed. // // edition:2018 trait Foo { type Bar; fn bar(&self) -> Self::Bar; } async fn run(_: &(), foo: impl Foo) -> std::io::Result<()> { let bar = foo.bar(); assert_is_send(&bar); //~^ ERROR: `<impl Foo as Foo>::Bar` cannot be sent between threads safely Ok(()) } // Test our handling of cases where there is a generic parameter list in the // source, but only synthetic generic parameters async fn run2< >(_: &(), foo: impl Foo) -> std::io::Result<()> { let bar = foo.bar(); assert_is_send(&bar); //~^ ERROR: `<impl Foo as Foo>::Bar` cannot be sent between threads safely Ok(()) } fn assert_is_send<T: Send>(_: &T) {} fn main() {} </ins>


<ins> error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:14:20 | LL |     assert_is_send(&bar); |                    ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely ... LL | fn assert_is_send<T: Send>(_: &T) {} |                      ---- required by this bound in `assert_is_send` | = help: the trait `Send` is not implemented for `<impl Foo as Foo>::Bar` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | async fn run<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { |             ^^^^^^^^              ^                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:24:20 | LL |     assert_is_send(&bar); |                    ^^^^ `<impl Foo as Foo>::Bar` cannot be sent between threads safely ... LL | fn assert_is_send<T: Send>(_: &T) {} |                      ---- required by this bound in `assert_is_send` | = help: the trait `Send` is not implemented for `<impl Foo as Foo>::Bar` help: introduce a type parameter with a trait bound instead of using `impl Trait` | LL | async fn run2<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { |              ^^^^^^^^              ^                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. </ins>


token.can_begin_expr() // This exception is here for backwards compatibility. && !token.is_keyword(kw::Let) <ins> // This exception is here for backwards compatibility. && !token.is_keyword(kw::Const) </ins> } NonterminalKind::Ty => token.can_begin_type(), NonterminalKind::Ident => get_macro_ident(token).is_some(),


<ins> // check-pass macro_rules! exp { (const $n:expr) => { $n }; } macro_rules! stmt { (exp $e:expr) => { $e }; (exp $($t:tt)+) => { exp!($($t)+) }; } fn main() { stmt!(exp const 1); } </ins>


} #titles > button:hover, #titles > button.selected { <ins> background-color: #ffffff; </ins> border-top-color: #0089ff; <del> background-color: #353535; </del> } #titles > button > div.count {


] [[package]] <ins> name = "cargo-credential" version = "0.1.0" [[package]] name = "cargo-credential-1password" version = "0.1.0" dependencies = [ "cargo-credential", "serde", "serde_json", ] [[package]] name = "cargo-credential-macos-keychain" version = "0.1.0" dependencies = [ "cargo-credential", "security-framework", ] [[package]] name = "cargo-credential-wincred" version = "0.1.0" dependencies = [ "cargo-credential", "winapi 0.3.9", ] [[package]] </ins> name = "cargo-miri" version = "0.1.0" dependencies = [


checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] <ins> name = "security-framework" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" dependencies = [ "bitflags", "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" dependencies = [ "core-foundation-sys", "libc", ] [[package]] </ins> name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index"


[[package]] name = "serde" <del> version = "1.0.115" </del> <ins> version = "1.0.118" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" </del> <ins> checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" </ins> dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" <del> version = "1.0.115" </del> <ins> version = "1.0.118" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" </del> <ins> checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" </ins> dependencies = [ "proc-macro2", "quote",


"src/tools/rust-installer", "src/tools/rust-demangler", "src/tools/cargo", <ins> "src/tools/cargo/crates/credential/cargo-credential-1password", "src/tools/cargo/crates/credential/cargo-credential-macos-keychain", "src/tools/cargo/crates/credential/cargo-credential-wincred", </ins> "src/tools/rustdoc", "src/tools/rls", "src/tools/rustfmt",


builder.create_dir(&image.join("etc/bash_completion.d")); let cargo = builder.ensure(tool::Cargo { compiler, target }); builder.install(&cargo, &image.join("bin"), 0o755); <ins> for dirent in fs::read_dir(cargo.parent().unwrap()).expect("read_dir") { let dirent = dirent.expect("read dir entry"); if dirent.file_name().to_str().expect("utf8").starts_with("cargo-credential-") { builder.install(&dirent.path(), &image.join("libexec"), 0o755); } } </ins> for man in t!(etc.join("man").read_dir()) { let man = t!(man); builder.install(&man.path(), &image.join("share/man/man1"), 0o644);


} fn run(self, builder: &Builder<'_>) -> PathBuf { <del> builder </del> <ins> let cargo_bin_path = builder </ins> .ensure(ToolBuild { compiler: self.compiler, target: self.target,


source_type: SourceType::Submodule, extra_features: Vec::new(), }) <del> .expect("expected to build -- essential tool") </del> <ins> .expect("expected to build -- essential tool"); let build_cred = |name, path| { // These credential helpers are currently experimental. // Any build failures will be ignored. let _ = builder.ensure(ToolBuild { compiler: self.compiler, target: self.target, tool: name, mode: Mode::ToolRustc, path, is_optional_tool: true, source_type: SourceType::Submodule, extra_features: Vec::new(), }); }; if self.target.contains("windows") { build_cred( "cargo-credential-wincred", "src/tools/cargo/crates/credential/cargo-credential-wincred", ); } if self.target.contains("apple-darwin") { build_cred( "cargo-credential-macos-keychain", "src/tools/cargo/crates/credential/cargo-credential-macos-keychain", ); } build_cred( "cargo-credential-1password", "src/tools/cargo/crates/credential/cargo-credential-1password", ); cargo_bin_path </ins> } }


<del> Subproject commit d274fcf862b89264fa2c6b917b15230705257317 </del> <ins> Subproject commit a3c2627fbc2f5391c65ba45ab53b81bf71fa323c </ins>


<ins> // check-pass #![allow(unreachable_code, unused)] use std::marker::PhantomData; struct FsmBuilder<TFsm> { _fsm: PhantomData<TFsm>, } impl<TFsm> FsmBuilder<TFsm> { fn state(&mut self) -> FsmStateBuilder<TFsm> { todo!() } } struct FsmStateBuilder<TFsm> { _state: PhantomData<TFsm>, } impl<TFsm> FsmStateBuilder<TFsm> { fn on_entry<TAction: Fn(&mut StateContext<'_, TFsm>)>(&self, _action: TAction) {} } trait Fsm { type Context; } struct StateContext<'a, TFsm: Fsm> { context: &'a mut TFsm::Context, } fn main() { let mut builder: FsmBuilder<usize> = todo!(); builder.state().on_entry(|_| {}); } </ins>


s.print_type_bounds(":", &param.bounds); if let Some(ref _default) = default { // FIXME(const_generics_defaults): print the `default` value here <del> todo!(); </del> } } }


self.print_type(ty); if let Some(ref _default) = default { // FIXME(const_generics_defaults): print the `default` value here <del> todo!(); </del> } } }


param_text.push_str(&ty_to_string(&ty)); if let Some(ref _default) = default { // FIXME(const_generics_defaults): push the `default` value here <del> todo!(); </del> } } if !param.bounds.is_empty() {


<ins> //! Test case for [#80737]. //! //! A SomeTrait that is implemented for `&mut T where T: SomeTrait` //! should not be marked as "notable" for return values that do not //! have bounds on the trait itself. //! //! [#80737]: https://github.com/rust-lang/rust/issues/80737 #![feature(rustdoc_internals)] #![no_std] #[doc(primitive = "reference")] /// Some useless docs, wouhou! /// /// We need to put this in here, because notable traits /// that are implemented on foreign types don't show up. mod reference {} // @has doc_notable_trait_mut_t_is_not_an_iterator/fn.fn_no_matches.html // @!has - '//code[@class="content"]' 'Iterator' pub fn fn_no_matches<'a, T: 'a>() -> &'a mut T { panic!() } </ins>


<ins> #![allow(unreachable_code)] use std::marker::PhantomData; use std::ops::Deref; use std::sync::Arc; pub struct Guard<T> { _phantom: PhantomData<T>, } impl<T> Deref for Guard<T> { type Target = T; fn deref(&self) -> &T { unimplemented!() } } pub struct DirectDeref<T>(T); impl<T> Deref for DirectDeref<Arc<T>> { type Target = T; fn deref(&self) -> &T { unimplemented!() } } pub trait Access<T> { type Guard: Deref<Target = T>; fn load(&self) -> Self::Guard { unimplemented!() } } impl<T, A: Access<T>, P: Deref<Target = A>> Access<T> for P { //~^ NOTE: required for `Arc<ArcSwapAny<Arc<usize>>>` to implement `Access<_>` type Guard = A::Guard; } impl<T> Access<T> for ArcSwapAny<T> { //~^ NOTE: multiple `impl`s satisfying `ArcSwapAny<Arc<usize>>: Access<_>` found type Guard = Guard<T>; } impl<T> Access<T> for ArcSwapAny<Arc<T>> { type Guard = DirectDeref<Arc<T>>; } pub struct ArcSwapAny<T> { _phantom_arc: PhantomData<T>, } pub fn foo() { let s: Arc<ArcSwapAny<Arc<usize>>> = unimplemented!(); let guard: Guard<Arc<usize>> = s.load(); //~^ ERROR: type annotations needed //~| HELP: try using a fully qualified path to specify the expected types } fn main() {} </ins>


<ins> error[E0283]: type annotations needed --> $DIR/issue-80816.rs:49:38 | LL |     let guard: Guard<Arc<usize>> = s.load(); |                                      ^^^^ | note: multiple `impl`s satisfying `ArcSwapAny<Arc<usize>>: Access<_>` found --> $DIR/issue-80816.rs:35:1 | LL | impl<T> Access<T> for ArcSwapAny<T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl<T> Access<T> for ArcSwapAny<Arc<T>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: required for `Arc<ArcSwapAny<Arc<usize>>>` to implement `Access<_>` --> $DIR/issue-80816.rs:31:45 | LL | impl<T, A: Access<T>, P: Deref<Target = A>> Access<T> for P { |                                             ^^^^^^^^^     ^ help: try using a fully qualified path to specify the expected types | LL |     let guard: Guard<Arc<usize>> = <Arc<ArcSwapAny<Arc<usize>>> as Access<T>>::load(&s); |                                    ++++++++++++++++++++++++++++++++++++++++++++++++++ ~ error: aborting due to previous error For more information about this error, try `rustc --explain E0283`. </ins>


fn source_info(&self, cx: &CodegenCx<'ll, 'tcx>) -> Option<SourceInfo<'ll>> { match self { VariantInfo::Generator { def_id, variant_index, .. } => { <del> let span = cx.tcx.generator_layout(*def_id).variant_source_info[*variant_index].span; </del> <ins> let span = cx.tcx.generator_layout(*def_id).unwrap().variant_source_info [*variant_index] .span; </ins> if !span.is_dummy() { let loc = cx.lookup_debug_loc(span.lo()); return Some(SourceInfo {