diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index 609316ea69fe5..accb54e464553 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -480,14 +480,11 @@ pub fn compute_debuginfo_vtable_name<'tcx>( } if let Some(trait_ref) = trait_ref { - push_item_name(tcx, trait_ref.skip_binder().def_id, true, &mut vtable_name); + let trait_ref = + tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), trait_ref); + push_item_name(tcx, trait_ref.def_id, true, &mut vtable_name); visited.clear(); - push_generic_params_internal( - tcx, - trait_ref.skip_binder().substs, - &mut vtable_name, - &mut visited, - ); + push_generic_params_internal(tcx, trait_ref.substs, &mut vtable_name, &mut visited); } else { vtable_name.push_str("_"); } diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index c54ea61060271..bbd30c9327a6c 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -529,6 +529,15 @@ impl<'a> CrateLocator<'a> { let mut err_data: Option> = None; for (lib, kind) in m { info!("{} reading metadata from: {}", flavor, lib.display()); + if flavor == CrateFlavor::Rmeta && lib.metadata().map_or(false, |m| m.len() == 0) { + // Empty files will cause get_metadata_section to fail. Rmeta + // files can be empty, for example with binaries (which can + // often appear with `cargo check` when checking a library as + // a unittest). We don't want to emit a user-visible warning + // in this case as it is not a real problem. + debug!("skipping empty file"); + continue; + } let (hash, metadata) = match get_metadata_section(self.target, flavor, &lib, self.metadata_loader) { Ok(blob) => { diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index 616071592087d..a57ad8f2bbd1b 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -1117,7 +1117,7 @@ impl Niche { // In practice this means that enums with `count > 1` are unlikely to claim niche zero, since they have to fit perfectly. // If niche zero is already reserved, the selection of bounds are of little interest. let move_start = |v: WrappingRange| { - let start = v.start.wrapping_sub(1) & max_value; + let start = v.start.wrapping_sub(count) & max_value; Some((start, Scalar { value, valid_range: v.with_start(start) })) }; let move_end = |v: WrappingRange| { diff --git a/compiler/rustc_typeck/src/bounds.rs b/compiler/rustc_typeck/src/bounds.rs index ff04e07acc4f6..24474e163b9da 100644 --- a/compiler/rustc_typeck/src/bounds.rs +++ b/compiler/rustc_typeck/src/bounds.rs @@ -64,16 +64,16 @@ impl<'tcx> Bounds<'tcx> { }) }); - self.region_bounds - .iter() - .map(|&(region_bound, span)| { + sized_predicate + .into_iter() + .chain(self.region_bounds.iter().map(|&(region_bound, span)| { ( region_bound .map_bound(|region_bound| ty::OutlivesPredicate(param_ty, region_bound)) .to_predicate(tcx), span, ) - }) + })) .chain(self.trait_bounds.iter().map(|&(bound_trait_ref, span, constness)| { let predicate = bound_trait_ref.with_constness(constness).to_predicate(tcx); (predicate, span) @@ -83,7 +83,6 @@ impl<'tcx> Bounds<'tcx> { .iter() .map(|&(projection, span)| (projection.to_predicate(tcx), span)), ) - .chain(sized_predicate.into_iter()) .collect() } } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index b13ab64011dc1..3e853456fad77 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -87,13 +87,21 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // the rexport defines the path that a user will actually see. Accordingly, // we add the rexport as an item here, and then skip over the original // definition in `visit_item()` below. + // + // We also skip `#[macro_export] macro_rules!` that have already been inserted, + // it can happen if within the same module a `#[macro_export] macro_rules!` + // is declared but also a reexport of itself producing two exports of the same + // macro in the same module. + let mut inserted = FxHashSet::default(); for export in self.cx.tcx.module_exports(CRATE_DEF_ID).unwrap_or(&[]) { if let Res::Def(DefKind::Macro(_), def_id) = export.res { if let Some(local_def_id) = def_id.as_local() { if self.cx.tcx.has_attr(def_id, sym::macro_export) { - let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); - let item = self.cx.tcx.hir().expect_item(hir_id); - top_level_module.items.push((item, None)); + if inserted.insert(def_id) { + let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); + let item = self.cx.tcx.hir().expect_item(hir_id); + top_level_module.items.push((item, None)); + } } } } diff --git a/src/test/codegen/debug-vtable.rs b/src/test/codegen/debug-vtable.rs index 851d68da5ee62..1c8cc61f204dd 100644 --- a/src/test/codegen/debug-vtable.rs +++ b/src/test/codegen/debug-vtable.rs @@ -18,6 +18,9 @@ // MSVC-LABEL: !DIGlobalVariable(name: "impl$::vtable$" // CHECK: !DISubrange(count: 3 +// NONMSVC-LABEL: !DIGlobalVariable(name: ">)>>::{vtable}" +// MSVC-LABEL: !DIGlobalVariable(name: "impl$,assoc$ > > > > >, {{.*}}, {{.*}}, Some> > > >::vtable$" + #![crate_type = "lib"] pub struct Foo; @@ -45,3 +48,10 @@ pub fn foo(x: &Foo) -> (u32, (u64, i8), &dyn Send) { let z: &dyn SomeTraitWithGenerics = x; (y.method1(), z.method1(), x as &dyn Send) } + +// Constructing the debuginfo name for the FnOnce vtable below initially caused an ICE on MSVC +// because the trait type contains a late bound region that needed to be erased before the type +// layout for the niche enum `Option<&dyn Fn()>` could be computed. +pub fn bar() -> Box)> { + Box::new(|_x: Option<&dyn Fn()>| {}) +} diff --git a/src/test/rustdoc-json/reexport/macro.rs b/src/test/rustdoc-json/reexport/macro.rs new file mode 100644 index 0000000000000..b86614ffbad68 --- /dev/null +++ b/src/test/rustdoc-json/reexport/macro.rs @@ -0,0 +1,17 @@ +// edition:2018 + +#![no_core] +#![feature(no_core)] + +// @count macro.json "$.index[*][?(@.name=='macro')].inner.items[*]" 2 + +// @set repro_id = macro.json "$.index[*][?(@.name=='repro')].id" +// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id +#[macro_export] +macro_rules! repro { + () => {}; +} + +// @set repro2_id = macro.json "$.index[*][?(@.inner.name=='repro2')].id" +// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro2_id +pub use crate::repro as repro2; diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs new file mode 100644 index 0000000000000..45544dbeea6a0 --- /dev/null +++ b/src/test/rustdoc/issue-89852.rs @@ -0,0 +1,14 @@ +// edition:2018 + +#![no_core] +#![feature(no_core)] + +// @matches 'issue_89852/sidebar-items.js' '"repro"' +// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"' + +#[macro_export] +macro_rules! repro { + () => {}; +} + +pub use crate::repro as repro2; diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 89186817e099c..47c7f1c2c3340 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^^^^^^ required by this bound in `std::hash::Hash::hash` + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 6abb7e78b1330..92f084b58e35b 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^^^^^^ required by this bound in `std::hash::Hash::hash` + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 405285f883810..c57cebe04ebcb 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^^^^^^ required by this bound in `std::hash::Hash::hash` + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index aa12314c05176..200937f0c9fc3 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -11,7 +11,7 @@ note: required by a bound in `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^^^^^^ required by this bound in `std::hash::Hash::hash` + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/enum-discriminant/issue-90038.rs b/src/test/ui/enum-discriminant/issue-90038.rs new file mode 100644 index 0000000000000..5e98eccd9b55c --- /dev/null +++ b/src/test/ui/enum-discriminant/issue-90038.rs @@ -0,0 +1,21 @@ +// run-pass + +#[repr(u32)] +pub enum Foo { + // Greater than or equal to 2 + A = 2, +} + +pub enum Bar { + A(Foo), + // More than two const variants + B, + C, +} + +fn main() { + match Bar::A(Foo::A) { + Bar::A(_) => (), + _ => unreachable!(), + } +} diff --git a/src/test/ui/generic-associated-types/issue-74816.stderr b/src/test/ui/generic-associated-types/issue-74816.stderr index d5cc5cfbe912d..49ae87cbfe9dc 100644 --- a/src/test/ui/generic-associated-types/issue-74816.stderr +++ b/src/test/ui/generic-associated-types/issue-74816.stderr @@ -1,34 +1,34 @@ -error[E0277]: the size for values of type `Self` cannot be known at compilation time +error[E0277]: the trait bound `Self: Trait1` is not satisfied --> $DIR/issue-74816.rs:9:5 | LL | type Associated: Trait1 = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait1` is not implemented for `Self` | note: required by a bound in `Trait2::Associated` - --> $DIR/issue-74816.rs:9:5 + --> $DIR/issue-74816.rs:9:22 | LL | type Associated: Trait1 = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated` + | ^^^^^^ required by this bound in `Trait2::Associated` help: consider further restricting `Self` | -LL | trait Trait2: Sized { - | +++++++ +LL | trait Trait2: Trait1 { + | ++++++++ -error[E0277]: the trait bound `Self: Trait1` is not satisfied +error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-74816.rs:9:5 | LL | type Associated: Trait1 = Self; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait1` is not implemented for `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | note: required by a bound in `Trait2::Associated` - --> $DIR/issue-74816.rs:9:22 + --> $DIR/issue-74816.rs:9:5 | LL | type Associated: Trait1 = Self; - | ^^^^^^ required by this bound in `Trait2::Associated` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait2::Associated` help: consider further restricting `Self` | -LL | trait Trait2: Trait1 { - | ++++++++ +LL | trait Trait2: Sized { + | +++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/issue-86483.stderr b/src/test/ui/generic-associated-types/issue-86483.stderr index 5d0fcbca552d6..d6978794e1e95 100644 --- a/src/test/ui/generic-associated-types/issue-86483.stderr +++ b/src/test/ui/generic-associated-types/issue-86483.stderr @@ -20,13 +20,13 @@ LL | for<'a> T: 'a, | ^^ error[E0311]: the parameter type `T` may not live long enough - --> $DIR/issue-86483.rs:9:19 + --> $DIR/issue-86483.rs:9:5 | LL | pub trait IceIce | - help: consider adding an explicit lifetime bound...: `T: 'a` ... LL | type Ice<'v>: IntoIterator; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound --> $DIR/issue-86483.rs:7:16 diff --git a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr index 50f90618e4db7..2c397d80b013e 100644 --- a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr +++ b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr @@ -6,10 +6,10 @@ LL | impl Tsized for () {} | = help: the trait `Sized` is not implemented for `[()]` note: required by a bound in `Tsized` - --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:17:17 + --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:17:14 | LL | trait Tsized {} - | ^^^^^ required by this bound in `Tsized` + | ^ required by this bound in `Tsized` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr index 7597824e08f9d..09e20c0c77731 100644 --- a/src/test/ui/issues/issue-16966.stderr +++ b/src/test/ui/issues/issue-16966.stderr @@ -1,21 +1,11 @@ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/issue-16966.rs:2:5 | LL | panic!(std::default::Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `M` declared on the function `begin_panic` | - = note: cannot satisfy `_: Any` -note: required by a bound in `begin_panic` - --> $SRC_DIR/std/src/panicking.rs:LL:COL - | -LL | pub fn begin_panic(msg: M) -> ! { - | ^^^ required by this bound in `begin_panic` = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider specifying the type argument in the function call - | -LL | $crate::rt::begin_panic::($msg) - | +++++ error: aborting due to previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index c2f6fc21acd7f..92742b50619e0 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -10,7 +10,7 @@ note: required by a bound in `std::hash::Hash::hash` --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | LL | fn hash(&self, state: &mut H); - | ^^^^^^ required by this bound in `std::hash::Hash::hash` + | ^ required by this bound in `std::hash::Hash::hash` = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index e6cec722978dd..b345e90178742 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Next` +error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` --> $DIR/issue-23122-2.rs:9:17 | LL | type Next = as Next>::Next; diff --git a/src/test/ui/issues/issue-54954.stderr b/src/test/ui/issues/issue-54954.stderr index d88397fd7e15d..df76a985559d0 100644 --- a/src/test/ui/issues/issue-54954.stderr +++ b/src/test/ui/issues/issue-54954.stderr @@ -12,10 +12,10 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); | = note: cannot satisfy `_: Tt` note: required by a bound in `Tt::const_val` - --> $DIR/issue-54954.rs:5:27 + --> $DIR/issue-54954.rs:5:24 | LL | const fn const_val() -> usize { - | ^^^^^ required by this bound in `Tt::const_val` + | ^ required by this bound in `Tt::const_val` error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr index 4a4544c16c941..fffb91f98700b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/trait-where-clause.stderr @@ -20,11 +20,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::c::(); | ^^^^^^^^^ the trait `Bar` is not implemented for `T` | -note: required by a bound in `Foo::c` - --> $DIR/trait-where-clause.rs:9:10 +note: required by `Foo::c` + --> $DIR/trait-where-clause.rs:9:5 | LL | fn c(); - | ^ required by this bound in `Foo::c` + | ^^^^^^^^^^^^^^^^^^^^^^ help: consider further restricting this bound | LL | const fn test1() { @@ -52,11 +52,11 @@ error[E0277]: the trait bound `T: Bar` is not satisfied LL | T::c::(); | ^^^^^^^^^ the trait `Bar` is not implemented for `T` | -note: required by a bound in `Foo::c` - --> $DIR/trait-where-clause.rs:9:10 +note: required by `Foo::c` + --> $DIR/trait-where-clause.rs:9:5 | LL | fn c(); - | ^ required by this bound in `Foo::c` + | ^^^^^^^^^^^^^^^^^^^^^^ help: consider further restricting this bound | LL | fn test3() { diff --git a/src/test/ui/suggestions/issue-84973-blacklist.stderr b/src/test/ui/suggestions/issue-84973-blacklist.stderr index 58075ed7caebc..ae55c96702ada 100644 --- a/src/test/ui/suggestions/issue-84973-blacklist.stderr +++ b/src/test/ui/suggestions/issue-84973-blacklist.stderr @@ -49,10 +49,10 @@ LL | f_sized(*ref_cl); | = help: the trait `Sized` is not implemented for `dyn Fn()` note: required by a bound in `f_sized` - --> $DIR/issue-84973-blacklist.rs:9:15 + --> $DIR/issue-84973-blacklist.rs:9:12 | LL | fn f_sized(t: T) {} - | ^^^^^ required by this bound in `f_sized` + | ^ required by this bound in `f_sized` error[E0277]: `Rc<{integer}>` cannot be sent between threads safely --> $DIR/issue-84973-blacklist.rs:27:12 diff --git a/src/test/ui/suggestions/slice-issue-87994.stderr b/src/test/ui/suggestions/slice-issue-87994.stderr index 9e0d4ced01153..0275fd475d8c6 100644 --- a/src/test/ui/suggestions/slice-issue-87994.stderr +++ b/src/test/ui/suggestions/slice-issue-87994.stderr @@ -1,4 +1,4 @@ -error[E0277]: `[i32]` is not an iterator +error[E0277]: the size for values of type `[i32]` cannot be known at compilation time --> $DIR/slice-issue-87994.rs:3:12 | LL | for _ in v[1..] { @@ -18,7 +18,7 @@ LL | for _ in &v[1..] { LL | for _ in &mut v[1..] { | ++++ -error[E0277]: the size for values of type `[i32]` cannot be known at compilation time +error[E0277]: `[i32]` is not an iterator --> $DIR/slice-issue-87994.rs:3:12 | LL | for _ in v[1..] { @@ -38,7 +38,7 @@ LL | for _ in &v[1..] { LL | for _ in &mut v[1..] { | ++++ -error[E0277]: `[K]` is not an iterator +error[E0277]: the size for values of type `[K]` cannot be known at compilation time --> $DIR/slice-issue-87994.rs:11:13 | LL | for i2 in v2[1..] { @@ -58,7 +58,7 @@ LL | for i2 in &v2[1..] { LL | for i2 in &mut v2[1..] { | ++++ -error[E0277]: the size for values of type `[K]` cannot be known at compilation time +error[E0277]: `[K]` is not an iterator --> $DIR/slice-issue-87994.rs:11:13 | LL | for i2 in v2[1..] { diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs index 4baf198b12fae..747081933172b 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs @@ -5,7 +5,7 @@ use std::fmt::Debug; fn main() {} type Two = impl Debug; -//~^ ERROR the trait bound `A: Foo` is not satisfied +//~^ ERROR the trait bound `A: Foo` is not satisfied in `(A, B, ::Bar)` //~| ERROR `A` doesn't implement `Debug` //~| ERROR `B` doesn't implement `Debug` diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr index f21e036edc2ca..a8eb53a50e38b 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr @@ -10,6 +10,18 @@ note: previous use here LL | fn two(t: T, u: U) -> Two { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0277]: the trait bound `A: Foo` is not satisfied in `(A, B, ::Bar)` + --> $DIR/generic_duplicate_param_use9.rs:7:18 + | +LL | type Two = impl Debug; + | ^^^^^^^^^^ within `(A, B, ::Bar)`, the trait `Foo` is not implemented for `A` + | + = note: required because it appears within the type `(A, B, ::Bar)` +help: consider restricting type parameter `A` + | +LL | type Two = impl Debug; + | +++++ + error[E0277]: `A` doesn't implement `Debug` --> $DIR/generic_duplicate_param_use9.rs:7:18 | @@ -34,18 +46,6 @@ help: consider restricting type parameter `B` LL | type Two = impl Debug; | +++++++++++++++++ -error[E0277]: the trait bound `A: Foo` is not satisfied - --> $DIR/generic_duplicate_param_use9.rs:7:18 - | -LL | type Two = impl Debug; - | ^^^^^^^^^^ the trait `Foo` is not implemented for `A` - | - = note: required because of the requirements on the impl of `Debug` for `(A, B, ::Bar)` -help: consider restricting type parameter `A` - | -LL | type Two = impl Debug; - | +++++ - error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/typeck/issue-89935.rs b/src/test/ui/typeck/issue-89935.rs new file mode 100644 index 0000000000000..03f8f09a72201 --- /dev/null +++ b/src/test/ui/typeck/issue-89935.rs @@ -0,0 +1,18 @@ +// check-pass + +trait Foo: Baz {} +trait Bar {} +trait Baz: Bar { + fn bar(&self); +} + +impl Bar for T {} +impl Baz for T { + fn bar(&self) {} +} + +fn accept_foo(x: Box) { + x.bar(); +} + +fn main() {} diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 8626b726f47c4..5c40787febfb7 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -19,10 +19,10 @@ LL | | >(Unique, A); | |________________- doesn't satisfy `Box: Clone` | = note: the following trait bounds were not satisfied: - `dyn Foo: Clone` - which is required by `Box: Clone` `dyn Foo: Sized` which is required by `Box: Clone` + `dyn Foo: Clone` + which is required by `Box: Clone` error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 0dd439e14e3cd..531e9b4c9c955 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -7,10 +7,10 @@ LL | fn foo() { bar::() } | this type parameter needs to be `std::marker::Sized` | note: required by a bound in `bar` - --> $DIR/unsized-bare-typaram.rs:1:11 + --> $DIR/unsized-bare-typaram.rs:1:8 | LL | fn bar() { } - | ^^^^^ required by this bound in `bar` + | ^ required by this bound in `bar` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn foo() { bar::() } diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index 88ba7567402db..1c70a840c77dc 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -38,10 +38,10 @@ note: required because it appears within the type `Bar` LL | struct Bar { data: T } | ^^^ note: required by a bound in `is_sized` - --> $DIR/unsized-struct.rs:1:15 + --> $DIR/unsized-struct.rs:1:13 | LL | fn is_sized() { } - | ^^^^^ required by this bound in `is_sized` + | ^ required by this bound in `is_sized` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn bar2() { is_sized::>() } diff --git a/src/tools/cargo b/src/tools/cargo index c7957a74bdcf3..b2e52d7cab0a2 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit c7957a74bdcf3b11e7154c1a9401735f23ebd484 +Subproject commit b2e52d7cab0a286ee9fcc0c17510b1e72fcb53eb