Constify Drop and Destruct
This commit is contained in:
parent
7db7489f9b
commit
bd44b632a8
23 changed files with 130 additions and 692 deletions
|
@ -957,6 +957,7 @@ marker_impls! {
|
|||
#[lang = "destruct"]
|
||||
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
|
||||
#[rustc_deny_explicit_impl(implement_via_object = false)]
|
||||
#[cfg_attr(not(bootstrap), const_trait)]
|
||||
pub trait Destruct {}
|
||||
|
||||
/// A marker for tuple types.
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
/// [nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle
|
||||
#[lang = "drop"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
// FIXME(const_trait_impl) #[const_trait]
|
||||
#[cfg_attr(not(bootstrap), const_trait)]
|
||||
pub trait Drop {
|
||||
/// Executes the destructor for this type.
|
||||
///
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-block-const-bound.rs:8:15
|
||||
error[E0277]: the trait bound `UnconstDrop: const Destruct` is not satisfied
|
||||
--> $DIR/const-block-const-bound.rs:18:9
|
||||
|
|
||||
LL | const fn f<T: ~const Destruct>(x: T) {}
|
||||
| ^^^^^^
|
||||
LL | f(UnconstDrop);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-block-const-bound.rs:8:15
|
||||
|
|
||||
LL | const fn f<T: ~const Destruct>(x: T) {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-block-const-bound.rs:8:32
|
||||
|
|
||||
LL | const fn f<T: ~const Destruct>(x: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
@ -16,12 +16,6 @@ error: `~const` can only be applied to `#[const_trait]` traits
|
|||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:14:24
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:14:8
|
||||
|
|
||||
|
@ -38,26 +32,12 @@ LL | T: ~const Fn<()> + ~const Destruct,
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:14:24
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:21:8
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:21:27
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:21:8
|
||||
|
|
||||
|
@ -74,14 +54,6 @@ LL | T: ~const FnMut<()> + ~const Destruct,
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:21:27
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:28:8
|
||||
|
|
||||
|
@ -110,12 +82,6 @@ error: `~const` can only be applied to `#[const_trait]` traits
|
|||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:35:24
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:35:8
|
||||
|
|
||||
|
@ -132,26 +98,12 @@ LL | T: ~const Fn<()> + ~const Destruct,
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:35:24
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:49:8
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:49:27
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:49:8
|
||||
|
|
||||
|
@ -168,29 +120,35 @@ LL | T: ~const FnMut<()> + ~const Destruct,
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:49:27
|
||||
error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:70:24
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
LL | let test_one = test_fn(one);
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/fn_trait_refs.rs:71:17
|
||||
error[E0277]: the trait bound `fn() -> i32 {two}: const Destruct` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:73:24
|
||||
|
|
||||
LL | assert!(test_one == (1, 1, 1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
LL | let test_two = test_fn_mut(two);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/fn_trait_refs.rs:74:17
|
||||
error[E0277]: the trait bound `&T: ~const Destruct` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:39:9
|
||||
|
|
||||
LL | assert!(test_two == (2, 2));
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
LL | tester_fn(&f),
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `&T: ~const Destruct` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:41:9
|
||||
|
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
LL | tester_fn_mut(&f),
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `&mut T: ~const Destruct` is not satisfied
|
||||
--> $DIR/fn_trait_refs.rs:53:9
|
||||
|
|
||||
LL | tester_fn_mut(&mut f),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:16:5
|
||||
|
@ -204,15 +162,6 @@ help: consider further restricting this bound
|
|||
LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(),
|
||||
| +++++++++++++
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:12:23
|
||||
|
|
||||
LL | const fn tester_fn<T>(f: T) -> T::Output
|
||||
| ^ the destructor for this type cannot be evaluated in constant functions
|
||||
...
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:23:5
|
||||
|
|
||||
|
@ -225,15 +174,6 @@ help: consider further restricting this bound
|
|||
LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(),
|
||||
| ++++++++++++++++
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:19:27
|
||||
|
|
||||
LL | const fn tester_fn_mut<T>(mut f: T) -> T::Output
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
...
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:30:5
|
||||
|
|
||||
|
@ -246,25 +186,7 @@ help: consider further restricting this bound
|
|||
LL | T: ~const FnOnce<()> + ~const FnOnce(),
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:33:21
|
||||
|
|
||||
LL | const fn test_fn<T>(mut f: T) -> (T::Output, T::Output, T::Output)
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
...
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
error: aborting due to 25 previous errors
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:47:25
|
||||
|
|
||||
LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
|
||||
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
...
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error: aborting due to 34 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0493, E0635.
|
||||
Some errors have detailed explanations: E0015, E0277, E0635.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
struct A();
|
||||
|
||||
impl const Drop for A {
|
||||
//~^ ERROR const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/promoted-const-drop.rs:5: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:12:26
|
||||
|
|
||||
LL | let _: &'static A = &A();
|
||||
| ---------- ^^^ creates a temporary value which is freed while still in use
|
||||
|
@ -19,7 +10,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:13:28
|
||||
|
|
||||
LL | let _: &'static [A] = &[C];
|
||||
| ------------ ^^^ creates a temporary value which is freed while still in use
|
||||
|
@ -28,6 +19,6 @@ LL | let _: &'static [A] = &[C];
|
|||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0716`.
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/promoted_const_call.rs:6: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[E0493]: destructor of `Panic` cannot be evaluated at compile-time
|
||||
--> $DIR/promoted_const_call.rs:10:30
|
||||
|
|
||||
|
@ -57,7 +48,7 @@ LL | let _: &'static _ = &&(Panic, 0).1;
|
|||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0493, E0716.
|
||||
For more information about an error, try `rustc --explain E0493`.
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
struct A();
|
||||
|
||||
impl const Drop for A {}
|
||||
//~^ ERROR: const trait impls are experimental
|
||||
//~| const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
//~| not all trait items implemented, missing: `drop`
|
||||
|
||||
fn main() {}
|
|
@ -1,31 +0,0 @@
|
|||
error[E0658]: const trait impls are experimental
|
||||
--> $DIR/const_drop_is_valid.rs:3:6
|
||||
|
|
||||
LL | impl const Drop for A {}
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
|
||||
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const_drop_is_valid.rs:3: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[E0046]: not all trait items implemented, missing: `drop`
|
||||
--> $DIR/const_drop_is_valid.rs:3:1
|
||||
|
|
||||
LL | impl const Drop for A {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
||||
|
|
||||
= help: implement the missing item: `fn drop(&mut self) { todo!() }`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0046, E0658.
|
||||
For more information about an error, try `rustc --explain E0046`.
|
|
@ -4,12 +4,6 @@ error: `~const` can only be applied to `#[const_trait]` traits
|
|||
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/normalize-tait-in-const.rs:26:62
|
||||
|
|
||||
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/normalize-tait-in-const.rs:26:35
|
||||
|
|
||||
|
@ -18,13 +12,11 @@ LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruc
|
|||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/normalize-tait-in-const.rs:26:62
|
||||
error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied
|
||||
--> $DIR/normalize-tait-in-const.rs:33:5
|
||||
|
|
||||
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
LL | with_positive(foo);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/normalize-tait-in-const.rs:27:5
|
||||
|
@ -38,16 +30,7 @@ help: consider further restricting this bound
|
|||
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) {
|
||||
| ++++++++++++++++++++++++++++
|
||||
|
||||
error[E0493]: destructor of `F` cannot be evaluated at compile-time
|
||||
--> $DIR/normalize-tait-in-const.rs:26:79
|
||||
|
|
||||
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
|
||||
| ^^^ the destructor for this type cannot be evaluated in constant functions
|
||||
LL | fun(filter_positive());
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0493.
|
||||
Some errors have detailed explanations: E0015, E0277.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
|
@ -1,53 +1,9 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:9:61
|
||||
error[E0277]: the trait bound `Foo<E>: ~const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-bound.rs:23:5
|
||||
|
|
||||
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
|
||||
| ^^^^^^
|
||||
LL | foo(res)
|
||||
| ^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:9:61
|
||||
|
|
||||
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:20:8
|
||||
|
|
||||
LL | T: ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:21:8
|
||||
|
|
||||
LL | E: ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:20:8
|
||||
|
|
||||
LL | T: ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:21:8
|
||||
|
|
||||
LL | E: ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `E` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-bound.rs:12:13
|
||||
|
|
||||
LL | Err(_e) => None,
|
||||
| ^^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
@ -1,26 +1,13 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail-2.rs:23:25
|
||||
error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-fail-2.rs:31:15
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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
|
||||
LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
|
||||
| _______________^
|
||||
LL | |
|
||||
LL | | ConstDropImplWithBounds(PhantomData)
|
||||
LL | | );
|
||||
| |_^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail-2.rs:29:26
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail-2.rs:39:25
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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 3 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//@ known-bug: #110395
|
||||
//@ revisions: stock precise
|
||||
|
||||
#![feature(const_trait_impl, const_destruct)]
|
||||
// #![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
|
||||
use std::marker::{Destruct, PhantomData};
|
||||
|
||||
|
@ -19,9 +20,7 @@ impl A for NonTrivialDrop {}
|
|||
|
||||
const fn check<T: ~const Destruct>(_: T) {}
|
||||
|
||||
|
||||
/* FIXME(const_trait_impl)
|
||||
struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
struct ConstDropImplWithBounds<T: A>(PhantomData<T>);
|
||||
|
||||
impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
||||
fn drop(&mut self) {
|
||||
|
@ -30,9 +29,9 @@ impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
|||
}
|
||||
|
||||
const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
|
||||
//~^ ERROR the trait bound
|
||||
ConstDropImplWithBounds(PhantomData)
|
||||
);
|
||||
*/
|
||||
|
||||
struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail-2.rs:39:25
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail-2.rs:20:19
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail-2.rs:20:19
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0277]: the trait bound `T: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail-2.rs:41:9
|
||||
|
|
||||
LL | T::a();
|
||||
| ^^^^^^
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail-2.rs:20:36
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0493.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
|
@ -1,26 +1,13 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail-2.rs:23:25
|
||||
error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-fail-2.rs:31:15
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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
|
||||
LL | const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
|
||||
| _______________^
|
||||
LL | |
|
||||
LL | | ConstDropImplWithBounds(PhantomData)
|
||||
LL | | );
|
||||
| |_^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail-2.rs:29:26
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail-2.rs:39:25
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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 3 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
@ -1,87 +1,32 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail.rs:19:12
|
||||
error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:27:23
|
||||
|
|
||||
LL | impl const Drop for ConstImplWithDropGlue {
|
||||
| ^^^^
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= 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
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail.rs:23:19
|
||||
error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:27:23
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail.rs:23:19
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail.rs:23:36
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
|
|
||||
= note: calling non-const function `<NonTrivialDrop as Drop>::drop`
|
||||
|
|
||||
note: inside `std::ptr::drop_in_place::<NonTrivialDrop> - shim(Some(NonTrivialDrop))`
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
note: inside `check::<NonTrivialDrop>`
|
||||
--> $DIR/const-drop-fail.rs:23:43
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^
|
||||
note: inside `_`
|
||||
--> $DIR/const-drop-fail.rs:27:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
|
|
||||
= note: calling non-const function `<NonTrivialDrop as Drop>::drop`
|
||||
|
|
||||
note: inside `std::ptr::drop_in_place::<NonTrivialDrop> - shim(Some(NonTrivialDrop))`
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
note: inside `std::ptr::drop_in_place::<ConstImplWithDropGlue> - shim(Some(ConstImplWithDropGlue))`
|
||||
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
||||
note: inside `check::<ConstImplWithDropGlue>`
|
||||
--> $DIR/const-drop-fail.rs:23:43
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^
|
||||
note: inside `_`
|
||||
--> $DIR/const-drop-fail.rs:27:23
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0080, E0493.
|
||||
For more information about an error, try `rustc --explain E0080`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@ known-bug: #110395
|
||||
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ revisions: stock precise
|
||||
|
||||
#![feature(const_trait_impl, const_destruct)]
|
||||
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
|
||||
|
@ -25,6 +25,8 @@ const fn check<T: ~const Destruct>(_: T) {}
|
|||
macro_rules! check_all {
|
||||
($($exp:expr),*$(,)?) => {$(
|
||||
const _: () = check($exp);
|
||||
//~^ ERROR the trait bound `NonTrivialDrop: const Destruct` is not satisfied
|
||||
//~| ERROR the trait bound `NonTrivialDrop: const Destruct` is not satisfied
|
||||
)*};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +1,32 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop-fail.rs:19:12
|
||||
error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:27:23
|
||||
|
|
||||
LL | impl const Drop for ConstImplWithDropGlue {
|
||||
| ^^^^
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= 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
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail.rs:23:19
|
||||
error[E0277]: the trait bound `NonTrivialDrop: const Destruct` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:27:23
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-fail.rs:23:19
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
LL | const _: () = check($exp);
|
||||
| ^^^^^^^^^^^
|
||||
...
|
||||
LL | / check_all! {
|
||||
LL | | NonTrivialDrop,
|
||||
LL | | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
LL | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
= note: this error originates in the macro `check_all` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop-fail.rs:23:36
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:12:16
|
||||
|
|
||||
LL | impl<'a> const Drop for S<'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: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:46:16
|
||||
|
|
||||
LL | impl const Drop for ConstDrop {
|
||||
| ^^^^
|
||||
|
|
||||
= 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 `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:67:37
|
||||
|
|
||||
LL | impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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 `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:75:30
|
||||
|
|
||||
LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop.rs:18:15
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop.rs:18:15
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0277]: the trait bound `T: const SomeTrait` is not satisfied
|
||||
--> $DIR/const-drop.rs:67:46
|
||||
|
|
||||
LL | impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `t::ConstDropWithBound`
|
||||
--> $DIR/const-drop.rs:65:38
|
||||
|
|
||||
LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
| ^^^^^ required by this bound in `ConstDropWithBound`
|
||||
|
||||
error[E0277]: the trait bound `T: const SomeTrait` is not satisfied
|
||||
--> $DIR/const-drop.rs:68:22
|
||||
|
|
||||
LL | fn drop(&mut self) {
|
||||
| ^^^^
|
||||
|
|
||||
note: required by a bound in `t::ConstDropWithBound`
|
||||
--> $DIR/const-drop.rs:65:38
|
||||
|
|
||||
LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
| ^^^^^ required by this bound in `ConstDropWithBound`
|
||||
|
||||
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:23:13
|
||||
|
|
||||
LL | let _ = S(&mut c);
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:18:32
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0277]: the trait bound `T: ~const SomeTrait` is not satisfied
|
||||
--> $DIR/const-drop.rs:69:13
|
||||
|
|
||||
LL | T::foo();
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0493.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
|
@ -1,6 +1,7 @@
|
|||
// FIXME run-pass
|
||||
//@ known-bug: #110395
|
||||
//@ run-pass
|
||||
//@ compile-flags: -Znext-solver
|
||||
//@ revisions: stock precise
|
||||
|
||||
#![feature(const_trait_impl, const_destruct)]
|
||||
#![feature(never_type)]
|
||||
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
|
@ -64,7 +65,7 @@ mod t {
|
|||
|
||||
pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
impl<T: const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
fn drop(&mut self) {
|
||||
T::foo();
|
||||
}
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:12:16
|
||||
|
|
||||
LL | impl<'a> const Drop for S<'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: const `impl` for trait `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:46:16
|
||||
|
|
||||
LL | impl const Drop for ConstDrop {
|
||||
| ^^^^
|
||||
|
|
||||
= 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 `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:67:37
|
||||
|
|
||||
LL | impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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 `Drop` which is not marked with `#[const_trait]`
|
||||
--> $DIR/const-drop.rs:75:30
|
||||
|
|
||||
LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> {
|
||||
| ^^^^
|
||||
|
|
||||
= 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` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop.rs:18:15
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop.rs:18:15
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0277]: the trait bound `T: const SomeTrait` is not satisfied
|
||||
--> $DIR/const-drop.rs:67:46
|
||||
|
|
||||
LL | impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `t::ConstDropWithBound`
|
||||
--> $DIR/const-drop.rs:65:38
|
||||
|
|
||||
LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
| ^^^^^ required by this bound in `ConstDropWithBound`
|
||||
|
||||
error[E0277]: the trait bound `T: const SomeTrait` is not satisfied
|
||||
--> $DIR/const-drop.rs:68:22
|
||||
|
|
||||
LL | fn drop(&mut self) {
|
||||
| ^^^^
|
||||
|
|
||||
note: required by a bound in `t::ConstDropWithBound`
|
||||
--> $DIR/const-drop.rs:65:38
|
||||
|
|
||||
LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
| ^^^^^ required by this bound in `ConstDropWithBound`
|
||||
|
||||
error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:23:13
|
||||
|
|
||||
LL | let _ = S(&mut c);
|
||||
| ^^^^^^^^^- value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/const-drop.rs:18:32
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(_: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error[E0277]: the trait bound `T: ~const SomeTrait` is not satisfied
|
||||
--> $DIR/const-drop.rs:69:13
|
||||
|
|
||||
LL | T::foo();
|
||||
| ^^^^^^^^
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0493.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
|
@ -1,7 +1,4 @@
|
|||
// Regression test for #92111.
|
||||
//
|
||||
//@ known-bug: #110395
|
||||
// FIXME check-pass
|
||||
//@ check-pass
|
||||
|
||||
#![feature(const_trait_impl, const_destruct)]
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/issue-92111.rs:20:15
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(t: T) {}
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/issue-92111.rs:20:15
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(t: T) {}
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/issue-92111.rs:20:32
|
||||
|
|
||||
LL | const fn a<T: ~const Destruct>(t: T) {}
|
||||
| ^ - value is dropped here
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0493`.
|
Loading…
Add table
Reference in a new issue