-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #96899 - oli-obk:closure_wf_check_bounds, r=nikomatsakis
- Loading branch information
Showing
24 changed files
with
325 additions
and
186 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#![feature(generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ||
//~^ ERROR overly complex generic constant | ||
//~^ ERROR cycle detected when building an abstract representation | ||
|
||
fn main() {} |
25 changes: 19 additions & 6 deletions
25
src/test/ui/const-generics/generic_const_exprs/closures.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,13 +1,26 @@ | ||
error: overly complex generic constant | ||
error[E0391]: cycle detected when building an abstract representation for test::{constant#0} | ||
--> $DIR/closures.rs:3:35 | ||
| | ||
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ||
| ^^^^-------^^ | ||
| | | ||
| borrowing is not supported in generic constants | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= help: consider moving this anonymous constant into a `const` function | ||
= note: this operation may be supported in the future | ||
note: ...which requires building THIR for `test::{constant#0}`... | ||
--> $DIR/closures.rs:3:35 | ||
| | ||
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ||
| ^^^^^^^^^^^^^ | ||
note: ...which requires type-checking `test::{constant#0}`... | ||
--> $DIR/closures.rs:3:35 | ||
| | ||
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ||
| ^^^^^^^^^^^^^ | ||
= note: ...which again requires building an abstract representation for test::{constant#0}, completing the cycle | ||
note: cycle used when checking that `test` is well-formed | ||
--> $DIR/closures.rs:3:1 | ||
| | ||
LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0391`. |
18 changes: 18 additions & 0 deletions
18
src/test/ui/higher-rank-trait-bounds/issue-59311.nll.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,18 @@ | ||
error: higher-ranked lifetime error | ||
--> $DIR/issue-59311.rs:17:5 | ||
| | ||
LL | v.t(|| {}); | ||
| ^^^^^^^^^^ | ||
| | ||
= note: could not prove [closure@$DIR/issue-59311.rs:17:9: 17:14] well-formed | ||
|
||
error: higher-ranked lifetime error | ||
--> $DIR/issue-59311.rs:17:9 | ||
| | ||
LL | v.t(|| {}); | ||
| ^^^^^ | ||
| | ||
= note: could not prove for<'a> &'a V: 'static | ||
|
||
error: aborting due to 2 previous errors | ||
|
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
error: higher-ranked lifetime error | ||
--> $DIR/issue-59311.rs:17:9 | ||
error[E0477]: the type `&'a V` does not fulfill the required lifetime | ||
--> $DIR/issue-59311.rs:17:5 | ||
| | ||
LL | v.t(|| {}); | ||
| ^^^^^ | ||
| ^^^^^^^^^^ | ||
| | ||
= note: could not prove for<'a> &'a V: 'static | ||
note: type must satisfy the static lifetime as required by this binding | ||
--> $DIR/issue-59311.rs:15:24 | ||
| | ||
LL | for<'a> &'a V: T + 'static, | ||
| ^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0477`. |
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
Oops, something went wrong.