-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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 #108189 - compiler-errors:non_lifetime_binders-bound-…
…stuff, r=jackh726 Fix some more `non_lifetime_binders` stuff with higher-ranked trait bounds 1. When assembling candidates for `for<T> T: Sized`, we can't ICE because the self-type is a bound type. 2. Fix an issue where, when canonicalizing in non-universe preserving mode, we don't actually set the universe for placeholders to the root even though we do the same for region vars. 3. Make `Placeholder("T")` format like `T` in error messages. Fixes #108180 Fixes #108182 r? types
- Loading branch information
Showing
5 changed files
with
103 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![feature(non_lifetime_binders)] | ||
//~^ WARN is incomplete and may not be safe | ||
|
||
pub fn foo() | ||
where | ||
for<V> V: Sized, | ||
{ | ||
} | ||
|
||
pub fn bar() | ||
where | ||
for<V> V: IntoIterator, | ||
{ | ||
} | ||
|
||
fn main() { | ||
foo(); | ||
//~^ ERROR the size for values of type `V` cannot be known at compilation time | ||
|
||
bar(); | ||
//~^ ERROR the size for values of type `V` cannot be known at compilation time | ||
//~| ERROR `V` is not an iterator | ||
} |
62 changes: 62 additions & 0 deletions
62
tests/ui/traits/non_lifetime_binders/bad-sized-cond.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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/bad-sized-cond.rs:1:12 | ||
| | ||
LL | #![feature(non_lifetime_binders)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error[E0277]: the size for values of type `V` cannot be known at compilation time | ||
--> $DIR/bad-sized-cond.rs:17:5 | ||
| | ||
LL | foo(); | ||
| ^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `V` | ||
note: required by a bound in `foo` | ||
--> $DIR/bad-sized-cond.rs:6:15 | ||
| | ||
LL | pub fn foo() | ||
| --- required by a bound in this | ||
LL | where | ||
LL | for<V> V: Sized, | ||
| ^^^^^ required by this bound in `foo` | ||
|
||
error[E0277]: the size for values of type `V` cannot be known at compilation time | ||
--> $DIR/bad-sized-cond.rs:20:5 | ||
| | ||
LL | bar(); | ||
| ^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `V` | ||
= note: required for `V` to implement `IntoIterator` | ||
note: required by a bound in `bar` | ||
--> $DIR/bad-sized-cond.rs:12:15 | ||
| | ||
LL | pub fn bar() | ||
| --- required by a bound in this | ||
LL | where | ||
LL | for<V> V: IntoIterator, | ||
| ^^^^^^^^^^^^ required by this bound in `bar` | ||
|
||
error[E0277]: `V` is not an iterator | ||
--> $DIR/bad-sized-cond.rs:20:5 | ||
| | ||
LL | bar(); | ||
| ^^^ `V` is not an iterator | ||
| | ||
= help: the trait `Iterator` is not implemented for `V` | ||
= note: required for `V` to implement `IntoIterator` | ||
note: required by a bound in `bar` | ||
--> $DIR/bad-sized-cond.rs:12:15 | ||
| | ||
LL | pub fn bar() | ||
| --- required by a bound in this | ||
LL | where | ||
LL | for<V> V: IntoIterator, | ||
| ^^^^^^^^^^^^ required by this bound in `bar` | ||
|
||
error: aborting due to 3 previous errors; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0277`. |