diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 292643d6d7510..db4f5ee359a0a 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1379,58 +1379,66 @@ impl<'hir> LoweringContext<'_, 'hir> { } } + // Get the `LocalId` of `bound_pred.bounded_ty`, but only if it's a plain type parameter. + fn get_def_id(&mut self, bound_pred: &WhereBoundPredicate) -> Option { + match bound_pred.bounded_ty.kind { + TyKind::Path(None, ref path) => { + if !(path.segments.len() == 1 && bound_pred.bound_generic_params.is_empty()) { + return None; + } + } + _ => return None, + } + if let Some(Res::Def(DefKind::TyParam, def_id)) = + self.resolver.get_partial_res(bound_pred.bounded_ty.id).map(|d| d.base_res()) + { + if let Some(def_id) = def_id.as_local() { + return Some(def_id); + } + } + None + } + pub(super) fn lower_generics_mut( &mut self, generics: &Generics, itctx: ImplTraitContext<'_, 'hir>, ) -> GenericsCtor<'hir> { - // Collect `?Trait` bounds in where clause and move them to parameter definitions. - // FIXME: this could probably be done with less rightward drift. It also looks like two - // control paths where `report_error` is called are the only paths that advance to after the - // match statement, so the error reporting could probably just be moved there. + // Collect `?Trait` bounds in where clause and move them to + // parameter definitions. Currently, the decision to add the + // predicate for the implicit `Sized` bound only examines the + // generic parameters, not the where clauses, to discover any + // `?Sized` bounds. (e.g., `AstConv::is_unsized`) let mut add_bounds: NodeMap> = Default::default(); for pred in &generics.where_clause.predicates { - if let WherePredicate::BoundPredicate(ref bound_pred) = *pred { - 'next_bound: for bound in &bound_pred.bounds { - if let GenericBound::Trait(_, TraitBoundModifier::Maybe) = *bound { - let report_error = |this: &mut Self| { - this.diagnostic().span_err( - bound_pred.bounded_ty.span, - "`?Trait` bounds are only permitted at the \ - point where a type parameter is declared", - ); - }; - // Check if the where clause type is a plain type parameter. - match bound_pred.bounded_ty.kind { - TyKind::Path(None, ref path) - if path.segments.len() == 1 - && bound_pred.bound_generic_params.is_empty() => - { - if let Some(Res::Def(DefKind::TyParam, def_id)) = self - .resolver - .get_partial_res(bound_pred.bounded_ty.id) - .map(|d| d.base_res()) - { - if let Some(def_id) = def_id.as_local() { - for param in &generics.params { - if let GenericParamKind::Type { .. } = param.kind { - if def_id == self.resolver.local_def_id(param.id) { - add_bounds - .entry(param.id) - .or_default() - .push(bound.clone()); - continue 'next_bound; - } - } - } - } - } - report_error(self) - } - _ => report_error(self), + let bound_pred = match *pred { + WherePredicate::BoundPredicate(ref bound_pred) => bound_pred, + _ => continue, + }; + 'next_bound: for bound in &bound_pred.bounds { + if !matches!(*bound, GenericBound::Trait(_, TraitBoundModifier::Maybe)) { + continue; + } + // Check if the where clause type is a plain type parameter. + if let Some(def_id) = self.get_def_id(bound_pred) { + // Search for it in the generic type parameters. + for param in &generics.params { + if !matches!(param.kind, GenericParamKind::Type { .. }) { + continue; + } + if def_id == self.resolver.local_def_id(param.id) { + add_bounds.entry(param.id).or_default().push(bound.clone()); + continue 'next_bound; } } } + // Either the `bounded_ty` is not a plain type parameter, or it's not + // found in the generic type parameters list. + self.diagnostic().span_err( + bound_pred.bounded_ty.span, + "`?Trait` bounds are only permitted at the \ + point where a type parameter is declared", + ); } } diff --git a/compiler/rustc_typeck/src/bounds.rs b/compiler/rustc_typeck/src/bounds.rs index 5d20064072263..c09669483ab0a 100644 --- a/compiler/rustc_typeck/src/bounds.rs +++ b/compiler/rustc_typeck/src/bounds.rs @@ -1,6 +1,7 @@ //! Bounds are restrictions applied to some types after they've been converted into the //! `ty` form from the HIR. +use rustc_data_structures::fx::FxIndexMap; use rustc_hir::Constness; use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt, WithConstness}; use rustc_span::Span; @@ -53,9 +54,10 @@ impl<'tcx> Bounds<'tcx> { &self, tcx: TyCtxt<'tcx>, param_ty: Ty<'tcx>, + sized_preds_map: Option<&mut FxIndexMap, (ty::Predicate<'tcx>, Span)>>, ) -> Vec<(ty::Predicate<'tcx>, Span)> { // If it could be sized, and is, add the `Sized` predicate. - let sized_predicate = self.implicitly_sized.and_then(|span| { + let mut sized_predicate = self.implicitly_sized.and_then(|span| { tcx.lang_items().sized_trait().map(|sized| { let trait_ref = ty::Binder::dummy(ty::TraitRef { def_id: sized, @@ -64,17 +66,24 @@ impl<'tcx> Bounds<'tcx> { (trait_ref.without_const().to_predicate(tcx), span) }) }); - - sized_predicate - .into_iter() - .chain(self.region_bounds.iter().map(|&(region_bound, span)| { + // Insert into a map for deferred output of `Sized` predicates, if provided. + if let Some(map) = sized_preds_map { + if let Some(pred) = sized_predicate { + map.insert(param_ty, pred); + // Don't output with the others if it's being deferred. + sized_predicate = None; + } + } + 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) @@ -84,6 +93,7 @@ impl<'tcx> Bounds<'tcx> { .iter() .map(|&(projection, span)| (projection.to_predicate(tcx), span)), ) + .chain(sized_predicate.into_iter()) .collect() } } diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 5d83375e5a1b8..55429c13d1da7 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -27,7 +27,7 @@ use rustc_ast as ast; use rustc_ast::{MetaItemKind, NestedMetaItem}; use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr}; use rustc_data_structures::captures::Captures; -use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet}; +use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; use rustc_errors::{struct_span_err, Applicability}; use rustc_hir as hir; use rustc_hir::def::{CtorKind, DefKind, Res}; @@ -1127,7 +1127,7 @@ fn super_predicates_that_define_assoc_type( ) }; - let superbounds1 = superbounds1.predicates(tcx, self_param_ty); + let superbounds1 = superbounds1.predicates(tcx, self_param_ty, None); // Convert any explicit superbounds in the where-clause, // e.g., `trait Foo where Self: Bar`. @@ -2015,6 +2015,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP let generics = tcx.generics_of(def_id); let parent_count = generics.parent_count as u32; let has_own_self = generics.has_self && parent_count == 0; + let mut deferred_sized_preds = FxIndexMap::default(); // Below we'll consider the bounds on the type parameters (including `Self`) // and the explicit where-clauses, but to get the full set of predicates @@ -2085,7 +2086,11 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP sized, param.span, ); - predicates.extend(bounds.predicates(tcx, param_ty)); + predicates.extend(bounds.predicates( + tcx, + param_ty, + Some(&mut deferred_sized_preds), + )); } GenericParamKind::Const { .. } => { // Bounds on const parameters are currently not possible. @@ -2147,7 +2152,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP &mut bounds, false, ); - predicates.extend(bounds.predicates(tcx, ty)); + predicates.extend(bounds.predicates(tcx, ty, None)); } &hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => { @@ -2161,7 +2166,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP ty, &mut bounds, ); - predicates.extend(bounds.predicates(tcx, ty)); + predicates.extend(bounds.predicates(tcx, ty, None)); } hir::GenericBound::Outlives(lifetime) => { @@ -2208,6 +2213,9 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP predicates.extend(const_evaluatable_predicates_of(tcx, def_id.expect_local())); } + // Add the deferred sized predicates. + predicates.extend(deferred_sized_preds.into_iter().map(|(_, v)| v)); + let mut predicates: Vec<_> = predicates.into_iter().collect(); // Subtle: before we store the predicates into the tcx, we @@ -2403,7 +2411,7 @@ fn predicates_from_bound<'tcx>( &mut bounds, false, ); - bounds.predicates(astconv.tcx(), param_ty) + bounds.predicates(astconv.tcx(), param_ty, None) } hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => { let mut bounds = Bounds::default(); @@ -2415,7 +2423,7 @@ fn predicates_from_bound<'tcx>( param_ty, &mut bounds, ); - bounds.predicates(astconv.tcx(), param_ty) + bounds.predicates(astconv.tcx(), param_ty, None) } hir::GenericBound::Outlives(ref lifetime) => { let region = astconv.ast_region_to_region(lifetime, None); diff --git a/compiler/rustc_typeck/src/collect/item_bounds.rs b/compiler/rustc_typeck/src/collect/item_bounds.rs index a5b36445aae2e..61e3481c107a1 100644 --- a/compiler/rustc_typeck/src/collect/item_bounds.rs +++ b/compiler/rustc_typeck/src/collect/item_bounds.rs @@ -45,9 +45,9 @@ fn associated_type_bounds<'tcx>( } }); - let all_bounds = tcx - .arena - .alloc_from_iter(bounds.predicates(tcx, item_ty).into_iter().chain(bounds_from_parent)); + let all_bounds = tcx.arena.alloc_from_iter( + bounds.predicates(tcx, item_ty, None).into_iter().chain(bounds_from_parent), + ); debug!("associated_type_bounds({}) = {:?}", tcx.def_path_str(assoc_item_def_id), all_bounds); all_bounds } @@ -73,7 +73,7 @@ fn opaque_type_bounds<'tcx>( SizedByDefault::Yes, span, ) - .predicates(tcx, item_ty); + .predicates(tcx, item_ty, None); debug!("opaque_type_bounds({}) = {:?}", tcx.def_path_str(opaque_def_id), bounds); 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 fef7b8f75ac6f..df92a896d8c6e 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 @@ -7,7 +7,7 @@ LL | x: Error ::: $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) diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 90c5f91af919d..cc8c3fcd7f330 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -7,7 +7,7 @@ LL | Error ::: $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) diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index b48828f439e1f..ba60e81153b3e 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -7,7 +7,7 @@ LL | x: Error ::: $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) 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 3db0299192f05..82ade3ae726b6 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -7,7 +7,7 @@ LL | Error ::: $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) diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index 390c1e3e8ea4a..a4b552d0dd9b4 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,3 +1,18 @@ +error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/E0275.rs:1:1 + | +LL | trait Foo {} + | ^^^^^^^^^ required by this bound in `Foo` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`E0275`) +note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/E0275.rs:5:9 + | +LL | impl Foo for T where Bar: Foo {} + | ^^^ ^ + = note: 127 redundant requirements hidden + = note: required because of the requirements on the impl of `Foo` for `Self` + error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/E0275.rs:5:33 | @@ -16,6 +31,6 @@ LL | impl Foo for T where Bar: Foo {} = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `Bar` -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index 8b1d4e6c07ceb..5ed90978117b5 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -32,13 +32,22 @@ LL | fn helper(sel: &Self) -> u8 { | use of generic parameter from outer function | use a type here instead -error[E0282]: type annotations needed +error[E0283]: type annotations needed --> $DIR/E0401.rs:11:5 | +LL | fn bfnr, W: Fn()>(y: T) { + | ------ required by this bound in `bfnr` +... LL | bfnr(x); - | ^^^^ cannot infer type for type parameter `U` declared on the function `bfnr` + | ^^^^ cannot infer type for type parameter `V` declared on the function `bfnr` + | + = note: cannot satisfy `_: Baz<_>` +help: consider specifying the type arguments in the function call + | +LL | bfnr::(x); + | ^^^^^^^^^^^ error: aborting due to 4 previous errors -Some errors have detailed explanations: E0282, E0401. -For more information about an error, try `rustc --explain E0282`. +Some errors have detailed explanations: E0283, E0401. +For more information about an error, try `rustc --explain E0283`. diff --git a/src/test/ui/error-codes/e0119/complex-impl.stderr b/src/test/ui/error-codes/e0119/complex-impl.stderr index 04babb0644718..ccd2f2e68aecd 100644 --- a/src/test/ui/error-codes/e0119/complex-impl.stderr +++ b/src/test/ui/error-codes/e0119/complex-impl.stderr @@ -6,7 +6,7 @@ LL | impl External for (Q, R) {} | = note: conflicting implementation in crate `complex_impl_support`: - impl<'a, 'b, 'c, T, U, V, W> External for (T, M<'a, 'b, 'c, Box, V, W>) - where >::Output == V, ::Item == T, 'b: 'a, T: 'a, U: FnOnce<(T,)>, U: 'static, V: Iterator, V: Clone, W: Add, ::Output: Copy; + where >::Output == V, ::Item == T, U: FnOnce<(T,)>, 'b: 'a, U: 'static, V: Iterator, T: 'a, V: Clone, W: Add, ::Output: Copy; error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/complex-impl.rs:9:1 diff --git a/src/test/ui/generic-associated-types/issue-74816.stderr b/src/test/ui/generic-associated-types/issue-74816.stderr index 64bc94d601b78..bd2c074375052 100644 --- a/src/test/ui/generic-associated-types/issue-74816.stderr +++ b/src/test/ui/generic-associated-types/issue-74816.stderr @@ -1,17 +1,3 @@ -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 | @@ -26,6 +12,20 @@ help: consider further restricting `Self` LL | trait Trait2: Sized { | ^^^^^^^ +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: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr index d27e46f6836df..1da7e9c4891f8 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr +++ b/src/test/ui/generic-associated-types/projection-bound-cycle-generic.stderr @@ -11,7 +11,7 @@ error[E0275]: overflow evaluating the requirement `::Item: Sized` --> $DIR/projection-bound-cycle-generic.rs:45:5 | LL | struct OnlySized where T: Sized { f: T } - | - required by this bound in `OnlySized` + | ----- required by this bound in `OnlySized` ... LL | type Assoc = OnlySized<::Item>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generic-associated-types/projection-bound-cycle.stderr b/src/test/ui/generic-associated-types/projection-bound-cycle.stderr index 400b664f97ca9..8e2bef81e1969 100644 --- a/src/test/ui/generic-associated-types/projection-bound-cycle.stderr +++ b/src/test/ui/generic-associated-types/projection-bound-cycle.stderr @@ -11,7 +11,7 @@ error[E0275]: overflow evaluating the requirement `::Item: Sized` --> $DIR/projection-bound-cycle.rs:47:5 | LL | struct OnlySized where T: Sized { f: T } - | - required by this bound in `OnlySized` + | ----- required by this bound in `OnlySized` ... LL | type Assoc = OnlySized<::Item>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 2b88a6046fdfd..54434ba55488b 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 @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `[()]` cannot be known at compilation --> $DIR/issue-61631-default-type-param-can-reference-self-in-trait.rs:19:6 | LL | trait Tsized {} - | - required by this bound in `Tsized` + | ----- required by this bound in `Tsized` LL | LL | impl Tsized for () {} | ^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/issues/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr index f9467af9e3c4c..2b3174f75ae95 100644 --- a/src/test/ui/issues/issue-16966.stderr +++ b/src/test/ui/issues/issue-16966.stderr @@ -1,11 +1,21 @@ -error[E0282]: type annotations needed +error[E0283]: 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` + | + ::: $SRC_DIR/std/src/panicking.rs:LL:COL | +LL | pub fn begin_panic(msg: M) -> ! { + | --- required by this bound in `begin_panic` + | + = note: cannot satisfy `_: Any` = 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 E0282`. +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/issues/issue-18400.stderr b/src/test/ui/issues/issue-18400.stderr index 92d53088442e6..3f69130cde6c9 100644 --- a/src/test/ui/issues/issue-18400.stderr +++ b/src/test/ui/issues/issue-18400.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `_: Sized` +error[E0275]: overflow evaluating the requirement `_: Copy` --> $DIR/issue-18400.rs:24:7 | LL | 0.contains(bits); diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 6bcff7aff2dc4..0286500a8153c 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -1,3 +1,18 @@ +error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/issue-20413.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ required by this bound in `Foo` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_20413`) +note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:8:9 + | +LL | impl Foo for T where NoData: Foo { + | ^^^ ^ + = note: 127 redundant requirements hidden + = note: required because of the requirements on the impl of `Foo` for `Self` + error[E0392]: parameter `T` is never used --> $DIR/issue-20413.rs:5:15 | @@ -25,6 +40,46 @@ LL | impl Foo for T where NoData: Foo { = note: 127 redundant requirements hidden = note: required because of the requirements on the impl of `Foo` for `NoData` +error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` + --> $DIR/issue-20413.rs:16:1 + | +LL | trait Bar { + | ^^^^^^^^^ required by this bound in `Bar` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_20413`) +note: required because of the requirements on the impl of `Baz` for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:36:9 + | +LL | impl Baz for T where AlmostNoData: Bar { + | ^^^ ^ +note: required because of the requirements on the impl of `Bar` for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl Bar for T where EvenLessData: Baz { + | ^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Bar` for `Self` + +error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` + --> $DIR/issue-20413.rs:20:1 + | +LL | trait Baz { + | ^^^^^^^^^ required by this bound in `Baz` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_20413`) +note: required because of the requirements on the impl of `Bar` for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl Bar for T where EvenLessData: Baz { + | ^^^ ^ +note: required because of the requirements on the impl of `Baz` for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:36:9 + | +LL | impl Baz for T where AlmostNoData: Bar { + | ^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Baz` for `Self` + error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` --> $DIR/issue-20413.rs:28:42 | @@ -71,6 +126,61 @@ LL | impl Bar for T where EvenLessData: Baz { = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` +error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/issue-20413.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ required by this bound in `Foo` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_20413`) +note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:8:9 + | +LL | impl Foo for T where NoData: Foo { + | ^^^ ^ + = note: 127 redundant requirements hidden + = note: required because of the requirements on the impl of `Foo` for `Self` + +error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` + --> $DIR/issue-20413.rs:16:1 + | +LL | trait Bar { + | ^^^^^^^^^ required by this bound in `Bar` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_20413`) +note: required because of the requirements on the impl of `Baz` for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:36:9 + | +LL | impl Baz for T where AlmostNoData: Bar { + | ^^^ ^ +note: required because of the requirements on the impl of `Bar` for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl Bar for T where EvenLessData: Baz { + | ^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Bar` for `Self` + +error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` + --> $DIR/issue-20413.rs:20:1 + | +LL | trait Baz { + | ^^^^^^^^^ required by this bound in `Baz` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_20413`) +note: required because of the requirements on the impl of `Bar` for `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:28:9 + | +LL | impl Bar for T where EvenLessData: Baz { + | ^^^ ^ +note: required because of the requirements on the impl of `Baz` for `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/issue-20413.rs:36:9 + | +LL | impl Baz for T where AlmostNoData: Bar { + | ^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Baz` for `Self` + error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/issue-20413.rs:8:36 | @@ -135,7 +245,7 @@ LL | impl Bar for T where EvenLessData: Baz { = note: 126 redundant requirements hidden = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` -error: aborting due to 7 previous errors +error: aborting due to 13 previous errors Some errors have detailed explanations: E0275, E0392. For more information about an error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index 4cef23ac42cb3..488626d2f7d98 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -7,7 +7,7 @@ LL | struct Foo(Bar); ::: $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) diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 5008a499986d4..9888388b8de9c 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: Sized` +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` --> $DIR/issue-23122-2.rs:9:5 | 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 9de58d83c8b07..823ffc9048e8a 100644 --- a/src/test/ui/issues/issue-54954.stderr +++ b/src/test/ui/issues/issue-54954.stderr @@ -11,7 +11,7 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type ... LL | const fn const_val() -> usize { - | - required by this bound in `Tt::const_val` + | ----- required by this bound in `Tt::const_val` | = note: cannot satisfy `_: Tt` diff --git a/src/test/ui/specialization/issue-38091.stderr b/src/test/ui/specialization/issue-38091.stderr index 97e5775ab54ee..8df314d0ba06e 100644 --- a/src/test/ui/specialization/issue-38091.stderr +++ b/src/test/ui/specialization/issue-38091.stderr @@ -8,15 +8,66 @@ LL | #![feature(specialization)] = note: see issue #31844 for more information = help: consider using `min_specialization` instead, which is more stable and complete -error[E0277]: the trait bound `(): Valid` is not satisfied - --> $DIR/issue-38091.rs:12:5 +error[E0275]: overflow evaluating the requirement `Self: Iterate<'_>` + --> $DIR/issue-38091.rs:4:1 + | +LL | trait Iterate<'a> { + | ^^^^^^^^^^^^^^^^^ required by this bound in `Iterate` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_38091`) +note: required because of the requirements on the impl of `Check` for `Self` + --> $DIR/issue-38091.rs:18:13 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^ ^ +note: required because of the requirements on the impl of `Iterate<'_>` for `Self` + --> $DIR/issue-38091.rs:8:13 + | +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Iterate<'a>` for `Self` + +error[E0275]: overflow evaluating the requirement `Self: Iterate<'_>` + --> $DIR/issue-38091.rs:5:5 | LL | type Ty: Valid; - | ----- required by this bound in `Iterate::Ty` -... -LL | default type Ty = (); - | ^^^^^^^^^^^^^^^^^^^^^ the trait `Valid` is not implemented for `()` + | ^^^^^^^^^^^^^^^ + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_38091`) +note: required because of the requirements on the impl of `Check` for `Self` + --> $DIR/issue-38091.rs:18:13 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^ ^ +note: required because of the requirements on the impl of `Iterate<'_>` for `Self` + --> $DIR/issue-38091.rs:8:13 + | +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Iterate<'a>` for `Self` + +error[E0275]: overflow evaluating the requirement `Self: Iterate<'_>` + --> $DIR/issue-38091.rs:4:1 + | +LL | trait Iterate<'a> { + | ^^^^^^^^^^^^^^^^^ required by this bound in `Iterate` + | + = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_38091`) +note: required because of the requirements on the impl of `Check` for `Self` + --> $DIR/issue-38091.rs:18:13 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^ ^ +note: required because of the requirements on the impl of `Iterate<'_>` for `Self` + --> $DIR/issue-38091.rs:8:13 + | +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ ^ + = note: 126 redundant requirements hidden + = note: required because of the requirements on the impl of `Iterate<'a>` for `Self` -error: aborting due to previous error; 1 warning emitted +error: aborting due to 3 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index 5bbf4225812b6..be066a1e6a1c5 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/substs-ppaux.normal.stderr @@ -74,7 +74,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/substs-ppaux.rs:49:5 | LL | fn bar<'a, T>() where T: 'a {} - | -- required by this bound in `Foo::bar` + | - required by this bound in `Foo::bar` ... LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -85,6 +85,10 @@ note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ +help: consider relaxing the implicit `Sized` restriction + | +LL | fn bar<'a, T: ?Sized>() where T: 'a {} + | ^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index 20d7655337448..69213c9710c97 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/substs-ppaux.verbose.stderr @@ -74,7 +74,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/substs-ppaux.rs:49:5 | LL | fn bar<'a, T>() where T: 'a {} - | -- required by this bound in `Foo::bar` + | - required by this bound in `Foo::bar` ... LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -85,6 +85,10 @@ note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8> | LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} | ^^^^^^^^^^^^^^ ^ +help: consider relaxing the implicit `Sized` restriction + | +LL | fn bar<'a, T: ?Sized>() where T: 'a {} + | ^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/issue-84973-blacklist.stderr b/src/test/ui/suggestions/issue-84973-blacklist.stderr index f1e6ef883ae90..524aeefd3f4eb 100644 --- a/src/test/ui/suggestions/issue-84973-blacklist.stderr +++ b/src/test/ui/suggestions/issue-84973-blacklist.stderr @@ -31,7 +31,7 @@ error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilat --> $DIR/issue-84973-blacklist.rs:22:13 | LL | fn f_sized(t: T) {} - | - required by this bound in `f_sized` + | ----- required by this bound in `f_sized` ... LL | f_sized(*ref_cl); | ^^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/traits/cycle-cache-err-60010.stderr b/src/test/ui/traits/cycle-cache-err-60010.stderr index 40386f706132b..9878728636140 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.stderr +++ b/src/test/ui/traits/cycle-cache-err-60010.stderr @@ -1,30 +1,4 @@ -error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe` - --> $DIR/cycle-cache-err-60010.rs:69:5 - | -LL | fn parse(&self) { - | --------------- required by `SourceDatabase::parse` -... -LL | SourceDatabase::parse(db); - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: required because it appears within the type `*const SalsaStorage` - = note: required because it appears within the type `Unique` - = note: required because it appears within the type `Box` -note: required because it appears within the type `Runtime` - --> $DIR/cycle-cache-err-60010.rs:23:8 - | -LL | struct Runtime { - | ^^^^^^^ -note: required because it appears within the type `RootDatabase` - --> $DIR/cycle-cache-err-60010.rs:20:8 - | -LL | struct RootDatabase { - | ^^^^^^^^^^^^ -note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase` - --> $DIR/cycle-cache-err-60010.rs:43:9 - | -LL | impl SourceDatabase for T - | ^^^^^^^^^^^^^^ ^ +error[E0275]: overflow evaluating the requirement `RootDatabase: SourceDatabase` error: aborting due to previous error diff --git a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr index 62f5f5aaa88e0..72b984e68eaec 100644 --- a/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr +++ b/src/test/ui/traits/multidispatch-convert-ambig-dest.stderr @@ -1,9 +1,20 @@ -error[E0282]: type annotations needed +error[E0283]: type annotations needed --> $DIR/multidispatch-convert-ambig-dest.rs:26:5 | +LL | fn test(_: T, _: U) + | ---- required by a bound in this +LL | where T : Convert + | ---------- required by this bound in `test` +... LL | test(22, std::default::Default::default()); | ^^^^ cannot infer type for type parameter `U` declared on the function `test` + | + = note: cannot satisfy `i32: Convert<_>` +help: consider specifying the type arguments in the function call + | +LL | test::(22, std::default::Default::default()); + | ^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr index 0b3d72d67b242..2e15bc25ad6d2 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.full_tait.stderr @@ -19,18 +19,6 @@ 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:10: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:10:18 | @@ -55,6 +43,18 @@ 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:10: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; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr index fd1081d7b71de..b59abb9de996d 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.min_tait.stderr @@ -10,18 +10,6 @@ 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:10: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:10:18 | @@ -46,6 +34,18 @@ 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:10: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/type-alias-impl-trait/generic_duplicate_param_use9.rs b/src/test/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs index 5eced6cfa5a0b..ee9b7aafab74b 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 @@ -8,7 +8,7 @@ use std::fmt::Debug; fn main() {} type Two = impl Debug; -//~^ ERROR the trait bound `A: Foo` is not satisfied in `(A, B, ::Bar)` +//~^ ERROR the trait bound `A: Foo` is not satisfied //~| ERROR `A` doesn't implement `Debug` //~| ERROR `B` doesn't implement `Debug` diff --git a/src/test/ui/type-inference/sort_by_key.stderr b/src/test/ui/type-inference/sort_by_key.stderr index 0b6630ec89423..b45966f2f1323 100644 --- a/src/test/ui/type-inference/sort_by_key.stderr +++ b/src/test/ui/type-inference/sort_by_key.stderr @@ -1,9 +1,10 @@ -error[E0282]: type annotations needed +error[E0283]: type annotations needed --> $DIR/sort_by_key.rs:3:9 | LL | lst.sort_by_key(|&(v, _)| v.iter().sum()); | ^^^^^^^^^^^ cannot infer type for type parameter `K` declared on the associated function `sort_by_key` | + = note: cannot satisfy `_: Ord` help: consider specifying the type argument in the method call | LL | lst.sort_by_key(|&(v, _)| v.iter().sum::()); @@ -11,4 +12,4 @@ LL | lst.sort_by_key(|&(v, _)| v.iter().sum::()); error: aborting due to previous error -For more information about this error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 6a355dd256286..bbcc4284b4e13 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: Sized` - which is required by `Box: Clone` `dyn Foo: Clone` which is required by `Box: Clone` + `dyn Foo: Sized` + 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 19978ae24cacb..1c774a9dbcfdf 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/unsized-bare-typaram.rs:2:29 | LL | fn bar() { } - | - required by this bound in `bar` + | ----- required by this bound in `bar` LL | fn foo() { bar::() } | - ^ doesn't have a size known at compile-time | | diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index e38375bff46cf..ad8e38d8a0789 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -21,7 +21,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim --> $DIR/unsized-struct.rs:13:24 | LL | fn is_sized() { } - | - required by this bound in `is_sized` + | ----- required by this bound in `is_sized` ... LL | fn bar2() { is_sized::>() } | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time