forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#82159 - BoxyUwU:uwu, r=varkor
Use correct param_env in conservative_is_privately_uninhabited cc `@lcnr` r? `@varkor` since this is your FIXME that was removed ^^
- Loading branch information
Showing
9 changed files
with
131 additions
and
57 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
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
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
27 changes: 27 additions & 0 deletions
27
src/test/ui/const-generics/conservative_is_privately_uninhabited_uses_correct_param_env-1.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,27 @@ | ||
// run-pass | ||
#![feature(const_generics, const_evaluatable_checked)] | ||
#![allow(incomplete_features)] | ||
|
||
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause | ||
// ICEs by trying to evaluate `T::ASSOC` with an incorrect `ParamEnv`. | ||
|
||
trait Foo { | ||
const ASSOC: usize = 1; | ||
} | ||
|
||
struct Iced<T: Foo>(T, [(); T::ASSOC]) | ||
where | ||
[(); T::ASSOC]: ; | ||
|
||
impl Foo for u32 {} | ||
|
||
fn foo<T: Foo>() | ||
where | ||
[(); T::ASSOC]: , | ||
{ | ||
let _iced: Iced<T> = return; | ||
} | ||
|
||
fn main() { | ||
foo::<u32>(); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/const-generics/conservative_is_privately_uninhabited_uses_correct_param_env-2.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 @@ | ||
// run-pass | ||
#![feature(const_generics, const_evaluatable_checked)] | ||
#![allow(incomplete_features)] | ||
|
||
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause | ||
// ICEs by trying to evaluate `T::ASSOC` with an incorrect `ParamEnv`. | ||
|
||
trait Foo { | ||
const ASSOC: usize = 1; | ||
} | ||
|
||
struct Iced<T: Foo>(T, [(); T::ASSOC]) | ||
where | ||
[(); T::ASSOC]: ; | ||
|
||
impl Foo for u32 {} | ||
|
||
fn main() { | ||
let _iced: Iced<u32> = return; | ||
} |