Auto merge of #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 ^^
This commit is contained in:
bors 2021-02-24 21:54:52 +00:00
commit 1fdadbf13a
9 changed files with 131 additions and 57 deletions

View file

@ -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>();
}

View file

@ -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;
}