-
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 #79635 - lcnr:const-eval-idk, r=oli-obk
const_evaluatable_checked: fix occurs check fixes #79615 this is kind of a hack because we use `TypeRelation` for both the `Generalizer` and the `ConstInferUnifier` but i am not sure if there is a useful way to disentangle this without unnecessarily duplicating some code. The error in the added test is kind of unavoidable until we erase the unused substs of `ConstKind::Unevaluated`. We talked a bit about this in the cg lazy norm meeting (https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/lazy_normalization_consts)
- Loading branch information
Showing
4 changed files
with
55 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`. |