Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// Ambiguous predicates should never error
| ty::PredicateKind::Ambiguous
// We never return Err when proving UnstableFeature goal.
| ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature{ .. })
| ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature { .. })
| ty::PredicateKind::NormalizesTo { .. }
| ty::PredicateKind::AliasRelate { .. }
| ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType { .. }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5515,7 +5515,14 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>(
};
if let ty::PredicatePolarity::Positive = trait_predicate.polarity() {
format!(
"{pre_message}the trait `{}` is not implemented for{desc} `{}`",
"{pre_message}the {}trait `{}` is not implemented for{desc} `{}`",
if tcx.lookup_stability(trait_predicate.def_id()).map(|s| s.level.is_stable())
== Some(false)
{
"nightly-only, unstable "
} else {
""
},
trait_predicate.print_modifiers_and_trait_path(),
tcx.short_string(trait_predicate.self_ty().skip_binder(), long_ty_path),
)
Expand Down
7 changes: 7 additions & 0 deletions library/core/src/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ unsafe_impl_trusted_step![AsciiChar char i8 i16 i32 i64 i128 isize u8 u16 u32 u6
/// The *successor* operation moves towards values that compare greater.
/// The *predecessor* operation moves towards values that compare lesser.
#[rustc_diagnostic_item = "range_step"]
#[rustc_on_unimplemented(
message = "`std::ops::Range<{Self}>` is not an iterator",
label = "`Range<{Self}>` is not an iterator",
note = "`Range` only implements `Iterator` for select types in the standard library, \
particularly integers; to see the full list of types, see the documentation for the \
unstable `Step` trait"
)]
#[unstable(feature = "step_trait", issue = "42168")]
pub trait Step: Clone + PartialOrd + Sized {
/// Returns the bounds on the number of *successor* steps required to get from `start` to `end`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
error[E0277]: the trait bound `T: Step` is not satisfied
error[E0277]: `std::ops::Range<T>` is not an iterator
--> missing-bound.rs:2:14
|
2 | for _ in t {}
| ^ the trait `Step` is not implemented for `T`
| ^ `Range<T>` is not an iterator
|
= note: `Range` only implements `Iterator` for select types in the standard library, particularly integers; to see the full list of types, see the documentation for the unstable `Step` trait
= note: required for `std::ops::Range<T>` to implement `Iterator`
= note: required for `std::ops::Range<T>` to implement `IntoIterator`

Expand Down
2 changes: 1 addition & 1 deletion tests/ui-fulldeps/rustc-dev-remap.only-remap.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisf
LL | type Result = NotAValidResultType;
| ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `VisitorResult` is not implemented for `NotAValidResultType`
help: the nightly-only, unstable trait `VisitorResult` is not implemented for `NotAValidResultType`
--> $DIR/rustc-dev-remap.rs:LL:COL
|
LL | struct NotAValidResultType;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-fulldeps/rustc-dev-remap.remap-unremap.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: the trait bound `NotAValidResultType: VisitorResult` is not satisf
LL | type Result = NotAValidResultType;
| ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `VisitorResult` is not implemented for `NotAValidResultType`
help: the nightly-only, unstable trait `VisitorResult` is not implemented for `NotAValidResultType`
--> $DIR/rustc-dev-remap.rs:LL:COL
|
LL | struct NotAValidResultType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | #[derive(Diagnostic)]
LL | arg: NotIntoDiagArg,
| ^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg`
help: the nightly-only, unstable trait `IntoDiagArg` is not implemented for `NotIntoDiagArg`
--> $DIR/diagnostic-derive-doc-comment-field.rs:28:1
|
LL | struct NotIntoDiagArg;
Expand All @@ -29,7 +29,7 @@ LL | #[derive(Subdiagnostic)]
LL | arg: NotIntoDiagArg,
| ^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `IntoDiagArg` is not implemented for `NotIntoDiagArg`
help: the nightly-only, unstable trait `IntoDiagArg` is not implemented for `NotIntoDiagArg`
--> $DIR/diagnostic-derive-doc-comment-field.rs:28:1
|
LL | struct NotIntoDiagArg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ LL | #[derive(Diagnostic)]
LL | other: Hello,
| ^^^^^ unsatisfied trait bound
|
help: the trait `IntoDiagArg` is not implemented for `Hello`
help: the nightly-only, unstable trait `IntoDiagArg` is not implemented for `Hello`
--> $DIR/diagnostic-derive.rs:40:1
|
LL | struct Hello {}
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/abi/issues/issue-22565-rust-call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup
--> $DIR/issue-22565-rust-call.rs:3:1
|
LL | extern "rust-call" fn b(_i: i32) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Tuple` is not implemented for `i32`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32`

error: functions with the "rust-call" ABI must take a single non-self tuple argument
--> $DIR/issue-22565-rust-call.rs:17:5
Expand Down Expand Up @@ -32,7 +32,7 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup
--> $DIR/issue-22565-rust-call.rs:27:7
|
LL | b(10);
| ^^ the trait `std::marker::Tuple` is not implemented for `i32`
| ^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32`

error: functions with the "rust-call" ABI must take a single non-self tuple argument
--> $DIR/issue-22565-rust-call.rs:29:5
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/async-await/coroutine-not-future.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not sa
--> $DIR/coroutine-not-future.rs:36:21
|
LL | takes_coroutine(async_fn());
| --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
| --------------- ^^^^^^^^^^ the nightly-only, unstable trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
| |
| required by a bound introduced by this call
|
Expand All @@ -16,7 +16,7 @@ error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not sa
--> $DIR/coroutine-not-future.rs:38:21
|
LL | takes_coroutine(returns_async_block());
| --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
| --------------- ^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
| |
| required by a bound introduced by this call
|
Expand All @@ -30,7 +30,7 @@ error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:40:21:
--> $DIR/coroutine-not-future.rs:40:21
|
LL | takes_coroutine(async {});
| --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}`
| --------------- ^^^^^^^^ the nightly-only, unstable trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}`
| |
| required by a bound introduced by this call
|
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/async-await/issue-61076.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};

struct T; //~ HELP the trait `Try` is not implemented for `T`
struct T; //~ HELP the nightly-only, unstable trait `Try` is not implemented for `T`

struct Tuple(i32);

Expand Down Expand Up @@ -41,7 +41,7 @@ async fn foo() -> Result<(), ()> {
async fn bar() -> Result<(), ()> {
foo()?; //~ ERROR the `?` operator can only be applied to values that implement `Try`
//~^ NOTE the `?` operator cannot be applied to type `impl Future<Output = Result<(), ()>>`
//~| HELP the trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
//~| HELP the nightly-only, unstable trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
//~| HELP consider `await`ing on the `Future`
//~| NOTE in this expansion of desugaring of operator `?`
//~| NOTE in this expansion of desugaring of operator `?`
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/async-await/issue-61076.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
LL | foo()?;
| ^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = Result<(), ()>>`
|
= help: the trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
= help: the nightly-only, unstable trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
help: consider `await`ing on the `Future`
|
LL | foo().await?;
Expand All @@ -16,7 +16,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
LL | t?;
| ^^ the `?` operator cannot be applied to type `T`
|
help: the trait `Try` is not implemented for `T`
help: the nightly-only, unstable trait `Try` is not implemented for `T`
--> $DIR/issue-61076.rs:7:1
|
LL | struct T;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/issue-84841.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
LL | test()?;
| ^^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = ()>`
|
= help: the trait `Try` is not implemented for `impl Future<Output = ()>`
= help: the nightly-only, unstable trait `Try` is not implemented for `impl Future<Output = ()>`

error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> $DIR/issue-84841.rs:9:11
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/try-in-sync.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: the `?` operator can only be applied to values that implement `Try
LL | foo()?;
| ^^^^^^ the `?` operator cannot be applied to type `impl Future<Output = Result<(), ()>>`
|
= help: the trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
= help: the nightly-only, unstable trait `Try` is not implemented for `impl Future<Output = Result<(), ()>>`
note: this implements `Future` and its output type supports `?`, but the future cannot be awaited in a synchronous function
--> $DIR/try-in-sync.rs:6:10
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: `fn() {main}` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:7:11
|
LL | check(main);
| ----- ^^^^ the trait `ConstParamTy_` is not implemented for fn item `fn() {main}`
| ----- ^^^^ the nightly-only, unstable trait `ConstParamTy_` is not implemented for fn item `fn() {main}`
| |
| required by a bound introduced by this call
|
Expand All @@ -24,7 +24,7 @@ LL | check(|| {});
| |
| required by a bound introduced by this call
|
= help: the trait `ConstParamTy_` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
= help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
note: required by a bound in `check`
--> $DIR/const_param_ty_bad.rs:4:18
|
Expand All @@ -40,7 +40,7 @@ error[E0277]: `fn()` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:9:11
|
LL | check(main as fn());
| ----- ^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `fn()`
| ----- ^^^^^^^^^^^^ the nightly-only, unstable trait `ConstParamTy_` is not implemented for `fn()`
| |
| required by a bound introduced by this call
|
Expand All @@ -58,7 +58,7 @@ error[E0277]: `&mut ()` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:10:11
|
LL | check(&mut ());
| ----- ^^^^^^^ the trait `ConstParamTy_` is not implemented for `&mut ()`
| ----- ^^^^^^^ the nightly-only, unstable trait `ConstParamTy_` is not implemented for `&mut ()`
| |
| required by a bound introduced by this call
|
Expand All @@ -78,7 +78,7 @@ error[E0277]: `*mut ()` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:11:11
|
LL | check(&mut () as *mut ());
| ----- ^^^^^^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `*mut ()`
| ----- ^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `ConstParamTy_` is not implemented for `*mut ()`
| |
| required by a bound introduced by this call
|
Expand All @@ -98,7 +98,7 @@ error[E0277]: `*const ()` can't be used as a const parameter type
--> $DIR/const_param_ty_bad.rs:12:11
|
LL | check(&() as *const ());
| ----- ^^^^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `*const ()`
| ----- ^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `ConstParamTy_` is not implemented for `*const ()`
| |
| required by a bound introduced by this call
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type
LL | check::<[NotParam; 0]>();
| ^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `ConstParamTy_` is not implemented for `NotParam`
help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for `NotParam`
--> $DIR/const_param_ty_bad_empty_array.rs:5:1
|
LL | struct NotParam;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type
LL | check::<&NotParam>();
| ^^^^^^^^^ unsatisfied trait bound
|
help: the trait `ConstParamTy_` is not implemented for `NotParam`
help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for `NotParam`
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1
|
LL | struct NotParam;
Expand All @@ -22,7 +22,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type
LL | check::<[NotParam]>();
| ^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `ConstParamTy_` is not implemented for `NotParam`
help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for `NotParam`
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1
|
LL | struct NotParam;
Expand All @@ -40,7 +40,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type
LL | check::<[NotParam; 17]>();
| ^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `ConstParamTy_` is not implemented for `NotParam`
help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for `NotParam`
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1
|
LL | struct NotParam;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ error[E0277]: the type `CantParam` does not `#[derive(PartialEq)]`
LL | impl std::marker::ConstParamTy_ for CantParam {}
| ^^^^^^^^^ unsatisfied trait bound
|
help: the trait `StructuralPartialEq` is not implemented for `CantParam`
help: the nightly-only, unstable trait `StructuralPartialEq` is not implemented for `CantParam`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:8:1
|
LL | struct CantParam(ImplementsConstParamTy);
Expand Down Expand Up @@ -46,7 +46,7 @@ error[E0277]: the type `CantParamDerive` does not `#[derive(PartialEq)]`
LL | #[derive(std::marker::ConstParamTy)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `StructuralPartialEq` is not implemented for `CantParamDerive`
help: the nightly-only, unstable trait `StructuralPartialEq` is not implemented for `CantParamDerive`
--> $DIR/const_param_ty_impl_no_structural_eq.rs:17:1
|
LL | struct CantParamDerive(ImplementsConstParamTy);
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/coroutine/gen_block_is_coro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}: C
--> $DIR/gen_block_is_coro.rs:7:13
|
LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}`
LL | gen { yield 42 }
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:8:5: 8:8}` here

error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}: Coroutine` is not satisfied
--> $DIR/gen_block_is_coro.rs:11:13
|
LL | fn bar() -> impl Coroutine<Yield = i64, Return = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}`
LL | gen { yield 42 }
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:12:5: 12:8}` here

error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}: Coroutine` is not satisfied
--> $DIR/gen_block_is_coro.rs:15:13
|
LL | fn baz() -> impl Coroutine<Yield = i32, Return = ()> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}`
LL | gen { yield 42 }
| ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:16:5: 16:8}` here

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/error-codes/E0059.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0059]: type parameter to bare `Fn` trait must be a tuple
--> $DIR/E0059.rs:3:11
|
LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) }
| ^^^^^^^ the trait `std::marker::Tuple` is not implemented for `i32`
| ^^^^^^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32`
|
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
Expand All @@ -11,7 +11,7 @@ error[E0277]: `i32` is not a tuple
--> $DIR/E0059.rs:3:41
|
LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) }
| ^^^^ the trait `std::marker::Tuple` is not implemented for `i32`
| ^^^^ the nightly-only, unstable trait `std::marker::Tuple` is not implemented for `i32`

error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
--> $DIR/E0059.rs:3:41
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/extern/extern-types-unsized.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ error[E0277]: the size for values of type `A` cannot be known
LL | assert_sized::<Bar<A>>();
| ^^^^^^ doesn't have a known size
|
= help: the trait `MetaSized` is not implemented for `A`
= help: the nightly-only, unstable trait `MetaSized` is not implemented for `A`
note: required by a bound in `Bar`
--> $DIR/extern-types-unsized.rs:14:12
|
Expand Down Expand Up @@ -100,7 +100,7 @@ error[E0277]: the size for values of type `A` cannot be known
LL | assert_sized::<Bar<Bar<A>>>();
| ^^^^^^^^^^^ doesn't have a known size
|
= help: the trait `MetaSized` is not implemented for `A`
= help: the nightly-only, unstable trait `MetaSized` is not implemented for `A`
note: required by a bound in `Bar`
--> $DIR/extern-types-unsized.rs:14:12
|
Expand Down
Loading
Loading