-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deny capturing late-bound non-lifetime param in anon const
- Loading branch information
1 parent
b583ede
commit cbf4d4e
Showing
5 changed files
with
121 additions
and
5 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
11 changes: 11 additions & 0 deletions
11
tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.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,11 @@ | ||
#![feature(non_lifetime_binders, generic_const_exprs)] | ||
//~^ WARN the feature `non_lifetime_binders` is incomplete | ||
//~| WARN the feature `generic_const_exprs` is incomplete | ||
|
||
fn foo() -> usize | ||
where | ||
for<T> [i32; { let _: T = todo!(); 0 }]:, | ||
//~^ ERROR cannot capture late-bound type parameter in a constant | ||
{} | ||
|
||
fn main() {} |
27 changes: 27 additions & 0 deletions
27
tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.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,27 @@ | ||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/late-bound-in-anon-ct.rs:1:12 | ||
| | ||
LL | #![feature(non_lifetime_binders, generic_const_exprs)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/late-bound-in-anon-ct.rs:1:34 | ||
| | ||
LL | #![feature(non_lifetime_binders, generic_const_exprs)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information | ||
|
||
error: cannot capture late-bound type parameter in a constant | ||
--> $DIR/late-bound-in-anon-ct.rs:7:27 | ||
| | ||
LL | for<T> [i32; { let _: T = todo!(); 0 }]:, | ||
| - ^ | ||
| | | ||
| parameter defined here | ||
|
||
error: aborting due to previous error; 2 warnings emitted | ||
|