-
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.
const_evaluatable_checked: fix occurs check
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 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
20 changes: 20 additions & 0 deletions
20
src/test/ui/const-generics/occurs-check/unused-substs-5.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,20 @@ | ||
#![feature(const_generics, const_evaluatable_checked)] | ||
#![allow(incomplete_features)] | ||
|
||
// `N + 1` also depends on `T` here even if it doesn't use it. | ||
fn q<T, const N: usize>(_: T) -> [u8; N + 1] { | ||
todo!() | ||
} | ||
|
||
fn supplier<T>() -> T { | ||
todo!() | ||
} | ||
|
||
fn catch_me<const N: usize>() where [u8; N + 1]: Default { | ||
let mut x = supplier(); | ||
x = q::<_, N>(x); //~ ERROR mismatched types | ||
} | ||
|
||
fn main() { | ||
catch_me::<3>(); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/const-generics/occurs-check/unused-substs-5.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,12 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/unused-substs-5.rs:15:9 | ||
| | ||
LL | x = q::<_, N>(x); | ||
| ^^^^^^^^^^^^ | ||
| | | ||
| cyclic type of infinite size | ||
| help: try using a conversion method: `q::<_, N>(x).to_vec()` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |