-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Try to evaluate in try unify and postpone resolution of constants that contain inference variables #95179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Try to evaluate in try unify and postpone resolution of constants that contain inference variables #95179
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
47f78a2
try to evaluate in try_unify
b-naber ac0458a
stall on on constants that contain infer vars in const_eval_resolve
b-naber 3b9de6b
dont try to unify unevaluated constants that contain infer vars
b-naber 6cf3409
add/update tests
b-naber 8ff1edb
fix previous failures and address review
b-naber fe69a5c
dont canonicalize in try_unify_abstract_consts and erase regions instead
b-naber 11a70db
erase region in ParamEnvAnd and make ConstUnifyCtxt private
b-naber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
26 changes: 26 additions & 0 deletions
26
src/test/ui/const-generics/generic_const_exprs/eval-try-unify.rs
This file contains hidden or 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,26 @@ | ||
// build-pass | ||
|
||
#![feature(generic_const_exprs)] | ||
//~^ WARNING the feature `generic_const_exprs` is incomplete | ||
|
||
trait Generic { | ||
const ASSOC: usize; | ||
} | ||
|
||
impl Generic for u8 { | ||
const ASSOC: usize = 17; | ||
} | ||
impl Generic for u16 { | ||
const ASSOC: usize = 13; | ||
} | ||
|
||
|
||
fn uses_assoc_type<T: Generic, const N: usize>() -> [u8; N + T::ASSOC] { | ||
[0; N + T::ASSOC] | ||
} | ||
|
||
fn only_generic_n<const N: usize>() -> [u8; N + 13] { | ||
uses_assoc_type::<u16, N>() | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr
This file contains hidden or 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 @@ | ||
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/eval-try-unify.rs:3:12 | ||
| | ||
LL | #![feature(generic_const_exprs)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information | ||
|
||
warning: 1 warning emitted | ||
|
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.