mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
Check drop is trivial before checking ty needs drop
This commit is contained in:
parent
af0d566e76
commit
69a38de977
@ -175,6 +175,11 @@ impl Qualif for NeedsNonConstDrop {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this doesn't need drop at all, then don't select `~const Destruct`.
|
||||
if !ty.needs_drop(cx.tcx, cx.typing_env) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We check that the type is `~const Destruct` since that will verify that
|
||||
// the type is both `~const Drop` (if a drop impl exists for the adt), *and*
|
||||
// that the components of this type are also `~const Destruct`. This
|
||||
@ -203,7 +208,7 @@ impl Qualif for NeedsNonConstDrop {
|
||||
// in its value since:
|
||||
// 1. The destructor may have `~const` bounds which are not present on the type.
|
||||
// Someone needs to check that those are satisfied.
|
||||
// While this could be done instead satisfied by checking that the `~const Drop`
|
||||
// While this could be instead satisfied by checking that the `~const Drop`
|
||||
// impl holds (i.e. replicating part of the `in_any_value_of_ty` logic above),
|
||||
// even in this case, we have another problem, which is,
|
||||
// 2. The destructor may *modify* the operand being dropped, so even if we
|
||||
|
@ -426,7 +426,7 @@ declare_features! (
|
||||
(unstable, const_async_blocks, "1.53.0", Some(85368)),
|
||||
/// Allows `const || {}` closures in const contexts.
|
||||
(incomplete, const_closures, "1.68.0", Some(106003)),
|
||||
/// Uwu
|
||||
/// Allows using `~const Destruct` bounds and calling drop impls in const contexts.
|
||||
(unstable, const_destruct, "CURRENT_RUSTC_VERSION", Some(133214)),
|
||||
/// Allows `for _ in _` loops in const contexts.
|
||||
(unstable, const_for, "1.56.0", Some(87575)),
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
pub mod tls;
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::assert_matches::{assert_matches, debug_assert_matches};
|
||||
use std::borrow::Borrow;
|
||||
use std::cmp::Ordering;
|
||||
use std::hash::{Hash, Hasher};
|
||||
@ -377,14 +377,17 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
|
||||
}
|
||||
|
||||
fn impl_is_const(self, def_id: DefId) -> bool {
|
||||
debug_assert_matches!(self.def_kind(def_id), DefKind::Impl { of_trait: true });
|
||||
self.is_conditionally_const(def_id)
|
||||
}
|
||||
|
||||
fn fn_is_const(self, def_id: DefId) -> bool {
|
||||
debug_assert_matches!(self.def_kind(def_id), DefKind::Fn | DefKind::AssocFn);
|
||||
self.is_conditionally_const(def_id)
|
||||
}
|
||||
|
||||
fn alias_has_const_conditions(self, def_id: DefId) -> bool {
|
||||
debug_assert_matches!(self.def_kind(def_id), DefKind::AssocTy | DefKind::OpaqueTy);
|
||||
self.is_conditionally_const(def_id)
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//@ known-bug: #103507
|
||||
|
||||
#![allow(unused)]
|
||||
#![feature(const_trait_impl, negative_impls)]
|
||||
#![feature(const_trait_impl, negative_impls, const_destruct)]
|
||||
|
||||
use std::marker::Destruct;
|
||||
|
||||
|
@ -1,23 +1,3 @@
|
||||
error[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-block-const-bound.rs:6:5
|
||||
|
|
||||
LL | use std::marker::Destruct;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-block-const-bound.rs:8:22
|
||||
|
|
||||
LL | const fn f<T: ~const Destruct>(x: T) {}
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-block-const-bound.rs:8:15
|
||||
|
|
||||
@ -40,7 +20,6 @@ LL | const fn f<T: ~const Destruct>(x: T) {}
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0493, E0658.
|
||||
For more information about an error, try `rustc --explain E0493`.
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -5,6 +5,7 @@
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_cmp)]
|
||||
#![feature(const_destruct)]
|
||||
|
||||
use std::marker::Destruct;
|
||||
|
||||
|
@ -1,53 +1,3 @@
|
||||
error[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/fn_trait_refs.rs:9:5
|
||||
|
|
||||
LL | use std::marker::Destruct;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/fn_trait_refs.rs:13:31
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/fn_trait_refs.rs:20:34
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/fn_trait_refs.rs:34:31
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/fn_trait_refs.rs:48:34
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0635]: unknown feature `const_fn_trait_ref_impls`
|
||||
--> $DIR/fn_trait_refs.rs:3:12
|
||||
|
|
||||
@ -61,19 +11,19 @@ LL | #![feature(const_cmp)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:13:8
|
||||
--> $DIR/fn_trait_refs.rs:14:8
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:13:24
|
||||
--> $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:13:8
|
||||
--> $DIR/fn_trait_refs.rs:14:8
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -81,7 +31,7 @@ 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:13:8
|
||||
--> $DIR/fn_trait_refs.rs:14:8
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -89,7 +39,7 @@ 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:13:24
|
||||
--> $DIR/fn_trait_refs.rs:14:24
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -97,19 +47,19 @@ 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:20:8
|
||||
--> $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:20:27
|
||||
--> $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:20:8
|
||||
--> $DIR/fn_trait_refs.rs:21:8
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -117,7 +67,7 @@ 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:20:8
|
||||
--> $DIR/fn_trait_refs.rs:21:8
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -125,7 +75,7 @@ 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:20:27
|
||||
--> $DIR/fn_trait_refs.rs:21:27
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -133,13 +83,13 @@ 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:27:8
|
||||
--> $DIR/fn_trait_refs.rs:28:8
|
||||
|
|
||||
LL | T: ~const FnOnce<()>,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:27:8
|
||||
--> $DIR/fn_trait_refs.rs:28:8
|
||||
|
|
||||
LL | T: ~const FnOnce<()>,
|
||||
| ^^^^^^
|
||||
@ -147,7 +97,7 @@ LL | T: ~const FnOnce<()>,
|
||||
= 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:27:8
|
||||
--> $DIR/fn_trait_refs.rs:28:8
|
||||
|
|
||||
LL | T: ~const FnOnce<()>,
|
||||
| ^^^^^^
|
||||
@ -155,19 +105,19 @@ LL | T: ~const FnOnce<()>,
|
||||
= 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:34:8
|
||||
--> $DIR/fn_trait_refs.rs:35:8
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
|
||||
error: `~const` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/fn_trait_refs.rs:34:24
|
||||
--> $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:34:8
|
||||
--> $DIR/fn_trait_refs.rs:35:8
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -175,7 +125,7 @@ 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:34:8
|
||||
--> $DIR/fn_trait_refs.rs:35:8
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -183,7 +133,7 @@ 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:34:24
|
||||
--> $DIR/fn_trait_refs.rs:35:24
|
||||
|
|
||||
LL | T: ~const Fn<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -191,19 +141,19 @@ 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:48:8
|
||||
--> $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:48:27
|
||||
--> $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:48:8
|
||||
--> $DIR/fn_trait_refs.rs:49:8
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -211,7 +161,7 @@ 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:48:8
|
||||
--> $DIR/fn_trait_refs.rs:49:8
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -219,7 +169,7 @@ 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:48:27
|
||||
--> $DIR/fn_trait_refs.rs:49:27
|
||||
|
|
||||
LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
| ^^^^^^
|
||||
@ -227,7 +177,7 @@ LL | T: ~const FnMut<()> + ~const Destruct,
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/fn_trait_refs.rs:70:17
|
||||
--> $DIR/fn_trait_refs.rs:71:17
|
||||
|
|
||||
LL | assert!(test_one == (1, 1, 1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -235,7 +185,7 @@ LL | assert!(test_one == (1, 1, 1));
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const operator in constants
|
||||
--> $DIR/fn_trait_refs.rs:73:17
|
||||
--> $DIR/fn_trait_refs.rs:74:17
|
||||
|
|
||||
LL | assert!(test_two == (2, 2));
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
@ -243,7 +193,7 @@ LL | assert!(test_two == (2, 2));
|
||||
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:15:5
|
||||
--> $DIR/fn_trait_refs.rs:16:5
|
||||
|
|
||||
LL | f()
|
||||
| ^^^
|
||||
@ -255,7 +205,7 @@ LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(),
|
||||
| +++++++++++++
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:11:23
|
||||
--> $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
|
||||
@ -264,7 +214,7 @@ LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:22:5
|
||||
--> $DIR/fn_trait_refs.rs:23:5
|
||||
|
|
||||
LL | f()
|
||||
| ^^^
|
||||
@ -276,7 +226,7 @@ LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(),
|
||||
| ++++++++++++++++
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:18:27
|
||||
--> $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
|
||||
@ -285,7 +235,7 @@ LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error[E0015]: cannot call non-const closure in constant functions
|
||||
--> $DIR/fn_trait_refs.rs:29:5
|
||||
--> $DIR/fn_trait_refs.rs:30:5
|
||||
|
|
||||
LL | f()
|
||||
| ^^^
|
||||
@ -297,7 +247,7 @@ LL | T: ~const FnOnce<()> + ~const FnOnce(),
|
||||
| +++++++++++++++++
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:32:21
|
||||
--> $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
|
||||
@ -306,7 +256,7 @@ LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
||||
--> $DIR/fn_trait_refs.rs:46:25
|
||||
--> $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
|
||||
@ -314,7 +264,7 @@ LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
|
||||
LL | }
|
||||
| - value is dropped here
|
||||
|
||||
error: aborting due to 39 previous errors
|
||||
error: aborting due to 34 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0493, E0635, E0658.
|
||||
Some errors have detailed explanations: E0015, E0493, E0635.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FIXME check-pass
|
||||
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
#![feature(const_precise_live_drops, const_destruct)]
|
||||
|
||||
use std::marker::Destruct;
|
||||
|
||||
|
@ -1,43 +1,3 @@
|
||||
error[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-drop-bound.rs:7:5
|
||||
|
|
||||
LL | use std::marker::Destruct;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-drop-bound.rs:9:68
|
||||
|
|
||||
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-drop-bound.rs:20:15
|
||||
|
|
||||
LL | T: ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-drop-bound.rs:21:15
|
||||
|
|
||||
LL | E: ~const Destruct,
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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` can only be applied to `#[const_trait]` traits
|
||||
--> $DIR/const-drop-bound.rs:9:61
|
||||
|
|
||||
@ -88,7 +48,6 @@ LL | Err(_e) => None,
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0493, E0658.
|
||||
For more information about an error, try `rustc --explain E0493`.
|
||||
For more information about this error, try `rustc --explain E0493`.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//@ known-bug: #110395
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_impl, const_destruct)]
|
||||
// #![cfg_attr(precise, feature(const_precise_live_drops))]
|
||||
|
||||
use std::marker::{Destruct, PhantomData};
|
||||
|
@ -1,23 +1,3 @@
|
||||
error[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-drop-fail-2.rs:5:19
|
||||
|
|
||||
LL | use std::marker::{Destruct, PhantomData};
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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[E0658]: use of unstable library feature `const_destruct`
|
||||
--> $DIR/const-drop-fail-2.rs:20:26
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: see issue #133214 <https://github.com/rust-lang/rust/issues/133214> for more information
|
||||
= help: add `#![feature(const_destruct)]` 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-fail-2.rs:39:25
|
||||
|
|
||||
@ -55,7 +35,7 @@ LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| |
|
||||
| the destructor for this type cannot be evaluated in constant functions
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0493, E0658.
|
||||
Some errors have detailed explanations: E0277, E0493.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -12,7 +12,7 @@
|
||||
fundamental,
|
||||
marker_trait_attr,
|
||||
const_trait_impl,
|
||||
const_destruct,
|
||||
const_destruct
|
||||
)]
|
||||
#![allow(internal_features, incomplete_features)]
|
||||
#![no_std]
|
||||
@ -450,7 +450,7 @@ pub trait Clone: Sized {
|
||||
fn clone(&self) -> Self;
|
||||
fn clone_from(&mut self, source: &Self)
|
||||
where
|
||||
Self: ~const Destruct,
|
||||
Self: ~const Destruct,
|
||||
{
|
||||
*self = source.clone()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user