From 5e50c8a319d38ea1dc0d470f0fcc1e94eb70f08e Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 25 Jul 2022 17:02:59 +0200 Subject: [PATCH] cool beans --- compiler/rustc_middle/src/query/mod.rs | 4 + .../src/traits/select/candidate_assembly.rs | 19 ++++- compiler/rustc_ty_utils/src/ty.rs | 9 ++ library/core/src/future/into_future.rs | 5 ++ library/core/src/iter/traits/collect.rs | 29 +++++++ .../substs-ppaux.normal.stderr | 11 +-- .../substs-ppaux.verbose.stderr | 11 +-- src/test/ui/async-await/issue-70594.stderr | 7 +- .../async-await/issues/issue-62009-1.stderr | 7 +- .../ui/async-await/unnecessary-await.stderr | 7 +- .../generic_const_exprs/issue-85848.stderr | 53 +----------- src/test/ui/error-codes/E0275.stderr | 10 +-- src/test/ui/for/for-c-in-str.stderr | 7 +- src/test/ui/for/for-loop-bogosity.stderr | 7 +- ...yield-outside-generator-issue-78653.stderr | 7 +- ...hod-unsatified-assoc-type-predicate.stderr | 21 ++--- .../normalize-under-binder/issue-89118.stderr | 27 ++---- src/test/ui/hrtb/issue-30786.stderr | 42 ++++------ .../ui/impl-trait/nested_impl_trait.stderr | 18 ++-- ...ction-mismatch-in-impl-where-clause.stderr | 20 ++--- src/test/ui/issues/issue-20413.stderr | 46 +++++----- src/test/ui/issues/issue-20605.stderr | 11 +-- src/test/ui/issues/issue-21596.stderr | 7 +- src/test/ui/issues/issue-33941.stderr | 24 ++---- src/test/ui/issues/issue-38821.stderr | 13 +-- src/test/ui/issues/issue-57843.stderr | 8 +- src/test/ui/iterators/integral.stderr | 84 ++++++++----------- src/test/ui/iterators/issue-28098.stderr | 14 ++-- src/test/ui/iterators/ranges.stderr | 10 +-- src/test/ui/iterators/string.stderr | 14 ++-- .../kindck/kindck-impl-type-params-2.stderr | 7 +- .../kindck-inherited-copy-bound.curr.stderr | 7 +- ...copy-bound.object_safe_for_dispatch.stderr | 7 +- src/test/ui/lifetimes/issue-79187-2.stderr | 68 ++++----------- .../ui/mismatched_types/cast-rfc0401.stderr | 18 +++- .../mismatched_types/closure-mismatch.stderr | 28 ++----- .../ui/parser/struct-literal-in-for.stderr | 7 +- src/test/ui/range/range-1.stderr | 17 +--- ...pecialization-trait-not-implemented.stderr | 21 +---- src/test/ui/specialization/issue-38091.stderr | 48 ++++++++--- src/test/ui/specialization/issue-39448.stderr | 33 ++++++-- .../min_specialization/issue-79224.stderr | 18 ++-- src/test/ui/suggestions/into-str.stderr | 13 +-- src/test/ui/suggestions/issue-62843.stderr | 4 +- src/test/ui/suggestions/issue-96555.stderr | 21 ++--- .../ui/suggestions/slice-issue-87994.stderr | 74 +++++----------- .../suggestions/suggest-remove-refs-1.stderr | 7 +- .../suggestions/suggest-remove-refs-2.stderr | 7 +- .../suggestions/suggest-remove-refs-3.stderr | 7 +- .../assoc-fn-bound-root-obligation.stderr | 11 ++- .../ui/traits/cycle-cache-err-60010.stderr | 25 +----- .../inductive-overflow/simultaneous.stderr | 15 ++-- .../inductive-overflow/supertrait.stderr | 15 ++-- .../inductive-overflow/two-traits.stderr | 9 +- .../suggest-deferences/root-obligation.fixed | 2 +- .../suggest-deferences/root-obligation.stderr | 12 +-- .../multiple-def-uses-in-one-fn.stderr | 10 ++- src/test/ui/typeck/issue-90101.stderr | 11 +-- src/test/ui/unsized/issue-71659.stderr | 5 +- .../ui/wf/hir-wf-check-erase-regions.stderr | 24 +++--- 60 files changed, 452 insertions(+), 651 deletions(-) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 466a0fc25f7d1..326acc23d251d 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1412,6 +1412,10 @@ rustc_queries! { separate_provide_extern } + query is_general_impl(def_id: DefId) -> bool { + desc { |tcx| "looking up whether `{}` is a general impl", tcx.def_path_str(def_id) } + } + query check_well_formed(key: LocalDefId) -> () { desc { |tcx| "checking that `{}` is well-formed", tcx.def_path_str(key.to_def_id()) } } diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 6e8581128dd8e..5a169e7658ecc 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -135,8 +135,23 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // candidate which assumes $0 == int, one that assumes `$0 == // usize`, etc. This spells an ambiguity. - let mut candidates = self.filter_impls(candidates, stack.obligation); - + let candidates = self.filter_impls(candidates, stack.obligation); + let mut candidates = candidates + .into_iter() + .map(|c| match c { + ImplCandidate(impl_def) if self.tcx().is_general_impl(impl_def) => { + match self.evaluate_candidate(stack, &c) { + Ok(eval) if eval.may_apply() => Ok(Some(c)), + Ok(_) => Ok(None), + Err(OverflowError::Canonical) => Err(Overflow(OverflowError::Canonical)), + Err(OverflowError::ErrorReporting) => Err(ErrorReporting), + Err(OverflowError::Error(e)) => Err(Overflow(OverflowError::Error(e))), + } + } + _ => Ok(Some(c)), + }) + .flat_map(Result::transpose) + .collect::, _>>()?; // If there is more than one candidate, first winnow them down // by considering extra conditions (nested obligations and so // forth). We don't winnow if there is exactly one diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index d542a9b599724..54a55511f8ac1 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -2,6 +2,7 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_middle::ty::subst::Subst; +use rustc_middle::ty::util::IgnoreRegions; use rustc_middle::ty::{ self, Binder, EarlyBinder, Predicate, PredicateKind, ToPredicate, Ty, TyCtxt, }; @@ -460,6 +461,13 @@ pub fn conservative_is_privately_uninhabited_raw<'tcx>( } } +fn is_general_impl(tcx: TyCtxt<'_>, id: DefId) -> bool { + let Some(trait_ref) = tcx.impl_trait_ref(id) else { + span_bug!(tcx.def_span(id), "expected impl, found `{:?} for `{:?}`", tcx.def_kind(id), id); + }; + tcx.uses_unique_generic_params(trait_ref.substs, IgnoreRegions::No).is_ok() +} + pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { asyncness, @@ -469,6 +477,7 @@ pub fn provide(providers: &mut ty::query::Providers) { instance_def_size_estimate, issue33140_self_ty, impl_defaultness, + is_general_impl, conservative_is_privately_uninhabited: conservative_is_privately_uninhabited_raw, ..*providers }; diff --git a/library/core/src/future/into_future.rs b/library/core/src/future/into_future.rs index 649b433877222..c1fb87af0bdf9 100644 --- a/library/core/src/future/into_future.rs +++ b/library/core/src/future/into_future.rs @@ -99,6 +99,11 @@ use crate::future::Future; /// } /// ``` #[stable(feature = "into_future", since = "1.64.0")] +#[rustc_on_unimplemented( + label = "`{Self}` cannot be converted to a future", + message = "`{Self}` cannot be converted to a future", + note = "{Self} must be a future or must implement `IntoFuture` to be awaited" +)] pub trait IntoFuture { /// The output that the future will produce on completion. #[stable(feature = "into_future", since = "1.64.0")] diff --git a/library/core/src/iter/traits/collect.rs b/library/core/src/iter/traits/collect.rs index 12ca508bed2b9..8a1ff8e1ff769 100644 --- a/library/core/src/iter/traits/collect.rs +++ b/library/core/src/iter/traits/collect.rs @@ -227,6 +227,35 @@ pub trait FromIterator: Sized { /// ``` #[rustc_diagnostic_item = "IntoIterator"] #[rustc_skip_array_during_method_dispatch] +#[rustc_on_unimplemented( + on( + _Self = "std::ops::RangeTo", + label = "if you meant to iterate until a value, add a starting value", + note = "`..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a \ + bounded `Range`: `0..end`" + ), + on( + _Self = "std::ops::RangeToInclusive", + label = "if you meant to iterate until a value (including it), add a starting value", + note = "`..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant \ + to have a bounded `RangeInclusive`: `0..=end`" + ), + on( + _Self = "&str", + label = "cannot implicitly convert `{Self}` to an iterator; try calling `.chars()` or `.bytes()`" + ), + on( + _Self = "std::string::String", + label = "cannot implicitly convert `{Self}` to an iterator; try calling `.chars()` or `.bytes()`" + ), + on( + _Self = "{integral}", + note = "if you want to iterate between `start` until a value `end`, use the exclusive range \ + syntax `start..end` or the inclusive range syntax `start..=end`" + ), + label = "`{Self}` cannot be converted to an iterator", + message = "`{Self}` cannot be converted to an iterator" +)] #[stable(feature = "rust1", since = "1.0.0")] pub trait IntoIterator { /// The type of the elements being iterated over. diff --git a/src/test/ui/associated-types/substs-ppaux.normal.stderr b/src/test/ui/associated-types/substs-ppaux.normal.stderr index 085c56870b365..b13a599ab1290 100644 --- a/src/test/ui/associated-types/substs-ppaux.normal.stderr +++ b/src/test/ui/associated-types/substs-ppaux.normal.stderr @@ -70,18 +70,11 @@ help: use parentheses to call this function LL | let x: () = foo::<'static>(); | ++ -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `str: Foo<'_, '_, u8>` is not satisfied --> $DIR/substs-ppaux.rs:49:5 | LL | >::bar; - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` -note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str` - --> $DIR/substs-ppaux.rs:11:17 - | -LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} - | ^^^^^^^^^^^^^^ ^ + | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<'_, '_, u8>` is not implemented for `str` error: aborting due to 5 previous errors diff --git a/src/test/ui/associated-types/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr index b831f3b7a76d2..ec02375e55e09 100644 --- a/src/test/ui/associated-types/substs-ppaux.verbose.stderr +++ b/src/test/ui/associated-types/substs-ppaux.verbose.stderr @@ -70,18 +70,11 @@ help: use parentheses to call this function LL | let x: () = foo::<'static>(); | ++ -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0277]: the trait bound `str: Foo<'_#0r, '_#1r, u8>` is not satisfied --> $DIR/substs-ppaux.rs:49:5 | LL | >::bar; - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` -note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str` - --> $DIR/substs-ppaux.rs:11:17 - | -LL | impl<'a,'b,T,S> Foo<'a, 'b, S> for T {} - | ^^^^^^^^^^^^^^ ^ + | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<'_#0r, '_#1r, u8>` is not implemented for `str` error: aborting due to 5 previous errors diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index a88bce6cc99a9..4578fbded1c11 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -18,15 +18,14 @@ error[E0744]: `.await` is not allowed in a `const` LL | [1; ().await]; | ^^^^^^ -error[E0277]: `()` is not a future +error[E0277]: `()` cannot be converted to a future --> $DIR/issue-70594.rs:4:11 | LL | [1; ().await]; - | ^^^^^^ `()` is not a future + | ^^^^^^ `()` cannot be converted to a future | - = help: the trait `Future` is not implemented for `()` + = help: the trait `IntoFuture` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` help: remove the `.await` | LL - [1; ().await]; diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr index 5cbbf89a222a7..02a9441e981a0 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -24,15 +24,14 @@ LL | fn main() { LL | (|_| 2333).await; | ^^^^^^ only allowed inside `async` functions and blocks -error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future +error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` cannot be converted to a future --> $DIR/issue-62009-1.rs:12:15 | LL | (|_| 2333).await; - | ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future + | ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` cannot be converted to a future | - = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` + = help: the trait `IntoFuture` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` = note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` help: remove the `.await` | LL - (|_| 2333).await; diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr index e7e61c2baaf04..0ddeca03b7658 100644 --- a/src/test/ui/async-await/unnecessary-await.stderr +++ b/src/test/ui/async-await/unnecessary-await.stderr @@ -1,14 +1,13 @@ -error[E0277]: `()` is not a future +error[E0277]: `()` cannot be converted to a future --> $DIR/unnecessary-await.rs:9:10 | LL | boo().await; - | -----^^^^^^ `()` is not a future + | -----^^^^^^ `()` cannot be converted to a future | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()` + = help: the trait `IntoFuture` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` help: remove the `.await` | LL - boo().await; diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr index d45dfde9a791a..7dee123fc582b 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr @@ -1,63 +1,18 @@ -error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied +error[E0277]: the trait bound `&C: Delegates<()>` is not satisfied --> $DIR/issue-85848.rs:24:29 | LL | writes_to_specific_path(&cap); - | ----------------------- ^^^^ the trait `_Contains<&C>` is not implemented for `()` + | ----------------------- ^^^^ the trait `Delegates<()>` is not implemented for `&C` | | | required by a bound introduced by this call | = help: the trait `Delegates` is implemented for `T` -note: required because of the requirements on the impl of `Contains<(), true>` for `&C` - --> $DIR/issue-85848.rs:21:12 - | -LL | impl Contains() }> for U where T: _Contains {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required because of the requirements on the impl of `Delegates<()>` for `&C` - --> $DIR/issue-85848.rs:12:12 - | -LL | impl Delegates for T where T: Contains {} - | ^^^^^^^^^^^^ ^ -note: required by a bound in `writes_to_specific_path` - --> $DIR/issue-85848.rs:30:31 - | -LL | fn writes_to_specific_path>(cap: &C) {} - | ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path` - -error: unconstrained generic constant - --> $DIR/issue-85848.rs:24:29 - | -LL | writes_to_specific_path(&cap); - | ----------------------- ^^^^ - | | - | required by a bound introduced by this call - | - = help: try adding a `where` bound using this expression: `where [(); { contains::() }]:` -note: required because of the requirements on the impl of `Contains<(), true>` for `&C` - --> $DIR/issue-85848.rs:21:12 - | -LL | impl Contains() }> for U where T: _Contains {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required because of the requirements on the impl of `Delegates<()>` for `&C` - --> $DIR/issue-85848.rs:12:12 - | -LL | impl Delegates for T where T: Contains {} - | ^^^^^^^^^^^^ ^ note: required by a bound in `writes_to_specific_path` --> $DIR/issue-85848.rs:30:31 | LL | fn writes_to_specific_path>(cap: &C) {} | ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path` -error[E0308]: mismatched types - --> $DIR/issue-85848.rs:24:5 - | -LL | writes_to_specific_path(&cap); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `{ contains::() }` - | - = note: expected type `true` - found type `{ contains::() }` - -error: aborting due to 3 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index dfffbb182ad31..56da0bc2e23eb 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,17 +1,17 @@ -error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` - --> $DIR/E0275.rs:5:33 +error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/E0275.rs:5:9 | LL | impl Foo for T where Bar: Foo {} - | ^^^ + | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) -note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +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 `Bar` + = note: required because of the requirements on the impl of `Foo` for `T` error: aborting due to previous error diff --git a/src/test/ui/for/for-c-in-str.stderr b/src/test/ui/for/for-c-in-str.stderr index 07ddc8ea78f39..84e8c078dd706 100644 --- a/src/test/ui/for/for-c-in-str.stderr +++ b/src/test/ui/for/for-c-in-str.stderr @@ -1,11 +1,10 @@ -error[E0277]: `&str` is not an iterator +error[E0277]: `&str` cannot be converted to an iterator --> $DIR/for-c-in-str.rs:4:14 | LL | for c in "asdf" { - | ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` + | ^^^^^^ cannot implicitly convert `&str` to an iterator; try calling `.chars()` or `.bytes()` | - = help: the trait `Iterator` is not implemented for `&str` - = note: required because of the requirements on the impl of `IntoIterator` for `&str` + = help: the trait `IntoIterator` is not implemented for `&str` error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-bogosity.stderr b/src/test/ui/for/for-loop-bogosity.stderr index 0bdd75b3555be..9f982d571d1ba 100644 --- a/src/test/ui/for/for-loop-bogosity.stderr +++ b/src/test/ui/for/for-loop-bogosity.stderr @@ -1,11 +1,10 @@ -error[E0277]: `MyStruct` is not an iterator +error[E0277]: `MyStruct` cannot be converted to an iterator --> $DIR/for-loop-bogosity.rs:17:14 | LL | for x in bogus { - | ^^^^^ `MyStruct` is not an iterator + | ^^^^^ `MyStruct` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `MyStruct` - = note: required because of the requirements on the impl of `IntoIterator` for `MyStruct` + = help: the trait `IntoIterator` is not implemented for `MyStruct` error: aborting due to previous error diff --git a/src/test/ui/generator/yield-outside-generator-issue-78653.stderr b/src/test/ui/generator/yield-outside-generator-issue-78653.stderr index ee1afbe5b5843..23e74cd9ec9ce 100644 --- a/src/test/ui/generator/yield-outside-generator-issue-78653.stderr +++ b/src/test/ui/generator/yield-outside-generator-issue-78653.stderr @@ -4,15 +4,14 @@ error[E0627]: yield expression outside of generator literal LL | yield || for i in 0 { } | ^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: `{integer}` is not an iterator +error[E0277]: `{integer}` cannot be converted to an iterator --> $DIR/yield-outside-generator-issue-78653.rs:4:23 | LL | yield || for i in 0 { } - | ^ `{integer}` is not an iterator + | ^ `{integer}` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `{integer}` + = help: the trait `IntoIterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `{integer}` error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr index d9dc77ac8eb40..75f1c7dc374cb 100644 --- a/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ b/src/test/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr @@ -1,23 +1,18 @@ -error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied +error[E0599]: no method named `f` found for struct `S` in the current scope --> $DIR/method-unsatified-assoc-type-predicate.rs:30:7 | LL | struct S; - | -------- - | | - | method `f` not found for this struct - | doesn't satisfy `::Y = i32` - | doesn't satisfy `S: M` + | -------- method `f` not found for this struct ... LL | a.f(); - | ^ method cannot be called on `S` due to unsatisfied trait bounds + | ^ method not found in `S` | -note: trait bound `::Y = i32` was not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:14:11 + = help: items from traits can only be used if the trait is implemented and in scope +note: `M` defines an item `f`, perhaps you need to implement it + --> $DIR/method-unsatified-assoc-type-predicate.rs:10:1 | -LL | impl = i32>> M for T {} - | ^^^^^^^^^^^^ - - - | | - | unsatisfied trait bound introduced here +LL | trait M { + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr index a6858154dfb29..7537a4e525d29 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr @@ -1,14 +1,9 @@ -error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied +error[E0277]: the trait bound `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` is not satisfied --> $DIR/issue-89118.rs:19:8 | LL | C: StackContext, - | ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` + | ^^^^^^^^^^^^ the trait `for<'a> BufferUdpStateContext<&'a ()>` is not implemented for `Ctx<()>` | -note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` - --> $DIR/issue-89118.rs:5:23 - | -LL | impl BufferUdpStateContext for C {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ note: required by a bound in `StackContext` --> $DIR/issue-89118.rs:9:14 | @@ -18,17 +13,12 @@ LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` -error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied +error[E0277]: the trait bound `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` is not satisfied --> $DIR/issue-89118.rs:29:9 | LL | impl EthernetWorker {} - | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` - | -note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` - --> $DIR/issue-89118.rs:5:23 + | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferUdpStateContext<&'a ()>` is not implemented for `Ctx<()>` | -LL | impl BufferUdpStateContext for C {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ note: required by a bound in `EthernetWorker` --> $DIR/issue-89118.rs:28:14 | @@ -38,17 +28,12 @@ LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker` -error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied +error[E0277]: the trait bound `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` is not satisfied --> $DIR/issue-89118.rs:22:20 | LL | type Handler = Ctx; - | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` - | -note: required because of the requirements on the impl of `for<'a> BufferUdpStateContext<&'a ()>` for `Ctx<()>` - --> $DIR/issue-89118.rs:5:23 + | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferUdpStateContext<&'a ()>` is not implemented for `Ctx<()>` | -LL | impl BufferUdpStateContext for C {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ ^ note: required by a bound in `StackContext` --> $DIR/issue-89118.rs:9:14 | diff --git a/src/test/ui/hrtb/issue-30786.stderr b/src/test/ui/hrtb/issue-30786.stderr index bc7b5e914e127..b14542a3c0d11 100644 --- a/src/test/ui/hrtb/issue-30786.stderr +++ b/src/test/ui/hrtb/issue-30786.stderr @@ -1,48 +1,38 @@ -error[E0599]: the method `filterx` exists for struct `Map`, but its trait bounds were not satisfied +error[E0599]: no method named `filterx` found for struct `Map` in the current scope --> $DIR/issue-30786.rs:118:22 | LL | pub struct Map { - | -------------------- - | | - | method `filterx` not found for this struct - | doesn't satisfy `_: StreamExt` + | -------------------- method `filterx` not found for this struct ... LL | let filter = map.filterx(|x: &_| true); - | ^^^^^^^ method cannot be called on `Map` due to unsatisfied trait bounds + | ^^^^^^^ method not found in `Map` | -note: the following trait bounds were not satisfied: - `&'a mut &Map: Stream` - `&'a mut &mut Map: Stream` - `&'a mut Map: Stream` - --> $DIR/issue-30786.rs:96:50 + = help: items from traits can only be used if the trait is implemented and in scope +note: `StreamExt` defines an item `filterx`, perhaps you need to implement it + --> $DIR/issue-30786.rs:64:1 | -LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} - | --------- - ^^^^^^ unsatisfied trait bound introduced here +LL | pub trait StreamExt + | ^^^^^^^^^^^^^^^^^^^ help: one of the expressions' fields has a method of the same name | LL | let filter = map.stream.filterx(|x: &_| true); | +++++++ -error[E0599]: the method `countx` exists for struct `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>`, but its trait bounds were not satisfied +error[E0599]: no method named `countx` found for struct `Filter` in the current scope --> $DIR/issue-30786.rs:130:24 | LL | pub struct Filter { - | ----------------------- - | | - | method `countx` not found for this struct - | doesn't satisfy `_: StreamExt` + | ----------------------- method `countx` not found for this struct ... LL | let count = filter.countx(); - | ^^^^^^ method cannot be called on `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>` due to unsatisfied trait bounds + | ^^^^^^ method not found in `Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>` | -note: the following trait bounds were not satisfied: - `&'a mut &Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - `&'a mut &mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - `&'a mut Filter fn(&'r u64) -> &'r u64 {identity::}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream` - --> $DIR/issue-30786.rs:96:50 + = help: items from traits can only be used if the trait is implemented and in scope +note: `StreamExt` defines an item `countx`, perhaps you need to implement it + --> $DIR/issue-30786.rs:64:1 | -LL | impl StreamExt for T where for<'a> &'a mut T: Stream {} - | --------- - ^^^^^^ unsatisfied trait bound introduced here +LL | pub trait StreamExt + | ^^^^^^^^^^^^^^^^^^^ help: one of the expressions' fields has a method of the same name | LL | let count = filter.stream.countx(); diff --git a/src/test/ui/impl-trait/nested_impl_trait.stderr b/src/test/ui/impl-trait/nested_impl_trait.stderr index bb4ae5e828254..27d864be298a3 100644 --- a/src/test/ui/impl-trait/nested_impl_trait.stderr +++ b/src/test/ui/impl-trait/nested_impl_trait.stderr @@ -46,23 +46,21 @@ error[E0562]: `impl Trait` only allowed in function and inherent method return t LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into { | ^^^^^^^^^^^^^^ -error[E0277]: the trait bound `impl Debug: From>` is not satisfied +error[E0277]: the trait bound `impl Into: Into` is not satisfied --> $DIR/nested_impl_trait.rs:5:46 | LL | fn bad_in_ret_position(x: impl Into) -> impl Into { x } - | ^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `impl Debug` - | - = help: the trait `Into` is implemented for `T` - = note: required because of the requirements on the impl of `Into` for `impl Into` + | ^^^^^^^^^^^^^^^^^^^^^ - return type was inferred to be `impl Into` here + | | + | the trait `Into` is not implemented for `impl Into` -error[E0277]: the trait bound `impl Debug: From>` is not satisfied +error[E0277]: the trait bound `impl Into: Into` is not satisfied --> $DIR/nested_impl_trait.rs:18:34 | LL | fn bad(x: impl Into) -> impl Into { x } - | ^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `impl Debug` - | - = help: the trait `Into` is implemented for `T` - = note: required because of the requirements on the impl of `Into` for `impl Into` + | ^^^^^^^^^^^^^^^^^^^^^ - return type was inferred to be `impl Into` here + | | + | the trait `Into` is not implemented for `impl Into` error: aborting due to 8 previous errors diff --git a/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr b/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr index ade0dfa1bb3b3..db2c1f37c5fd8 100644 --- a/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr +++ b/src/test/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr @@ -1,20 +1,12 @@ -error[E0271]: type mismatch resolving `<() as Super>::Assoc == ()` +error[E0277]: the trait bound `(): Test` is not satisfied --> $DIR/projection-mismatch-in-impl-where-clause.rs:13:14 | LL | fn test() -> impl Test { - | ^^^^^^^^^ type mismatch resolving `<() as Super>::Assoc == ()` - | -note: expected this to be `u8` - --> $DIR/projection-mismatch-in-impl-where-clause.rs:6:18 - | -LL | type Assoc = u8; - | ^^ -note: required because of the requirements on the impl of `Test` for `()` - --> $DIR/projection-mismatch-in-impl-where-clause.rs:11:9 - | -LL | impl Test for T where T: Super {} - | ^^^^ ^ + | ^^^^^^^^^ the trait `Test` is not implemented for `()` +LL | +LL | () + | -- return type was inferred to be `()` here error: aborting due to previous error -For more information about this error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index ea493c58a33f6..04b41d3d5d0d6 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -7,60 +7,60 @@ LL | struct NoData; = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T` to be a const parameter, use `const T: usize` instead -error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` - --> $DIR/issue-20413.rs:8:36 +error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/issue-20413.rs:8:9 | LL | impl Foo for T where NoData: Foo { - | ^^^ + | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` +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 `NoData` + = note: required because of the requirements on the impl of `Foo` for `T` -error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` - --> $DIR/issue-20413.rs:27:42 +error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` + --> $DIR/issue-20413.rs:27:9 | LL | impl Bar for T where EvenLessData: Baz { - | ^^^ + | ^^^ | = help: consider increasing the recursion limit by 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:27: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:34: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:27:9 + | +LL | impl Bar for T where EvenLessData: Baz { + | ^^^ ^ = note: 126 redundant requirements hidden - = note: required because of the requirements on the impl of `Baz` for `EvenLessData` + = note: required because of the requirements on the impl of `Bar` for `T` -error[E0275]: overflow evaluating the requirement `AlmostNoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Bar` - --> $DIR/issue-20413.rs:34:42 +error[E0275]: overflow evaluating the requirement `EvenLessData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Baz` + --> $DIR/issue-20413.rs:34:9 | LL | impl Baz for T where AlmostNoData: Bar { - | ^^^ + | ^^^ | = help: consider increasing the recursion limit by 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:34: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:27: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:34:9 + | +LL | impl Baz for T where AlmostNoData: Bar { + | ^^^ ^ = note: 126 redundant requirements hidden - = note: required because of the requirements on the impl of `Bar` for `AlmostNoData` + = note: required because of the requirements on the impl of `Baz` for `T` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-20605.stderr b/src/test/ui/issues/issue-20605.stderr index 41eefe3f8e9b5..fe2ecf1075398 100644 --- a/src/test/ui/issues/issue-20605.stderr +++ b/src/test/ui/issues/issue-20605.stderr @@ -1,15 +1,10 @@ -error[E0277]: the size for values of type `dyn Iterator` cannot be known at compilation time +error[E0277]: `dyn Iterator` cannot be converted to an iterator --> $DIR/issue-20605.rs:2:17 | LL | for item in *things { *item = 0 } - | ^^^^^^^ expected an implementor of trait `IntoIterator` + | ^^^^^^^ `dyn Iterator` cannot be converted to an iterator | - = note: the trait bound `dyn Iterator: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator` -help: consider mutably borrowing here - | -LL | for item in &mut *things { *item = 0 } - | ++++ + = help: the trait `IntoIterator` is not implemented for `dyn Iterator` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21596.stderr b/src/test/ui/issues/issue-21596.stderr index a336d1b0ed55d..cb6dfca22eebb 100644 --- a/src/test/ui/issues/issue-21596.stderr +++ b/src/test/ui/issues/issue-21596.stderr @@ -1,14 +1,11 @@ -error[E0599]: `*const u8` doesn't implement `std::fmt::Display` +error[E0599]: no method named `to_string` found for raw pointer `*const u8` in the current scope --> $DIR/issue-21596.rs:4:22 | LL | println!("{}", z.to_string()); - | ^^^^^^^^^ `*const u8` cannot be formatted with the default formatter + | ^^^^^^^^^ method not found in `*const u8` | = note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref = note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior - = note: the following trait bounds were not satisfied: - `*const u8: std::fmt::Display` - which is required by `*const u8: ToString` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index e1ce6eed98efb..aa112d3dcb038 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -12,27 +12,15 @@ note: required by a bound in `cloned` LL | Self: Sized + Iterator, | ^^^^^^^^^^^^ required by this bound in `cloned` -error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` - --> $DIR/issue-33941.rs:6:14 - | -LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference - | - = note: expected tuple `(&_, &_)` - found reference `&_` - = note: required because of the requirements on the impl of `Iterator` for `Cloned>` - = note: required because of the requirements on the impl of `IntoIterator` for `Cloned>` - -error[E0271]: type mismatch resolving ` as Iterator>::Item == &_` +error[E0277]: `Cloned>` cannot be converted to an iterator --> $DIR/issue-33941.rs:6:14 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Cloned>` cannot be converted to an iterator | - = note: expected tuple `(&_, &_)` - found reference `&_` - = note: required because of the requirements on the impl of `Iterator` for `Cloned>` + = help: the trait `IntoIterator` is not implemented for `Cloned>` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issues/issue-38821.stderr b/src/test/ui/issues/issue-38821.stderr index cdf1f0dfc5361..a5d2a35fd11c9 100644 --- a/src/test/ui/issues/issue-38821.stderr +++ b/src/test/ui/issues/issue-38821.stderr @@ -1,19 +1,14 @@ -error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied +error[E0277]: the trait bound `::SqlType: IntoNullable` is not satisfied --> $DIR/issue-38821.rs:23:17 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^ the trait `NotNull` is not implemented for `::SqlType` + | ^^^^ the trait `IntoNullable` is not implemented for `::SqlType` | -note: required because of the requirements on the impl of `IntoNullable` for `::SqlType` - --> $DIR/issue-38821.rs:9:18 - | -LL | impl IntoNullable for T { - | ^^^^^^^^^^^^ ^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting the associated type | -LL | Expr: Expression::Nullable>, ::SqlType: NotNull, - | +++++++++++++++++++++++++++++++++++++++ +LL | Expr: Expression::Nullable>, ::SqlType: IntoNullable, + | ++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-57843.stderr b/src/test/ui/issues/issue-57843.stderr index 2ab49ec61cf59..3e6b0a958b2ce 100644 --- a/src/test/ui/issues/issue-57843.stderr +++ b/src/test/ui/issues/issue-57843.stderr @@ -1,11 +1,11 @@ -error: implementation of `FnOnce` is not general enough +error[E0277]: the trait bound `for<'a> [closure@$DIR/issue-57843.rs:25:18: 25:21]: ClonableFn<&'a bool>` is not satisfied --> $DIR/issue-57843.rs:25:9 | LL | Foo(Box::new(|_| ())); - | ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | ^^^^^^^^^^^^^^^^ the trait `for<'a> ClonableFn<&'a bool>` is not implemented for `[closure@$DIR/issue-57843.rs:25:18: 25:21]` | - = note: closure with signature `fn(&'2 bool)` must implement `FnOnce<(&'1 bool,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 bool,)>`, for some specific lifetime `'2` + = note: required for the cast from `[closure@$DIR/issue-57843.rs:25:18: 25:21]` to the object type `dyn for<'a> ClonableFn<&'a bool>` error: aborting due to previous error +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/iterators/integral.stderr b/src/test/ui/iterators/integral.stderr index 5e2744bab95c1..a66be3a615393 100644 --- a/src/test/ui/iterators/integral.stderr +++ b/src/test/ui/iterators/integral.stderr @@ -1,121 +1,109 @@ -error[E0277]: `{integer}` is not an iterator +error[E0277]: `{integer}` cannot be converted to an iterator --> $DIR/integral.rs:2:14 | LL | for _ in 42 {} - | ^^ `{integer}` is not an iterator + | ^^ `{integer}` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `{integer}` + = help: the trait `IntoIterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `{integer}` -error[E0277]: `u8` is not an iterator +error[E0277]: `u8` cannot be converted to an iterator --> $DIR/integral.rs:4:14 | LL | for _ in 42 as u8 {} - | ^^^^^^^^ `u8` is not an iterator + | ^^^^^^^^ `u8` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `u8` + = help: the trait `IntoIterator` is not implemented for `u8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u8` -error[E0277]: `i8` is not an iterator +error[E0277]: `i8` cannot be converted to an iterator --> $DIR/integral.rs:6:14 | LL | for _ in 42 as i8 {} - | ^^^^^^^^ `i8` is not an iterator + | ^^^^^^^^ `i8` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `i8` + = help: the trait `IntoIterator` is not implemented for `i8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i8` -error[E0277]: `u16` is not an iterator +error[E0277]: `u16` cannot be converted to an iterator --> $DIR/integral.rs:8:14 | LL | for _ in 42 as u16 {} - | ^^^^^^^^^ `u16` is not an iterator + | ^^^^^^^^^ `u16` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `u16` + = help: the trait `IntoIterator` is not implemented for `u16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u16` -error[E0277]: `i16` is not an iterator +error[E0277]: `i16` cannot be converted to an iterator --> $DIR/integral.rs:10:14 | LL | for _ in 42 as i16 {} - | ^^^^^^^^^ `i16` is not an iterator + | ^^^^^^^^^ `i16` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `i16` + = help: the trait `IntoIterator` is not implemented for `i16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i16` -error[E0277]: `u32` is not an iterator +error[E0277]: `u32` cannot be converted to an iterator --> $DIR/integral.rs:12:14 | LL | for _ in 42 as u32 {} - | ^^^^^^^^^ `u32` is not an iterator + | ^^^^^^^^^ `u32` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `u32` + = help: the trait `IntoIterator` is not implemented for `u32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u32` -error[E0277]: `i32` is not an iterator +error[E0277]: `i32` cannot be converted to an iterator --> $DIR/integral.rs:14:14 | LL | for _ in 42 as i32 {} - | ^^^^^^^^^ `i32` is not an iterator + | ^^^^^^^^^ `i32` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `i32` + = help: the trait `IntoIterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i32` -error[E0277]: `u64` is not an iterator +error[E0277]: `u64` cannot be converted to an iterator --> $DIR/integral.rs:16:14 | LL | for _ in 42 as u64 {} - | ^^^^^^^^^ `u64` is not an iterator + | ^^^^^^^^^ `u64` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `u64` + = help: the trait `IntoIterator` is not implemented for `u64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `u64` -error[E0277]: `i64` is not an iterator +error[E0277]: `i64` cannot be converted to an iterator --> $DIR/integral.rs:18:14 | LL | for _ in 42 as i64 {} - | ^^^^^^^^^ `i64` is not an iterator + | ^^^^^^^^^ `i64` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `i64` + = help: the trait `IntoIterator` is not implemented for `i64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `i64` -error[E0277]: `usize` is not an iterator +error[E0277]: `usize` cannot be converted to an iterator --> $DIR/integral.rs:20:14 | LL | for _ in 42 as usize {} - | ^^^^^^^^^^^ `usize` is not an iterator + | ^^^^^^^^^^^ `usize` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `usize` + = help: the trait `IntoIterator` is not implemented for `usize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `usize` -error[E0277]: `isize` is not an iterator +error[E0277]: `isize` cannot be converted to an iterator --> $DIR/integral.rs:22:14 | LL | for _ in 42 as isize {} - | ^^^^^^^^^^^ `isize` is not an iterator + | ^^^^^^^^^^^ `isize` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `isize` + = help: the trait `IntoIterator` is not implemented for `isize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `isize` -error[E0277]: `{float}` is not an iterator +error[E0277]: `{float}` cannot be converted to an iterator --> $DIR/integral.rs:24:14 | LL | for _ in 42.0 {} - | ^^^^ `{float}` is not an iterator + | ^^^^ `{float}` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `{float}` - = note: required because of the requirements on the impl of `IntoIterator` for `{float}` + = help: the trait `IntoIterator` is not implemented for `{float}` error: aborting due to 12 previous errors diff --git a/src/test/ui/iterators/issue-28098.stderr b/src/test/ui/iterators/issue-28098.stderr index 3beb9929244bf..0e5299dec56fd 100644 --- a/src/test/ui/iterators/issue-28098.stderr +++ b/src/test/ui/iterators/issue-28098.stderr @@ -8,14 +8,13 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` -error[E0277]: `bool` is not an iterator +error[E0277]: `bool` cannot be converted to an iterator --> $DIR/issue-28098.rs:6:14 | LL | for _ in false {} - | ^^^^^ `bool` is not an iterator + | ^^^^^ `bool` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `bool` - = note: required because of the requirements on the impl of `IntoIterator` for `bool` + = help: the trait `IntoIterator` is not implemented for `bool` error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:9:28 @@ -55,14 +54,13 @@ LL | let _ = Iterator::next(&mut ()); | = help: the trait `Iterator` is not implemented for `()` -error[E0277]: `bool` is not an iterator +error[E0277]: `bool` cannot be converted to an iterator --> $DIR/issue-28098.rs:25:14 | LL | for _ in false {} - | ^^^^^ `bool` is not an iterator + | ^^^^^ `bool` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `bool` - = note: required because of the requirements on the impl of `IntoIterator` for `bool` + = help: the trait `IntoIterator` is not implemented for `bool` error[E0277]: `()` is not an iterator --> $DIR/issue-28098.rs:18:13 diff --git a/src/test/ui/iterators/ranges.stderr b/src/test/ui/iterators/ranges.stderr index 440a8960a4ca3..7600e6656babb 100644 --- a/src/test/ui/iterators/ranges.stderr +++ b/src/test/ui/iterators/ranges.stderr @@ -1,22 +1,20 @@ -error[E0277]: `RangeTo<{integer}>` is not an iterator +error[E0277]: `RangeTo<{integer}>` cannot be converted to an iterator --> $DIR/ranges.rs:2:14 | LL | for _ in ..10 {} | ^^^^ if you meant to iterate until a value, add a starting value | - = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>` + = help: the trait `IntoIterator` is not implemented for `RangeTo<{integer}>` = note: `..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a bounded `Range`: `0..end` - = note: required because of the requirements on the impl of `IntoIterator` for `RangeTo<{integer}>` -error[E0277]: `RangeToInclusive<{integer}>` is not an iterator +error[E0277]: `RangeToInclusive<{integer}>` cannot be converted to an iterator --> $DIR/ranges.rs:4:14 | LL | for _ in ..=10 {} | ^^^^^ if you meant to iterate until a value (including it), add a starting value | - = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>` + = help: the trait `IntoIterator` is not implemented for `RangeToInclusive<{integer}>` = note: `..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant to have a bounded `RangeInclusive`: `0..=end` - = note: required because of the requirements on the impl of `IntoIterator` for `RangeToInclusive<{integer}>` error: aborting due to 2 previous errors diff --git a/src/test/ui/iterators/string.stderr b/src/test/ui/iterators/string.stderr index d9c40fe1ba6a4..d2b4098c43286 100644 --- a/src/test/ui/iterators/string.stderr +++ b/src/test/ui/iterators/string.stderr @@ -1,20 +1,18 @@ -error[E0277]: `String` is not an iterator +error[E0277]: `String` cannot be converted to an iterator --> $DIR/string.rs:2:14 | LL | for _ in "".to_owned() {} - | ^^^^^^^^^^^^^ `String` is not an iterator; try calling `.chars()` or `.bytes()` + | ^^^^^^^^^^^^^ cannot implicitly convert `String` to an iterator; try calling `.chars()` or `.bytes()` | - = help: the trait `Iterator` is not implemented for `String` - = note: required because of the requirements on the impl of `IntoIterator` for `String` + = help: the trait `IntoIterator` is not implemented for `String` -error[E0277]: `&str` is not an iterator +error[E0277]: `&str` cannot be converted to an iterator --> $DIR/string.rs:4:14 | LL | for _ in "" {} - | ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` + | ^^ cannot implicitly convert `&str` to an iterator; try calling `.chars()` or `.bytes()` | - = help: the trait `Iterator` is not implemented for `&str` - = note: required because of the requirements on the impl of `IntoIterator` for `&str` + = help: the trait `IntoIterator` is not implemented for `&str` error: aborting due to 2 previous errors diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.stderr b/src/test/ui/kindck/kindck-impl-type-params-2.stderr index 89975e9683dbf..02dccf165e151 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params-2.stderr @@ -2,15 +2,10 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-impl-type-params-2.rs:13:16 | LL | take_param(&x); - | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` + | ---------- ^^ the trait `Foo` is not implemented for `Box<{integer}>` | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Foo` for `Box<{integer}>` - --> $DIR/kindck-impl-type-params-2.rs:6:14 - | -LL | impl Foo for T { - | ^^^ ^ note: required by a bound in `take_param` --> $DIR/kindck-impl-type-params-2.rs:9:17 | diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr index 016cd393c8591..32ff8418b3fbe 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.curr.stderr @@ -2,15 +2,10 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | LL | take_param(&x); - | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` + | ---------- ^^ the trait `Foo` is not implemented for `Box<{integer}>` | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Foo` for `Box<{integer}>` - --> $DIR/kindck-inherited-copy-bound.rs:14:14 - | -LL | impl Foo for T { - | ^^^ ^ note: required by a bound in `take_param` --> $DIR/kindck-inherited-copy-bound.rs:17:17 | diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr index eaf34dff41bf0..5e431064f07b2 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.object_safe_for_dispatch.stderr @@ -2,15 +2,10 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | LL | take_param(&x); - | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` + | ---------- ^^ the trait `Foo` is not implemented for `Box<{integer}>` | | | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Foo` for `Box<{integer}>` - --> $DIR/kindck-inherited-copy-bound.rs:14:14 - | -LL | impl Foo for T { - | ^^^ ^ note: required by a bound in `take_param` --> $DIR/kindck-inherited-copy-bound.rs:17:17 | diff --git a/src/test/ui/lifetimes/issue-79187-2.stderr b/src/test/ui/lifetimes/issue-79187-2.stderr index 9322e617176a1..c92a269b26529 100644 --- a/src/test/ui/lifetimes/issue-79187-2.stderr +++ b/src/test/ui/lifetimes/issue-79187-2.stderr @@ -1,77 +1,41 @@ -error: lifetime may not live long enough - --> $DIR/issue-79187-2.rs:11:24 - | -LL | take_foo(|a: &i32| a); - | - - ^ returning this value requires that `'1` must outlive `'2` - | | | - | | return type of closure is &'2 i32 - | let's call the lifetime of this reference `'1` - -error: lifetime may not live long enough - --> $DIR/issue-79187-2.rs:14:34 - | -LL | take_foo(|a: &i32| -> &i32 { a }); - | - - ^ returning this value requires that `'1` must outlive `'2` - | | | - | | let's call the lifetime of this reference `'2` - | let's call the lifetime of this reference `'1` - -error: implementation of `FnOnce` is not general enough +error[E0277]: the trait bound `[closure@$DIR/issue-79187-2.rs:8:14: 8:17]: Foo` is not satisfied --> $DIR/issue-79187-2.rs:8:5 | LL | take_foo(|a| a); - | ^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | ^^^^^^^^ --- consider calling this closure + | | + | the trait `Foo` is not implemented for `[closure@$DIR/issue-79187-2.rs:8:14: 8:17]` | - = note: closure with signature `fn(&'2 i32) -> &i32` must implement `FnOnce<(&'1 i32,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 i32,)>`, for some specific lifetime `'2` - -error[E0308]: mismatched types - --> $DIR/issue-79187-2.rs:8:5 - | -LL | take_foo(|a| a); - | ^^^^^^^^^^^^^^^ one type is more general than the other - | - = note: expected trait `for<'r> Fn<(&'r i32,)>` - found trait `Fn<(&i32,)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/issue-79187-2.rs:8:14 - | -LL | take_foo(|a| a); - | ^^^ -note: the lifetime requirement is introduced here +note: required by a bound in `take_foo` --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | ^^^ + | ^^^ required by this bound in `take_foo` -error[E0308]: mismatched types +error[E0277]: the trait bound `[closure@$DIR/issue-79187-2.rs:11:14: 11:23]: Foo` is not satisfied --> $DIR/issue-79187-2.rs:11:5 | LL | take_foo(|a: &i32| a); - | ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^ the trait `Foo` is not implemented for `[closure@$DIR/issue-79187-2.rs:11:14: 11:23]` | - = note: expected reference `&i32` - found reference `&i32` -note: the lifetime requirement is introduced here +note: required by a bound in `take_foo` --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | ^^^ + | ^^^ required by this bound in `take_foo` -error[E0308]: mismatched types +error[E0277]: the trait bound `[closure@$DIR/issue-79187-2.rs:14:14: 14:31]: Foo` is not satisfied --> $DIR/issue-79187-2.rs:14:5 | LL | take_foo(|a: &i32| -> &i32 { a }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^ the trait `Foo` is not implemented for `[closure@$DIR/issue-79187-2.rs:14:14: 14:31]` | - = note: expected reference `&i32` - found reference `&i32` -note: the lifetime requirement is introduced here +note: required by a bound in `take_foo` --> $DIR/issue-79187-2.rs:5:21 | LL | fn take_foo(_: impl Foo) {} - | ^^^ + | ^^^ required by this bound in `take_foo` -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index eab8e8e80c424..846bedec87ab4 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -213,6 +213,14 @@ LL | let _ = cf as *const dyn Bar; | = note: vtable kinds may not match +error[E0277]: the trait bound `[u8]: Foo` is not satisfied + --> $DIR/cast-rfc0401.rs:53:13 + | +LL | let _ = fat_v as *const dyn Foo; + | ^^^^^ the trait `Foo` is not implemented for `[u8]` + | + = note: required for the cast from `[u8]` to the object type `dyn Foo` + error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:53:13 | @@ -226,6 +234,14 @@ help: consider borrowing the value, since `&[u8]` can be coerced into `dyn Foo` LL | let _ = &fat_v as *const dyn Foo; | + +error[E0277]: the trait bound `str: Foo` is not satisfied + --> $DIR/cast-rfc0401.rs:62:13 + | +LL | let _ = a as *const dyn Foo; + | ^ the trait `Foo` is not implemented for `str` + | + = note: required for the cast from `str` to the object type `dyn Foo` + error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:62:13 | @@ -248,7 +264,7 @@ LL | vec![0.0].iter().map(|s| s as f32).collect::>(); | cannot cast `&{float}` as `f32` | help: dereference the expression: `*s` -error: aborting due to 34 previous errors +error: aborting due to 36 previous errors Some errors have detailed explanations: E0054, E0277, E0604, E0605, E0606, E0607, E0609. For more information about an error, try `rustc --explain E0054`. diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr index ef76ec63fdaf8..37d20290ed09e 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.stderr @@ -1,31 +1,15 @@ -error: implementation of `FnOnce` is not general enough +error[E0277]: the trait bound `[closure@$DIR/closure-mismatch.rs:8:9: 8:12]: Foo` is not satisfied --> $DIR/closure-mismatch.rs:8:5 | LL | baz(|_| ()); - | ^^^^^^^^^^^ implementation of `FnOnce` is not general enough + | ^^^ the trait `Foo` is not implemented for `[closure@$DIR/closure-mismatch.rs:8:9: 8:12]` | - = note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` - -error[E0308]: mismatched types - --> $DIR/closure-mismatch.rs:8:5 - | -LL | baz(|_| ()); - | ^^^^^^^^^^^ one type is more general than the other - | - = note: expected trait `for<'r> Fn<(&'r (),)>` - found trait `Fn<(&(),)>` -note: this closure does not fulfill the lifetime requirements - --> $DIR/closure-mismatch.rs:8:9 - | -LL | baz(|_| ()); - | ^^^ -note: the lifetime requirement is introduced here +note: required by a bound in `baz` --> $DIR/closure-mismatch.rs:5:11 | LL | fn baz(_: T) {} - | ^^^ + | ^^^ required by this bound in `baz` -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index 4b191710c393a..98237c807be8d 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -14,17 +14,16 @@ LL | x: 3 LL ~ }).hi() { | -error[E0277]: `bool` is not an iterator +error[E0277]: `bool` cannot be converted to an iterator --> $DIR/struct-literal-in-for.rs:12:14 | LL | for x in Foo { | ______________^ LL | | x: 3 LL | | }.hi() { - | |__________^ `bool` is not an iterator + | |__________^ `bool` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `bool` - = note: required because of the requirements on the impl of `IntoIterator` for `bool` + = help: the trait `IntoIterator` is not implemented for `bool` error: aborting due to 2 previous errors diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index 0bbed8704243f..748307908fd6e 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -4,24 +4,13 @@ error[E0308]: mismatched types LL | let _ = 0u32..10i32; | ^^^^^ expected `u32`, found `i32` -error[E0277]: the trait bound `bool: Step` is not satisfied +error[E0277]: `std::ops::Range` cannot be converted to an iterator --> $DIR/range-1.rs:9:14 | LL | for i in false..true {} - | ^^^^^^^^^^^ the trait `Step` is not implemented for `bool` + | ^^^^^^^^^^^ `std::ops::Range` cannot be converted to an iterator | - = help: the following other types implement trait `Step`: - char - i128 - i16 - i32 - i64 - i8 - isize - u128 - and 5 others - = note: required because of the requirements on the impl of `Iterator` for `std::ops::Range` - = note: required because of the requirements on the impl of `IntoIterator` for `std::ops::Range` + = help: the trait `IntoIterator` is not implemented for `std::ops::Range` error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time --> $DIR/range-1.rs:14:17 diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index d1004a6905887..e2082db6bbfaf 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -8,30 +8,15 @@ LL | #![feature(specialization)] = note: see issue #31844 for more information = help: consider using `min_specialization` instead, which is more stable and complete -error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait bounds were not satisfied +error[E0599]: no method named `foo_one` found for struct `MyStruct` in the current scope --> $DIR/specialization-trait-not-implemented.rs:22:29 | LL | struct MyStruct; - | --------------- - | | - | method `foo_one` not found for this struct - | doesn't satisfy `MyStruct: Foo` + | --------------- method `foo_one` not found for this struct ... LL | println!("{}", MyStruct.foo_one()); - | ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds + | ^^^^^^^ method not found in `MyStruct` | -note: trait bound `MyStruct: Foo` was not satisfied - --> $DIR/specialization-trait-not-implemented.rs:14:1 - | -LL | default impl Foo for T { - | ^^^^^^^^^^^^^^^^---^^^^^- - | | - | unsatisfied trait bound introduced here -note: the following trait must be implemented - --> $DIR/specialization-trait-not-implemented.rs:7:1 - | -LL | trait Foo { - | ^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope note: `Foo` defines an item `foo_one`, perhaps you need to implement it --> $DIR/specialization-trait-not-implemented.rs:7:1 diff --git a/src/test/ui/specialization/issue-38091.stderr b/src/test/ui/specialization/issue-38091.stderr index cc5536c9e9af5..cfdc19899bd83 100644 --- a/src/test/ui/specialization/issue-38091.stderr +++ b/src/test/ui/specialization/issue-38091.stderr @@ -8,18 +8,46 @@ 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:23 +error[E0275]: overflow evaluating the requirement `T: Iterate<'_>` + --> $DIR/issue-38091.rs:8:13 | -LL | default type Ty = (); - | ^^ the trait `Valid` is not implemented for `()` +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ | -note: required by a bound in `Iterate::Ty` - --> $DIR/issue-38091.rs:5:14 + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_38091`) +note: required because of the requirements on the impl of `Check` for `T` + --> $DIR/issue-38091.rs:18:13 | -LL | type Ty: Valid; - | ^^^^^ required by this bound in `Iterate::Ty` +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^ ^ +note: required because of the requirements on the impl of `Iterate<'_>` for `T` + --> $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 `T` + +error[E0275]: overflow evaluating the requirement `T: Iterate<'_>` + --> $DIR/issue-38091.rs:18:1 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_38091`) +note: required because of the requirements on the impl of `Check` for `T` + --> $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 `T` + --> $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 `T` -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 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/specialization/issue-39448.stderr b/src/test/ui/specialization/issue-39448.stderr index c4fc44c737ec1..3c072011e919e 100644 --- a/src/test/ui/specialization/issue-39448.stderr +++ b/src/test/ui/specialization/issue-39448.stderr @@ -8,23 +8,38 @@ LL | #![feature(specialization)] = note: see issue #31844 for more information = help: consider using `min_specialization` instead, which is more stable and complete -error[E0275]: overflow evaluating the requirement `T: FromA` +error[E0277]: the trait bound `T: FromA` is not satisfied --> $DIR/issue-39448.rs:45:13 | LL | x.foo(y.to()).to() - | ^^ + | ^^ the trait `FromA` is not implemented for `T` | -note: required because of the requirements on the impl of `FromA` for `T` - --> $DIR/issue-39448.rs:24:29 - | -LL | impl> FromA for U { - | ^^^^^^^^ ^ note: required because of the requirements on the impl of `ToA` for `U` --> $DIR/issue-39448.rs:34:12 | LL | impl ToA for T | ^^^^^^ ^ +help: consider further restricting this bound + | +LL | fn foo, U: A>(x: T, y: U) -> U { + | ++++++++++ + +error[E0277]: the trait bound `U: FromA` is not satisfied + --> $DIR/issue-39448.rs:45:19 + | +LL | x.foo(y.to()).to() + | ^^ the trait `FromA` is not implemented for `U` + | +note: required because of the requirements on the impl of `ToA` for `T` + --> $DIR/issue-39448.rs:34:12 + | +LL | impl ToA for T + | ^^^^^^ ^ +help: consider further restricting this bound + | +LL | fn foo>(x: T, y: U) -> U { + | ++++++++++ -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/specialization/min_specialization/issue-79224.stderr b/src/test/ui/specialization/min_specialization/issue-79224.stderr index cfb9007c7a28c..b9a0b0bcf356b 100644 --- a/src/test/ui/specialization/min_specialization/issue-79224.stderr +++ b/src/test/ui/specialization/min_specialization/issue-79224.stderr @@ -1,26 +1,24 @@ -error[E0277]: the trait bound `B: Clone` is not satisfied +error[E0277]: the trait bound `B: ToOwned` is not satisfied --> $DIR/issue-79224.rs:18:17 | LL | impl Display for Cow<'_, B> { - | ^^^^^^^ the trait `Clone` is not implemented for `B` + | ^^^^^^^ the trait `ToOwned` is not implemented for `B` | - = note: required because of the requirements on the impl of `ToOwned` for `B` help: consider further restricting this bound | -LL | impl Display for Cow<'_, B> { - | +++++++++++++++++++ +LL | impl Display for Cow<'_, B> { + | ++++++++++++++++++++++ -error[E0277]: the trait bound `B: Clone` is not satisfied +error[E0277]: the trait bound `B: ToOwned` is not satisfied --> $DIR/issue-79224.rs:19:12 | LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^^ the trait `Clone` is not implemented for `B` + | ^^^^^ the trait `ToOwned` is not implemented for `B` | - = note: required because of the requirements on the impl of `ToOwned` for `B` help: consider further restricting this bound | -LL | impl Display for Cow<'_, B> { - | +++++++++++++++++++ +LL | impl Display for Cow<'_, B> { + | ++++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index 8ae5c84794734..4969af493871f 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -1,20 +1,11 @@ -error[E0277]: the trait bound `&str: From` is not satisfied +error[E0277]: the trait bound `String: Into<&str>` is not satisfied --> $DIR/into-str.rs:4:9 | LL | foo(String::new()); - | --- ^^^^^^^^^^^^^ the trait `From` is not implemented for `&str` + | --- ^^^^^^^^^^^^^ the trait `Into<&str>` is not implemented for `String` | | | required by a bound introduced by this call | - = note: to coerce a `String` into a `&str`, use `&*` as a prefix - = help: the following other types implement trait `From`: - > - > - > - >> - >> - > - = note: required because of the requirements on the impl of `Into<&str>` for `String` note: required by a bound in `foo` --> $DIR/into-str.rs:1:31 | diff --git a/src/test/ui/suggestions/issue-62843.stderr b/src/test/ui/suggestions/issue-62843.stderr index bc1c69406d139..cf8fb13afbcf3 100644 --- a/src/test/ui/suggestions/issue-62843.stderr +++ b/src/test/ui/suggestions/issue-62843.stderr @@ -1,4 +1,4 @@ -error[E0277]: expected a `FnMut<(char,)>` closure, found `String` +error[E0277]: the trait bound `String: Pattern<'_>` is not satisfied --> $DIR/issue-62843.rs:4:32 | LL | println!("{:?}", line.find(pattern)); @@ -6,8 +6,6 @@ LL | println!("{:?}", line.find(pattern)); | | | required by a bound introduced by this call | - = note: the trait bound `String: Pattern<'_>` is not satisfied - = note: required because of the requirements on the impl of `Pattern<'_>` for `String` note: required by a bound in `core::str::::find` --> $SRC_DIR/core/src/str/mod.rs:LL:COL | diff --git a/src/test/ui/suggestions/issue-96555.stderr b/src/test/ui/suggestions/issue-96555.stderr index a1a603cf246dc..90d3e4d68450a 100644 --- a/src/test/ui/suggestions/issue-96555.stderr +++ b/src/test/ui/suggestions/issue-96555.stderr @@ -1,14 +1,13 @@ -error[E0277]: `()` is not a future +error[E0277]: `()` cannot be converted to a future --> $DIR/issue-96555.rs:4:12 | LL | m::f1().await; - | -------^^^^^^ `()` is not a future + | -------^^^^^^ `()` cannot be converted to a future | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()` + = help: the trait `IntoFuture` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` help: remove the `.await` | LL - m::f1().await; @@ -19,17 +18,16 @@ help: alternatively, consider making `fn f1` asynchronous LL | pub async fn f1() {} | +++++ -error[E0277]: `()` is not a future +error[E0277]: `()` cannot be converted to a future --> $DIR/issue-96555.rs:5:12 | LL | m::f2().await; - | -------^^^^^^ `()` is not a future + | -------^^^^^^ `()` cannot be converted to a future | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()` + = help: the trait `IntoFuture` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` help: remove the `.await` | LL - m::f2().await; @@ -40,17 +38,16 @@ help: alternatively, consider making `fn f2` asynchronous LL | pub(crate) async fn f2() {} | +++++ -error[E0277]: `()` is not a future +error[E0277]: `()` cannot be converted to a future --> $DIR/issue-96555.rs:6:12 | LL | m::f3().await; - | -------^^^^^^ `()` is not a future + | -------^^^^^^ `()` cannot be converted to a future | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()` + = help: the trait `IntoFuture` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required because of the requirements on the impl of `IntoFuture` for `()` help: remove the `.await` | LL - m::f3().await; diff --git a/src/test/ui/suggestions/slice-issue-87994.stderr b/src/test/ui/suggestions/slice-issue-87994.stderr index fd2a44f9a82ba..ad98ae6922e90 100644 --- a/src/test/ui/suggestions/slice-issue-87994.stderr +++ b/src/test/ui/suggestions/slice-issue-87994.stderr @@ -1,63 +1,31 @@ -error[E0277]: the size for values of type `[i32]` cannot be known at compilation time +error[E0277]: `[i32]` cannot be converted to an iterator --> $DIR/slice-issue-87994.rs:3:12 | LL | for _ in v[1..] { - | ^^^^^^ expected an implementor of trait `IntoIterator` - | - = note: the trait bound `[i32]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[i32]` -help: consider borrowing here - | -LL | for _ in &v[1..] { - | + -LL | for _ in &mut v[1..] { - | ++++ - -error[E0277]: `[i32]` is not an iterator - --> $DIR/slice-issue-87994.rs:3:12 - | -LL | for _ in v[1..] { - | ^^^^^^ expected an implementor of trait `IntoIterator` - | - = note: the trait bound `[i32]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[i32]` -help: consider borrowing here - | -LL | for _ in &v[1..] { - | + -LL | for _ in &mut v[1..] { - | ++++ + | ^^^^^^ `[i32]` cannot be converted to an iterator + | + = help: the trait `IntoIterator` is not implemented for `[i32]` + = help: the following other types implement trait `IntoIterator`: + &'a [T; N] + &'a [T] + &'a mut [T; N] + &'a mut [T] + [T; N] -error[E0277]: the size for values of type `[K]` cannot be known at compilation time +error[E0277]: `[K]` cannot be converted to an iterator --> $DIR/slice-issue-87994.rs:11:13 | LL | for i2 in v2[1..] { - | ^^^^^^^ expected an implementor of trait `IntoIterator` - | - = note: the trait bound `[K]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[K]` -help: consider borrowing here - | -LL | for i2 in &v2[1..] { - | + -LL | for i2 in &mut v2[1..] { - | ++++ - -error[E0277]: `[K]` is not an iterator - --> $DIR/slice-issue-87994.rs:11:13 - | -LL | for i2 in v2[1..] { - | ^^^^^^^ expected an implementor of trait `IntoIterator` - | - = note: the trait bound `[K]: IntoIterator` is not satisfied - = note: required because of the requirements on the impl of `IntoIterator` for `[K]` -help: consider borrowing here - | -LL | for i2 in &v2[1..] { - | + -LL | for i2 in &mut v2[1..] { - | ++++ + | ^^^^^^^ `[K]` cannot be converted to an iterator + | + = help: the trait `IntoIterator` is not implemented for `[K]` + = help: the following other types implement trait `IntoIterator`: + &'a [T; N] + &'a [T] + &'a mut [T; N] + &'a mut [T] + [T; N] -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/suggest-remove-refs-1.stderr b/src/test/ui/suggestions/suggest-remove-refs-1.stderr index 1083b2f971311..79d1054762d69 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-1.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-1.stderr @@ -1,14 +1,13 @@ -error[E0277]: `&Enumerate>` is not an iterator +error[E0277]: `&Enumerate>` cannot be converted to an iterator --> $DIR/suggest-remove-refs-1.rs:6:19 | LL | for (i, _) in &v.iter().enumerate() { | -^^^^^^^^^^^^^^^^^^^^ | | - | `&Enumerate>` is not an iterator + | `&Enumerate>` cannot be converted to an iterator | help: consider removing the leading `&`-reference | - = help: the trait `Iterator` is not implemented for `&Enumerate>` - = note: required because of the requirements on the impl of `IntoIterator` for `&Enumerate>` + = help: the trait `IntoIterator` is not implemented for `&Enumerate>` error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-2.stderr b/src/test/ui/suggestions/suggest-remove-refs-2.stderr index 197b19a1bffc2..2054cb65837d4 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-2.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-2.stderr @@ -1,14 +1,13 @@ -error[E0277]: `&&&&&Enumerate>` is not an iterator +error[E0277]: `&&&&&Enumerate>` cannot be converted to an iterator --> $DIR/suggest-remove-refs-2.rs:6:19 | LL | for (i, _) in & & & & &v.iter().enumerate() { | ---------^^^^^^^^^^^^^^^^^^^^ | | - | `&&&&&Enumerate>` is not an iterator + | `&&&&&Enumerate>` cannot be converted to an iterator | help: consider removing 5 leading `&`-references | - = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` - = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate>` + = help: the trait `IntoIterator` is not implemented for `&&&&&Enumerate>` error: aborting due to previous error diff --git a/src/test/ui/suggestions/suggest-remove-refs-3.stderr b/src/test/ui/suggestions/suggest-remove-refs-3.stderr index bb0cceac1db7b..c2315fcbb48d8 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-3.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-3.stderr @@ -1,4 +1,4 @@ -error[E0277]: `&&&&&Enumerate>` is not an iterator +error[E0277]: `&&&&&Enumerate>` cannot be converted to an iterator --> $DIR/suggest-remove-refs-3.rs:6:19 | LL | for (i, _) in & & & @@ -9,10 +9,9 @@ LL | || & &v | ||___________- help: consider removing 5 leading `&`-references LL | | .iter() LL | | .enumerate() { - | |_____________________^ `&&&&&Enumerate>` is not an iterator + | |_____________________^ `&&&&&Enumerate>` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `&&&&&Enumerate>` - = note: required because of the requirements on the impl of `IntoIterator` for `&&&&&Enumerate>` + = help: the trait `IntoIterator` is not implemented for `&&&&&Enumerate>` error: aborting due to previous error diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 6ce57b6263e41..b4941d4e07bc1 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -1,12 +1,11 @@ -error[E0277]: expected a `FnMut<(char,)>` closure, found `u8` +error[E0277]: the trait bound `u8: Pattern<'_>` is not satisfied --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 | LL | s.strip_suffix(b'\n').unwrap_or(s) - | ------------ ^^^^^ expected an `FnMut<(char,)>` closure, found `u8` + | ------------ ^^^^^ the trait `Pattern<'_>` is not implemented for `u8` | | | required by a bound introduced by this call | - = help: the trait `FnMut<(char,)>` is not implemented for `u8` = help: the following other types implement trait `Pattern<'a>`: &'b String &'b [char; N] @@ -15,7 +14,11 @@ LL | s.strip_suffix(b'\n').unwrap_or(s) &'c &'b str [char; N] char - = note: required because of the requirements on the impl of `Pattern<'_>` for `u8` +note: required by a bound in `core::str::::strip_suffix` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | P: Pattern<'a>, + | ^^^^^^^^^^^ required by this bound in `core::str::::strip_suffix` error: aborting due to previous error diff --git a/src/test/ui/traits/cycle-cache-err-60010.stderr b/src/test/ui/traits/cycle-cache-err-60010.stderr index 859403f202f51..08f6094c96c53 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.stderr +++ b/src/test/ui/traits/cycle-cache-err-60010.stderr @@ -1,27 +1,10 @@ -error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe` +error[E0277]: the trait bound `RootDatabase: SourceDatabase` is not satisfied --> $DIR/cycle-cache-err-60010.rs:27:13 | LL | _parse: >::Data, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SourceDatabase` is not implemented for `RootDatabase` | - = note: required because it appears within the type `PhantomData` - = 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:44:9 - | -LL | impl SourceDatabase for T - | ^^^^^^^^^^^^^^ ^ + = help: the trait `Query` is implemented for `ParseQuery` note: required because of the requirements on the impl of `Query` for `ParseQuery` --> $DIR/cycle-cache-err-60010.rs:37:10 | @@ -30,4 +13,4 @@ LL | impl Query for ParseQuery error: aborting due to previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/inductive-overflow/simultaneous.stderr b/src/test/ui/traits/inductive-overflow/simultaneous.stderr index 230c2638c5003..2638293d5e76c 100644 --- a/src/test/ui/traits/inductive-overflow/simultaneous.stderr +++ b/src/test/ui/traits/inductive-overflow/simultaneous.stderr @@ -1,14 +1,11 @@ -error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum` - --> $DIR/simultaneous.rs:18:5 +error[E0277]: the trait bound `{integer}: Combo` is not satisfied + --> $DIR/simultaneous.rs:18:11 | LL | is_ee(4); - | ^^^^^ + | ----- ^ the trait `Combo` is not implemented for `{integer}` + | | + | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Combo` for `{integer}` - --> $DIR/simultaneous.rs:11:34 - | -LL | impl Combo for T {} - | ^^^^^ ^ note: required by a bound in `is_ee` --> $DIR/simultaneous.rs:13:13 | @@ -17,4 +14,4 @@ LL | fn is_ee(t: T) { error: aborting due to previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/inductive-overflow/supertrait.stderr b/src/test/ui/traits/inductive-overflow/supertrait.stderr index 95325a534f551..f0616533bb5ec 100644 --- a/src/test/ui/traits/inductive-overflow/supertrait.stderr +++ b/src/test/ui/traits/inductive-overflow/supertrait.stderr @@ -1,14 +1,11 @@ -error[E0275]: overflow evaluating the requirement `NoClone: Magic` - --> $DIR/supertrait.rs:13:18 +error[E0277]: the trait bound `NoClone: Magic` is not satisfied + --> $DIR/supertrait.rs:13:23 | LL | let (a, b) = copy(NoClone); - | ^^^^ + | ---- ^^^^^^^ the trait `Magic` is not implemented for `NoClone` + | | + | required by a bound introduced by this call | -note: required because of the requirements on the impl of `Magic` for `NoClone` - --> $DIR/supertrait.rs:5:16 - | -LL | impl Magic for T {} - | ^^^^^ ^ note: required by a bound in `copy` --> $DIR/supertrait.rs:7:12 | @@ -17,4 +14,4 @@ LL | fn copy(x: T) -> (T, T) { (x, x) } error: aborting due to previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/inductive-overflow/two-traits.stderr b/src/test/ui/traits/inductive-overflow/two-traits.stderr index 0d0bf88616c86..df3e858b2c865 100644 --- a/src/test/ui/traits/inductive-overflow/two-traits.stderr +++ b/src/test/ui/traits/inductive-overflow/two-traits.stderr @@ -14,11 +14,11 @@ help: consider further restricting this bound LL | impl Magic for T { | +++++++++++++++++++ -error[E0275]: overflow evaluating the requirement `*mut (): Magic` - --> $DIR/two-traits.rs:20:5 +error[E0277]: the trait bound `*mut (): Magic` is not satisfied + --> $DIR/two-traits.rs:20:14 | LL | wizard::<*mut ()>(); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^ the trait `Magic` is not implemented for `*mut ()` | note: required by a bound in `wizard` --> $DIR/two-traits.rs:17:14 @@ -28,5 +28,4 @@ LL | fn wizard() { check::<::X>(); } error: aborting due to 2 previous errors -Some errors have detailed explanations: E0275, E0277. -For more information about an error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.fixed b/src/test/ui/traits/suggest-deferences/root-obligation.fixed index 7a8433f90572e..51bac2107e3b4 100644 --- a/src/test/ui/traits/suggest-deferences/root-obligation.fixed +++ b/src/test/ui/traits/suggest-deferences/root-obligation.fixed @@ -3,7 +3,7 @@ fn get_vowel_count(string: &str) -> usize { string .chars() - .filter(|c| "aeiou".contains(*c)) + .filter(|c| "aeiou".contains(c)) //~^ ERROR expected a `Fn<(char,)>` closure, found `char` .count() } diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.stderr b/src/test/ui/traits/suggest-deferences/root-obligation.stderr index 16e03e79c7571..cbd2fa5c1207a 100644 --- a/src/test/ui/traits/suggest-deferences/root-obligation.stderr +++ b/src/test/ui/traits/suggest-deferences/root-obligation.stderr @@ -1,23 +1,17 @@ -error[E0277]: expected a `Fn<(char,)>` closure, found `char` +error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) - | -------- ^ expected an `Fn<(char,)>` closure, found `char` + | -------- ^ the trait `Pattern<'_>` is not implemented for `&char` | | | required by a bound introduced by this call | - = help: the trait `Fn<(char,)>` is not implemented for `char` - = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&char` - = note: required because of the requirements on the impl of `Pattern<'_>` for `&char` + = help: the trait `Pattern<'a>` is implemented for `char` note: required by a bound in `core::str::::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL | LL | pub fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool { | ^^^^^^^^^^^ required by this bound in `core::str::::contains` -help: consider dereferencing here - | -LL | .filter(|c| "aeiou".contains(*c)) - | + error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index cdaae99e28621..14f96177a43b8 100644 --- a/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/src/test/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -1,13 +1,15 @@ -error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied +error[E0277]: the trait bound `&A: Into<&'static B>` is not satisfied --> $DIR/multiple-def-uses-in-one-fn.rs:9:45 | LL | fn f(a: &'static A, b: B) -> (X, X) { - | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B` + | ^^^^^^^^^^^^^^^^^^ the trait `Into<&'static B>` is not implemented for `&A` +LL | +LL | (a, a) + | ------ return type was inferred to be `(&A, &A)` here | - = note: required because of the requirements on the impl of `Into<&'static B>` for `&A` help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | -LL | fn f(a: &'static A, b: B) -> (X, X) where &'static B: From<&A> { +LL | fn f(a: &'static A, b: B) -> (X, X) where &A: Into<&'static B> { | ++++++++++++++++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/typeck/issue-90101.stderr b/src/test/ui/typeck/issue-90101.stderr index ab9a72edfe98d..3f063f729fc45 100644 --- a/src/test/ui/typeck/issue-90101.stderr +++ b/src/test/ui/typeck/issue-90101.stderr @@ -1,18 +1,11 @@ -error[E0277]: the trait bound `PathBuf: From>` is not satisfied +error[E0277]: the trait bound `Cow<'_, str>: Into` is not satisfied --> $DIR/issue-90101.rs:6:10 | LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world") - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `PathBuf` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Into` is not implemented for `Cow<'_, str>` | | | required by a bound introduced by this call | - = help: the following other types implement trait `From`: - > - >> - >> - > - > - = note: required because of the requirements on the impl of `Into` for `Cow<'_, str>` note: required by a bound in `func` --> $DIR/issue-90101.rs:3:20 | diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr index d7b95f55769fd..402de6d1c5244 100644 --- a/src/test/ui/unsized/issue-71659.stderr +++ b/src/test/ui/unsized/issue-71659.stderr @@ -1,9 +1,10 @@ -error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied +error[E0277]: the trait bound `dyn Foo: Unsize<[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` + | ^^^^ the trait `Unsize<[i32]>` is not implemented for `dyn Foo` | + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information note: required by a bound in `Cast::cast` --> $DIR/issue-71659.rs:19:15 | diff --git a/src/test/ui/wf/hir-wf-check-erase-regions.stderr b/src/test/ui/wf/hir-wf-check-erase-regions.stderr index 037f8b9f33770..920f1ac11fb34 100644 --- a/src/test/ui/wf/hir-wf-check-erase-regions.stderr +++ b/src/test/ui/wf/hir-wf-check-erase-regions.stderr @@ -1,32 +1,36 @@ -error[E0277]: `&T` is not an iterator +error[E0277]: `&T` cannot be converted to an iterator --> $DIR/hir-wf-check-erase-regions.rs:7:21 | LL | type IntoIter = std::iter::Flatten>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `&T` - = help: the trait `Iterator` is implemented for `&mut I` - = note: required because of the requirements on the impl of `IntoIterator` for `&T` + = help: the trait `IntoIterator` is not implemented for `&T` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL | LL | pub struct Flatten> { | ^^^^^^^^^^^^ required by this bound in `Flatten` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl<'a, T, const N: usize> IntoIterator for &'a Table where &T: IntoIterator { + | ++++++++++++++++++++++ -error[E0277]: `&T` is not an iterator +error[E0277]: `&T` cannot be converted to an iterator --> $DIR/hir-wf-check-erase-regions.rs:10:27 | LL | fn into_iter(self) -> Self::IntoIter { - | ^^^^^^^^^^^^^^ `&T` is not an iterator + | ^^^^^^^^^^^^^^ `&T` cannot be converted to an iterator | - = help: the trait `Iterator` is not implemented for `&T` - = help: the trait `Iterator` is implemented for `&mut I` - = note: required because of the requirements on the impl of `IntoIterator` for `&T` + = help: the trait `IntoIterator` is not implemented for `&T` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL | LL | pub struct Flatten> { | ^^^^^^^^^^^^ required by this bound in `Flatten` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl<'a, T, const N: usize> IntoIterator for &'a Table where &T: IntoIterator { + | ++++++++++++++++++++++ error: aborting due to 2 previous errors