-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![feature(effects)] | ||
//~^ WARN: the feature `effects` is incomplete | ||
|
||
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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
error[E0658]: const trait impls are experimental | ||
--> $DIR/const_drop_is_valid.rs:6: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 | ||
|
||
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/const_drop_is_valid.rs:1:12 | ||
| | ||
LL | #![feature(effects)] | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: using `#![feature(effects)]` without enabling next trait solver globally | ||
| | ||
= note: the next trait solver must be enabled globally for the effects feature to work correctly | ||
= help: use `-Znext-solver` to enable | ||
|
||
error: const `impl` for trait `Drop` which is not marked with `#[const_trait]` | ||
--> $DIR/const_drop_is_valid.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[E0046]: not all trait items implemented, missing: `drop` | ||
--> $DIR/const_drop_is_valid.rs:6: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 4 previous errors; 1 warning emitted | ||
|
||
Some errors have detailed explanations: E0046, E0658. | ||
For more information about an error, try `rustc --explain E0046`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
struct Foo<T: Trait>(T); | ||
|
||
trait Trait { | ||
type Assoc; | ||
} | ||
|
||
impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T> { | ||
//~^ ERROR: `Drop` impl requires `<T as Trait>::Assoc == U` | ||
fn drop(&mut self) {} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0367]: `Drop` impl requires `<T as Trait>::Assoc == U` but the struct it is implemented for does not | ||
--> $DIR/constrained_by_assoc_type_equality.rs:7:15 | ||
| | ||
LL | impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T> { | ||
| ^^^^^^^^^ | ||
| | ||
note: the implementor must specify the same requirement | ||
--> $DIR/constrained_by_assoc_type_equality.rs:1:1 | ||
| | ||
LL | struct Foo<T: Trait>(T); | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0367`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@ known-bug: unknown | ||
//@ failure-status: 101 | ||
|
||
struct Foo {} | ||
|
||
impl<const UNUSED: usize> Drop for Foo {} | ||
|
||
fn main() {} |
Oops, something went wrong.