From b9886c6872b1fc7fe8d67c7eea8a20eb9a666200 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Tue, 25 Jun 2024 08:36:40 +0000 Subject: [PATCH] bless tests part 1 --- compiler/rustc_hir_analysis/src/bounds.rs | 4 + .../const_trait_fn-issue-88433.rs | 3 +- .../const_trait_fn-issue-88433.stderr | 11 - .../unify-op-with-fn-call.rs | 2 +- .../unify-op-with-fn-call.stderr | 55 +---- tests/ui/const-generics/issues/issue-88119.rs | 2 +- tests/ui/consts/const-float-classify.rs | 1 + tests/ui/consts/const-float-classify.stderr | 216 +----------------- tests/ui/consts/const-try.rs | 3 +- tests/ui/consts/const-try.stderr | 43 ++-- .../constifconst-call-in-const-position.rs | 3 +- ...constifconst-call-in-const-position.stderr | 37 +-- tests/ui/consts/promoted-const-drop.rs | 1 + tests/ui/consts/promoted-const-drop.stderr | 15 +- tests/ui/consts/promoted_const_call.stderr | 34 ++- .../consts/rustc-impl-const-stability.stderr | 12 +- .../auxiliary/cross-crate.rs | 3 +- ...fault-bound-non-const-specialized-bound.rs | 2 +- ...t-bound-non-const-specialized-bound.stderr | 41 ++++ .../const-default-const-specialized.rs | 5 +- .../const-default-const-specialized.stderr | 39 +++- .../specialization/default-keyword.rs | 3 +- .../specialization/default-keyword.stderr | 12 + .../issue-95186-specialize-on-tilde-const.rs | 3 +- ...sue-95186-specialize-on-tilde-const.stderr | 43 ++++ ...87-same-trait-bound-different-constness.rs | 3 +- ...ame-trait-bound-different-constness.stderr | 43 ++++ .../non-const-default-const-specialized.rs | 4 +- ...non-const-default-const-specialized.stderr | 47 ++-- .../trait-where-clause-const.rs | 6 +- .../ui/specialization/const_trait_impl.stderr | 68 +++++- 31 files changed, 370 insertions(+), 394 deletions(-) delete mode 100644 tests/ui/const-generics/const_trait_fn-issue-88433.stderr create mode 100644 tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr create mode 100644 tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.stderr create mode 100644 tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.stderr create mode 100644 tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.stderr diff --git a/compiler/rustc_hir_analysis/src/bounds.rs b/compiler/rustc_hir_analysis/src/bounds.rs index 18a29c10b61..0b03eeaced1 100644 --- a/compiler/rustc_hir_analysis/src/bounds.rs +++ b/compiler/rustc_hir_analysis/src/bounds.rs @@ -65,6 +65,10 @@ impl<'tcx> Bounds<'tcx> { } else { self.clauses.push(clause); } + + if !tcx.features().effects { + return; + } // For `T: ~const Tr` or `T: const Tr`, we need to add an additional bound on the // associated type of `` and make sure that the effect is compatible. if let Some(compat_val) = match (tcx.def_kind(defining_def_id), constness) { diff --git a/tests/ui/const-generics/const_trait_fn-issue-88433.rs b/tests/ui/const-generics/const_trait_fn-issue-88433.rs index f3271f833cc..5e0ea6fc168 100644 --- a/tests/ui/const-generics/const_trait_fn-issue-88433.rs +++ b/tests/ui/const-generics/const_trait_fn-issue-88433.rs @@ -1,7 +1,8 @@ //@ build-pass //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![allow(incomplete_features)] +#![feature(const_trait_impl, effects)] #[const_trait] trait Func { diff --git a/tests/ui/const-generics/const_trait_fn-issue-88433.stderr b/tests/ui/const-generics/const_trait_fn-issue-88433.stderr deleted file mode 100644 index 4e0d6370fbd..00000000000 --- a/tests/ui/const-generics/const_trait_fn-issue-88433.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const_trait_fn-issue-88433.rs:3:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs index 2f903ea419e..bd9c08e5ad8 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs @@ -1,6 +1,6 @@ //@ known-bug: #110395 -#![feature(generic_const_exprs, adt_const_params, const_trait_impl)] +#![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)] #![allow(incomplete_features)] // test `N + N` unifies with explicit function calls for non-builtin-types diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr index 335130c958f..cf03bb9ad76 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr @@ -1,3 +1,12 @@ +error: const `impl` for trait `Add` which is not marked with `#[const_trait]` + --> $DIR/unify-op-with-fn-call.rs:10:12 + | +LL | impl const std::ops::Add for Foo { + | ^^^^^^^^^^^^^ + | + = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` + = note: adding a non-const method body in the future would be a breaking change + error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter --> $DIR/unify-op-with-fn-call.rs:18:29 | @@ -45,48 +54,6 @@ help: try adding a `where` bound LL | fn foo2(a: Evaluatable2<{ N + N }>) where [(); { std::ops::Add::add(N, N) }]: { | +++++++++++++++++++++++++++++++++++++++++ -error[E0015]: cannot call non-const operator in constants - --> $DIR/unify-op-with-fn-call.rs:20:39 - | -LL | fn foo(a: Evaluatable<{ N + N }>) { - | ^^^^^ - | -note: impl defined here, but it is not `const` - --> $DIR/unify-op-with-fn-call.rs:10:1 - | -LL | impl const std::ops::Add for Foo { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | +error: aborting due to 5 previous errors -error[E0015]: cannot call non-const fn `::add` in constants - --> $DIR/unify-op-with-fn-call.rs:21:13 - | -LL | bar::<{ std::ops::Add::add(N, N) }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `::add` in constants - --> $DIR/unify-op-with-fn-call.rs:30:14 - | -LL | bar2::<{ std::ops::Add::add(N, N) }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0015, E0741. -For more information about an error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0741`. diff --git a/tests/ui/const-generics/issues/issue-88119.rs b/tests/ui/const-generics/issues/issue-88119.rs index bcbb26f0d8e..128e0b64a2b 100644 --- a/tests/ui/const-generics/issues/issue-88119.rs +++ b/tests/ui/const-generics/issues/issue-88119.rs @@ -1,7 +1,7 @@ //@ check-pass #![allow(incomplete_features)] -#![feature(const_trait_impl, generic_const_exprs)] +#![feature(const_trait_impl, effects, generic_const_exprs)] #[const_trait] trait ConstName { diff --git a/tests/ui/consts/const-float-classify.rs b/tests/ui/consts/const-float-classify.rs index ae094003c89..acc8d00f83e 100644 --- a/tests/ui/consts/const-float-classify.rs +++ b/tests/ui/consts/const-float-classify.rs @@ -5,6 +5,7 @@ #![feature(const_float_bits_conv)] #![feature(const_float_classify)] #![feature(const_trait_impl, effects)] +#![allow(incomplete_features)] // Don't promote const fn nop(x: T) -> T { x } diff --git a/tests/ui/consts/const-float-classify.stderr b/tests/ui/consts/const-float-classify.stderr index 1de27a072cf..38acb8a2281 100644 --- a/tests/ui/consts/const-float-classify.stderr +++ b/tests/ui/consts/const-float-classify.stderr @@ -1,14 +1,5 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-float-classify.rs:7:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 for more information - = note: `#[warn(incomplete_features)]` on by default - error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]` - --> $DIR/const-float-classify.rs:12:12 + --> $DIR/const-float-classify.rs:13:12 | LL | impl const PartialEq for bool { | ^^^^^^^^^^^^^^^^^ @@ -16,208 +7,5 @@ LL | impl const PartialEq for bool { = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change -error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates - --> $DIR/const-float-classify.rs:12:6 - | -LL | impl const PartialEq for bool { - | ^^^^^ unconstrained const parameter - | - = note: expressions using a const parameter must map each value to a distinct output value - = note: proving the result of expressions other than the parameter are unique is not supported +error: aborting due to 1 previous error -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0284]: type annotations needed - --> $DIR/const-float-classify.rs:21:35 - | -LL | const _: () = assert!($a == $b); - | ^^ cannot infer the value of the constant `_` -... -LL | / suite! { -LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative] -LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet] -... | -LL | | -1.0 / 0.0 => [ false, true, false, false, false, true] -LL | | } - | |_- in this macro invocation - | -note: required for `bool` to implement `PartialEq` - --> $DIR/const-float-classify.rs:12:12 - | -LL | impl const PartialEq for bool { - | ----- ^^^^^^^^^^^^^^^^^ ^^^^ - | | - | unsatisfied trait bound introduced here - = note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 10 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0207, E0284. -For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/consts/const-try.rs b/tests/ui/consts/const-try.rs index f2d3db9be9c..9089dd70a26 100644 --- a/tests/ui/consts/const-try.rs +++ b/tests/ui/consts/const-try.rs @@ -4,8 +4,9 @@ #![crate_type = "lib"] #![feature(try_trait_v2)] -#![feature(const_trait_impl)] +#![feature(const_trait_impl, effects)] #![feature(const_try)] +#![allow(incomplete_features)] use std::ops::{ControlFlow, FromResidual, Try}; diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr index 2d91424c8d3..27eb1252d7b 100644 --- a/tests/ui/consts/const-try.stderr +++ b/tests/ui/consts/const-try.stderr @@ -1,37 +1,20 @@ -error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions - --> $DIR/const-try.rs:33:5 - | -LL | TryMe?; - | ^^^^^^ - | -note: impl defined here, but it is not `const` - --> $DIR/const-try.rs:21:1 - | -LL | impl const Try for TryMe { - | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions - --> $DIR/const-try.rs:33:5 - | -LL | TryMe?; - | ^^^^^^ - | -note: impl defined here, but it is not `const` - --> $DIR/const-try.rs:15:1 +error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` + --> $DIR/const-try.rs:16:12 | LL | impl const FromResidual for TryMe { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable + | ^^^^^^^^^^^^^^^^^^^ | -LL + #![feature(effects)] + = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` + = note: adding a non-const method body in the future would be a breaking change + +error: const `impl` for trait `Try` which is not marked with `#[const_trait]` + --> $DIR/const-try.rs:22:12 | +LL | impl const Try for TryMe { + | ^^^ + | + = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` + = note: adding a non-const method body in the future would be a breaking change error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/constifconst-call-in-const-position.rs b/tests/ui/consts/constifconst-call-in-const-position.rs index 29c967f38a7..757e35bbab2 100644 --- a/tests/ui/consts/constifconst-call-in-const-position.rs +++ b/tests/ui/consts/constifconst-call-in-const-position.rs @@ -1,6 +1,7 @@ //@ known-bug: #102498 -#![feature(const_trait_impl, generic_const_exprs)] +#![feature(const_trait_impl, effects, generic_const_exprs)] +#![allow(incomplete_features)] #[const_trait] pub trait Tr { diff --git a/tests/ui/consts/constifconst-call-in-const-position.stderr b/tests/ui/consts/constifconst-call-in-const-position.stderr index 09827f29baf..f980b8969de 100644 --- a/tests/ui/consts/constifconst-call-in-const-position.stderr +++ b/tests/ui/consts/constifconst-call-in-const-position.stderr @@ -1,36 +1,9 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/constifconst-call-in-const-position.rs:3:30 - | -LL | #![feature(const_trait_impl, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0015]: cannot call non-const fn `::a` in constants - --> $DIR/constifconst-call-in-const-position.rs:17:9 - | -LL | [0; T::a()] - | ^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `::a` in constants - --> $DIR/constifconst-call-in-const-position.rs:16:38 +error[E0080]: evaluation of `foo::<()>::{constant#0}` failed + --> $DIR/constifconst-call-in-const-position.rs:17:38 | LL | const fn foo() -> [u8; T::a()] { - | ^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | + | ^^^^^^ calling non-const function `<() as Tr>::a` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/promoted-const-drop.rs b/tests/ui/consts/promoted-const-drop.rs index c896c011ab6..b7d92d6523a 100644 --- a/tests/ui/consts/promoted-const-drop.rs +++ b/tests/ui/consts/promoted-const-drop.rs @@ -4,6 +4,7 @@ struct A(); impl const Drop for A { + //~^ ERROR const `impl` for trait `Drop` which is not marked with `#[const_trait]` fn drop(&mut self) {} } diff --git a/tests/ui/consts/promoted-const-drop.stderr b/tests/ui/consts/promoted-const-drop.stderr index 4802834173f..1201f608232 100644 --- a/tests/ui/consts/promoted-const-drop.stderr +++ b/tests/ui/consts/promoted-const-drop.stderr @@ -1,5 +1,14 @@ +error: const `impl` for trait `Drop` which is not marked with `#[const_trait]` + --> $DIR/promoted-const-drop.rs:6:12 + | +LL | impl const Drop for A { + | ^^^^ + | + = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` + = note: adding a non-const method body in the future would be a breaking change + error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted-const-drop.rs:13:26 + --> $DIR/promoted-const-drop.rs:14:26 | LL | let _: &'static A = &A(); | ---------- ^^^ creates a temporary value which is freed while still in use @@ -10,7 +19,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted-const-drop.rs:14:28 + --> $DIR/promoted-const-drop.rs:15:28 | LL | let _: &'static [A] = &[C]; | ------------ ^^^ creates a temporary value which is freed while still in use @@ -19,6 +28,6 @@ LL | let _: &'static [A] = &[C]; LL | } | - temporary value is freed at the end of this statement -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/consts/promoted_const_call.stderr b/tests/ui/consts/promoted_const_call.stderr index ace449fae9c..64bf6bd73b0 100644 --- a/tests/ui/consts/promoted_const_call.stderr +++ b/tests/ui/consts/promoted_const_call.stderr @@ -1,10 +1,31 @@ -error[E0493]: destructor of `Panic` cannot be evaluated at compile-time +error: const `impl` for trait `Drop` which is not marked with `#[const_trait]` + --> $DIR/promoted_const_call.rs:7:12 + | +LL | impl const Drop for Panic { fn drop(&mut self) { panic!(); } } + | ^^^^ + | + = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` + = note: adding a non-const method body in the future would be a breaking change + +error[E0716]: temporary value dropped while borrowed + --> $DIR/promoted_const_call.rs:11:26 + | +LL | let _: &'static _ = &id(&Panic); + | ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | }; + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_const_call.rs:11:30 | LL | let _: &'static _ = &id(&Panic); - | ^^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constants + | ---------- ^^^^^ - temporary value is freed at the end of this statement + | | | + | | creates a temporary value which is freed while still in use + | type annotation requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_const_call.rs:17:26 @@ -48,7 +69,6 @@ LL | let _: &'static _ = &&(Panic, 0).1; LL | } | - temporary value is freed at the end of this statement -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0493, E0716. -For more information about an error, try `rustc --explain E0493`. +For more information about this error, try `rustc --explain E0716`. diff --git a/tests/ui/consts/rustc-impl-const-stability.stderr b/tests/ui/consts/rustc-impl-const-stability.stderr index 250d1c3fc05..84bd375ea40 100644 --- a/tests/ui/consts/rustc-impl-const-stability.stderr +++ b/tests/ui/consts/rustc-impl-const-stability.stderr @@ -16,15 +16,5 @@ LL | impl const Default for Data { = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change -error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates - --> $DIR/rustc-impl-const-stability.rs:15:6 - | -LL | impl const Default for Data { - | ^^^^^ unconstrained const parameter - | - = note: expressions using a const parameter must map each value to a distinct output value - = note: proving the result of expressions other than the parameter are unique is not supported +error: aborting due to 1 previous error; 1 warning emitted -error: aborting due to 2 previous errors; 1 warning emitted - -For more information about this error, try `rustc --explain E0207`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs index 62609384cff..78e41ca6b75 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/auxiliary/cross-crate.rs @@ -1,4 +1,5 @@ -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![allow(incomplete_features)] +#![feature(const_trait_impl, effects)] #[const_trait] pub trait MyTrait { diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs index fe4df09342f..69dcb403aa9 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs @@ -1,6 +1,6 @@ // Tests that trait bounds on specializing trait impls must be `~const` if the // same bound is present on the default impl and is `~const` there. -//@ check-pass +//@ known-bug: #110395 // FIXME(effects) ^ should error #![feature(const_trait_impl)] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr new file mode 100644 index 00000000000..b4c4cf0a890 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr @@ -0,0 +1,41 @@ +error[E0049]: method `bar` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const-default-bound-non-const-specialized-bound.rs:16:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Bar { +LL | fn bar(); + | - expected 0 const parameters + +error: cannot specialize on const impl with non-const impl + --> $DIR/const-default-bound-non-const-specialized-bound.rs:28:1 + | +LL | / impl Bar for T +LL | | where +LL | | T: Foo, //FIXME ~ ERROR missing `~const` qualifier +LL | | T: Specialize, + | |__________________^ + +error[E0049]: method `baz` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const-default-bound-non-const-specialized-bound.rs:36:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Baz { +LL | fn baz(); + | - expected 0 const parameters + +error[E0049]: method `baz` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const-default-bound-non-const-specialized-bound.rs:36:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Baz { +LL | fn baz(); + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs index c653e62032e..a48a50b9e5c 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.rs @@ -1,9 +1,10 @@ // Tests that a const default trait impl can be specialized by another const // trait impl and that the specializing impl will be used during const-eval. -//@ run-pass +//@ known-bug: #110395 +// FIXME(effects) run-pass -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #![feature(min_specialization)] #[const_trait] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.stderr index f533fb61aad..cabf201405f 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-const-specialized.stderr @@ -1,11 +1,36 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-default-const-specialized.rs:6:30 +error[E0049]: method `value` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const-default-const-specialized.rs:10:1 | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Value { +LL | fn value() -> u32; + | - expected 0 const parameters + +error[E0049]: method `value` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const-default-const-specialized.rs:10:1 | - = note: see issue #102090 for more information - = note: `#[warn(incomplete_features)]` on by default +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Value { +LL | fn value() -> u32; + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -warning: 1 warning emitted +error[E0015]: cannot call non-const fn `::value` in constant functions + --> $DIR/const-default-const-specialized.rs:16:5 + | +LL | T::value() + | ^^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0049. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.rs index bc45a70777c..d9ffd237dce 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.rs @@ -1,4 +1,5 @@ -//@ check-pass +//@ known-bug: #110395 +// FIXME check-pass #![feature(const_trait_impl)] #![feature(min_specialization)] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.stderr new file mode 100644 index 00000000000..52c8708f2c8 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/default-keyword.stderr @@ -0,0 +1,12 @@ +error[E0049]: method `foo` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/default-keyword.rs:7:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Foo { +LL | fn foo(); + | - expected 0 const parameters + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs index d80370aee82..219e5f3a600 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs @@ -1,6 +1,7 @@ // Tests that `~const` trait bounds can be used to specialize const trait impls. -//@ check-pass +//@ known-bug: #110395 +// FIXME check-pass #![feature(const_trait_impl)] #![feature(rustc_attrs)] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.stderr new file mode 100644 index 00000000000..1aa34637ca4 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.stderr @@ -0,0 +1,43 @@ +error[E0049]: method `foo` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95186-specialize-on-tilde-const.rs:14:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Foo { +LL | fn foo(); + | - expected 0 const parameters + +error[E0049]: method `foo` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95186-specialize-on-tilde-const.rs:14:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Foo { +LL | fn foo(); + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0049]: method `bar` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95186-specialize-on-tilde-const.rs:30:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Bar { +LL | fn bar() {} + | - expected 0 const parameters + +error[E0049]: method `bar` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95186-specialize-on-tilde-const.rs:30:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Bar { +LL | fn bar() {} + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs index d97469edaf9..7514baa2fd5 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs @@ -2,7 +2,8 @@ // `T: Foo` in the default impl for the purposes of specialization (i.e., it // does not think that the user is attempting to specialize on trait `Foo`). -//@ check-pass +//@ known-bug: #110395 +// FIXME check-pass #![feature(rustc_attrs)] #![feature(min_specialization)] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.stderr new file mode 100644 index 00000000000..0e0f391b086 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.stderr @@ -0,0 +1,43 @@ +error[E0049]: method `bar` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95187-same-trait-bound-different-constness.rs:18:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Bar { +LL | fn bar(); + | - expected 0 const parameters + +error[E0049]: method `bar` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95187-same-trait-bound-different-constness.rs:18:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Bar { +LL | fn bar(); + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0049]: method `baz` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95187-same-trait-bound-different-constness.rs:38:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Baz { +LL | fn baz(); + | - expected 0 const parameters + +error[E0049]: method `baz` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/issue-95187-same-trait-bound-different-constness.rs:38:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Baz { +LL | fn baz(); + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0049`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs index fc8fc3f2a1d..912b35095f9 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs @@ -1,9 +1,9 @@ // Tests that a non-const default impl can be specialized by a const trait impl, // but that the default impl cannot be used in a const context. //@ known-bug: #110395 -// FIXME run-pass +// FIXME(effects) run-pass -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #![feature(min_specialization)] #[const_trait] diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr index bcccc855aab..d49beb93259 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.stderr @@ -1,21 +1,36 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/non-const-default-const-specialized.rs:6:30 +error[E0049]: method `value` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/non-const-default-const-specialized.rs:9:1 | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Value { +LL | fn value() -> u32; + | - expected 0 const parameters + +error[E0049]: method `value` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/non-const-default-const-specialized.rs:9:1 | - = note: see issue #102090 for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0119]: conflicting implementations of trait `Value` for type `FortyTwo` - --> $DIR/non-const-default-const-specialized.rs:27:1 +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | trait Value { +LL | fn value() -> u32; + | - expected 0 const parameters | -LL | impl Value for T { - | ------------------- first implementation here -... -LL | impl const Value for FortyTwo { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `FortyTwo` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 1 previous error; 1 warning emitted +error[E0015]: cannot call non-const fn `::value` in constant functions + --> $DIR/non-const-default-const-specialized.rs:15:5 + | +LL | T::value() + | ^^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | -For more information about this error, try `rustc --explain E0119`. +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0015, E0049. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs index 364ddfcc8dd..516451d8811 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/trait-where-clause-const.rs @@ -3,8 +3,8 @@ // (`rustc_const_eval` instead of `rustc_hir_analysis`) Therefore one file as a // test is not enough. //@ known-bug: #110395 -// FIXME check-pass #![feature(const_trait_impl, effects)] +#![allow(incomplete_features)] #[const_trait] trait Bar {} @@ -19,9 +19,9 @@ trait Foo { const fn test1() { T::a(); T::b(); - //FIXME ~^ ERROR the trait bound + //~^ ERROR mismatched types T::c::(); - //FIXME ~^ ERROR the trait bound + //~^ ERROR mismatched types } const fn test2() { diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr index fc02f6f8f74..e39138983c6 100644 --- a/tests/ui/specialization/const_trait_impl.stderr +++ b/tests/ui/specialization/const_trait_impl.stderr @@ -1,3 +1,23 @@ +error[E0049]: method `foo` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const_trait_impl.rs:6:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | pub unsafe trait Sup { +LL | fn foo() -> u32; + | - expected 0 const parameters + +error[E0049]: method `foo` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const_trait_impl.rs:6:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | pub unsafe trait Sup { +LL | fn foo() -> u32; + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error: `~const` can only be applied to `#[const_trait]` traits --> $DIR/const_trait_impl.rs:34:16 | @@ -16,6 +36,37 @@ error: `~const` can only be applied to `#[const_trait]` traits LL | impl const A for T { | ^^^^^^^ +error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const_trait_impl.rs:29:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | pub trait A { +LL | fn a() -> u32; + | - expected 0 const parameters + +error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const_trait_impl.rs:29:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | pub trait A { +LL | fn a() -> u32; + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0049]: method `a` has 1 const parameter but its trait declaration has 0 const parameters + --> $DIR/const_trait_impl.rs:29:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ found 1 const parameter +LL | pub trait A { +LL | fn a() -> u32; + | - expected 0 const parameters + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0015]: cannot call non-const fn `<() as A>::a` in constants --> $DIR/const_trait_impl.rs:52:23 | @@ -52,6 +103,19 @@ help: add `#![feature(effects)]` to the crate attributes to enable LL + #![feature(effects)] | -error: aborting due to 6 previous errors +error[E0015]: cannot call non-const fn `::foo` in constant functions + --> $DIR/const_trait_impl.rs:48:9 + | +LL | T::foo() + | ^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: add `#![feature(effects)]` to the crate attributes to enable + | +LL + #![feature(effects)] + | -For more information about this error, try `rustc --explain E0015`. +error: aborting due to 12 previous errors + +Some errors have detailed explanations: E0015, E0049. +For more information about an error, try `rustc --explain E0015`.