Skip to content

Commit baeff67

Browse files
authored
Rollup merge of #92997 - woppopo:test92114, r=Mark-Simulacrum
Add `~const` bound test for negative impls Resolves #92114 which has been fixed in #92892.
2 parents 71e5bfe + e6aef25 commit baeff67

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/test/ui/consts/const-block-const-bound.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(unused)]
2-
#![feature(const_fn_trait_bound, const_trait_impl, inline_const)]
2+
#![feature(const_fn_trait_bound, const_trait_impl, inline_const, negative_impls)]
33

44
const fn f<T: ~const Drop>(x: T) {}
55

@@ -9,9 +9,15 @@ impl Drop for UnconstDrop {
99
fn drop(&mut self) {}
1010
}
1111

12+
struct NonDrop;
13+
14+
impl !Drop for NonDrop {}
15+
1216
fn main() {
1317
const {
1418
f(UnconstDrop);
1519
//~^ ERROR the trait bound `UnconstDrop: Drop` is not satisfied
20+
f(NonDrop);
21+
//~^ ERROR the trait bound `NonDrop: Drop` is not satisfied
1622
}
1723
}

src/test/ui/consts/const-block-const-bound.stderr

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `UnconstDrop: Drop` is not satisfied
2-
--> $DIR/const-block-const-bound.rs:14:11
2+
--> $DIR/const-block-const-bound.rs:18:11
33
|
44
LL | f(UnconstDrop);
55
| - ^^^^^^^^^^^ the trait `Drop` is not implemented for `UnconstDrop`
@@ -16,6 +16,20 @@ help: consider introducing a `where` bound, but there might be an alternative be
1616
LL | fn main() where UnconstDrop: Drop {
1717
| +++++++++++++++++++++++
1818

19-
error: aborting due to previous error
19+
error[E0277]: the trait bound `NonDrop: Drop` is not satisfied
20+
--> $DIR/const-block-const-bound.rs:20:11
21+
|
22+
LL | f(NonDrop);
23+
| - ^^^^^^^ the trait `Drop` is not implemented for `NonDrop`
24+
| |
25+
| required by a bound introduced by this call
26+
|
27+
note: required by a bound in `f`
28+
--> $DIR/const-block-const-bound.rs:4:15
29+
|
30+
LL | const fn f<T: ~const Drop>(x: T) {}
31+
| ^^^^^^^^^^^ required by this bound in `f`
32+
33+
error: aborting due to 2 previous errors
2034

2135
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)