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#136884 - compiler-errors:fn-zst, r=BoxyUwU Lower fn items as ZST valtrees and delay a bug Lower it as a ZST instead of a const error, which we can handle mostly fine. Delay a bug so we don't accidentally support it tho. r? BoxyUwU Fixes rust-lang#136855 Fixes rust-lang#136853 Fixes rust-lang#136854 Fixes rust-lang#136337 Only added one test bc that's really the crux of the issue (fn item in array length position).
- Loading branch information
Showing
4 changed files
with
50 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
13 changes: 13 additions & 0 deletions
13
tests/ui/const-generics/mgca/unexpected-fn-item-in-array.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,13 @@ | ||
// Make sure we don't ICE when encountering an fn item during lowering in mGCA. | ||
|
||
#![feature(min_generic_const_args)] | ||
//~^ WARN the feature `min_generic_const_args` is incomplete | ||
|
||
trait A<T> {} | ||
|
||
impl A<[usize; fn_item]> for () {} | ||
//~^ ERROR the constant `fn_item` is not of type `usize` | ||
|
||
fn fn_item() {} | ||
|
||
fn main() {} |
19 changes: 19 additions & 0 deletions
19
tests/ui/const-generics/mgca/unexpected-fn-item-in-array.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,19 @@ | ||
warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/unexpected-fn-item-in-array.rs:3:12 | ||
| | ||
LL | #![feature(min_generic_const_args)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: the constant `fn_item` is not of type `usize` | ||
--> $DIR/unexpected-fn-item-in-array.rs:8:6 | ||
| | ||
LL | impl A<[usize; fn_item]> for () {} | ||
| ^^^^^^^^^^^^^^^^^^^ expected `usize`, found fn item | ||
| | ||
= note: the length of array `[usize; fn_item]` must be type `usize` | ||
|
||
error: aborting due to 1 previous error; 1 warning emitted | ||
|