Use trait select logic instead of query
This commit is contained in:
parent
f0a52128ee
commit
1ca83c6451
5 changed files with 100 additions and 31 deletions
|
|
@ -16,16 +16,19 @@ impl const Drop for ConstImplWithDropGlue {
|
|||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
const fn check<T: ~const Drop>() {}
|
||||
const fn check<T: ~const Drop>(_: T) {}
|
||||
|
||||
macro_rules! check_all {
|
||||
($($T:ty),*$(,)?) => {$(
|
||||
const _: () = check::<$T>();
|
||||
($($exp:expr),*$(,)?) => {$(
|
||||
const _: () = check($exp);
|
||||
)*};
|
||||
}
|
||||
|
||||
check_all! {
|
||||
ConstImplWithDropGlue,
|
||||
NonTrivialDrop,
|
||||
//~^ ERROR the trait bound
|
||||
ConstImplWithDropGlue(NonTrivialDrop),
|
||||
//~^ ERROR the trait bound
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
27
src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stderr
Normal file
27
src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.stderr
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
error[E0277]: the trait bound `NonTrivialDrop: Drop` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:28:5
|
||||
|
|
||||
LL | NonTrivialDrop,
|
||||
| ^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `NonTrivialDrop`
|
||||
|
|
||||
note: required by a bound in `check`
|
||||
--> $DIR/const-drop-fail.rs:19:19
|
||||
|
|
||||
LL | const fn check<T: ~const Drop>(_: T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `check`
|
||||
|
||||
error[E0277]: the trait bound `ConstImplWithDropGlue: Drop` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:30:5
|
||||
|
|
||||
LL | ConstImplWithDropGlue(NonTrivialDrop),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Drop` is not implemented for `ConstImplWithDropGlue`
|
||||
|
|
||||
note: required by a bound in `check`
|
||||
--> $DIR/const-drop-fail.rs:19:19
|
||||
|
|
||||
LL | const fn check<T: ~const Drop>(_: T) {}
|
||||
| ^^^^^^^^^^^ required by this bound in `check`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue