forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#119354 - fmease:negative_bounds-fixes, r=compiler-errors Make `negative_bounds` internal & fix some of its issues r? compiler-errors
- Loading branch information
Showing
16 changed files
with
251 additions
and
90 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
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
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
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
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
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
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
20 changes: 9 additions & 11 deletions
20
tests/ui/traits/negative-bounds/associated-constraints.stderr
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 |
---|---|---|
@@ -1,34 +1,32 @@ | ||
error: associated type constraints not allowed on negative bounds | ||
--> $DIR/associated-constraints.rs:8:19 | ||
--> $DIR/associated-constraints.rs:7:19 | ||
| | ||
LL | fn test<T: !Trait<Assoc = i32>>() {} | ||
| ^^^^^^^^^^^ | ||
|
||
error: associated type constraints not allowed on negative bounds | ||
--> $DIR/associated-constraints.rs:11:31 | ||
--> $DIR/associated-constraints.rs:10:31 | ||
| | ||
LL | fn test2<T>() where T: !Trait<Assoc = i32> {} | ||
| ^^^^^^^^^^^ | ||
|
||
error: associated type constraints not allowed on negative bounds | ||
--> $DIR/associated-constraints.rs:14:20 | ||
--> $DIR/associated-constraints.rs:13:20 | ||
| | ||
LL | fn test3<T: !Trait<Assoc: Send>>() {} | ||
| ^^^^^^^^^^^ | ||
|
||
error: associated type constraints not allowed on negative bounds | ||
--> $DIR/associated-constraints.rs:17:31 | ||
--> $DIR/associated-constraints.rs:16:31 | ||
| | ||
LL | fn test4<T>() where T: !Trait<Assoc: Send> {} | ||
| ^^^^^^^^^^^ | ||
|
||
warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/associated-constraints.rs:1:12 | ||
error: parenthetical notation may not be used for negative bounds | ||
--> $DIR/associated-constraints.rs:19:25 | ||
| | ||
LL | #![feature(negative_bounds, associated_type_bounds)] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
LL | fn test5<T>() where T: !Fn() -> i32 {} | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to 4 previous errors; 1 warning emitted | ||
error: aborting due to 5 previous errors | ||
|
23 changes: 23 additions & 0 deletions
23
tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs
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,23 @@ | ||
// compile-flags: -Znext-solver | ||
|
||
#![feature(negative_bounds, negative_impls)] | ||
|
||
trait Trait {} | ||
impl !Trait for () {} | ||
|
||
fn produce() -> impl !Trait {} | ||
fn consume(_: impl Trait) {} | ||
|
||
fn main() { | ||
consume(produce()); //~ ERROR the trait bound `impl !Trait: Trait` is not satisfied | ||
} | ||
|
||
fn weird0() -> impl Sized + !Sized {} | ||
//~^ ERROR mismatched types | ||
//~| ERROR type mismatch resolving `() == impl !Sized + Sized` | ||
fn weird1() -> impl !Sized + Sized {} | ||
//~^ ERROR mismatched types | ||
//~| ERROR type mismatch resolving `() == impl !Sized + Sized` | ||
fn weird2() -> impl !Sized {} | ||
//~^ ERROR mismatched types | ||
//~| ERROR type mismatch resolving `() == impl !Sized` |
Oops, something went wrong.