Skip to content

Commit 56d336a

Browse files
committed
remove is global hack
1 parent 9fbd593 commit 56d336a

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

compiler/rustc_middle/src/ty/mod.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -1754,10 +1754,7 @@ impl<'tcx> ParamEnv<'tcx> {
17541754

17551755
/// Creates a suitable environment in which to perform trait
17561756
/// queries on the given value. When type-checking, this is simply
1757-
/// the pair of the environment plus value. But when reveal is set to
1758-
/// All, then if `value` does not reference any type parameters, we will
1759-
/// pair it with the empty environment. This improves caching and is generally
1760-
/// invisible.
1757+
/// the pair of the environment plus value.
17611758
///
17621759
/// N.B., we preserve the environment when type-checking because it
17631760
/// is possible for the user to have wacky where-clauses like
@@ -1767,14 +1764,7 @@ impl<'tcx> ParamEnv<'tcx> {
17671764
pub fn and<T: TypeVisitable<TyCtxt<'tcx>>>(self, value: T) -> ParamEnvAnd<'tcx, T> {
17681765
match self.reveal() {
17691766
Reveal::UserFacing => ParamEnvAnd { param_env: self, value },
1770-
1771-
Reveal::All => {
1772-
if value.is_global() {
1773-
ParamEnvAnd { param_env: self.without_caller_bounds(), value }
1774-
} else {
1775-
ParamEnvAnd { param_env: self, value }
1776-
}
1777-
}
1767+
Reveal::All => ParamEnvAnd { param_env: self, value },
17781768
}
17791769
}
17801770
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// check-pass
2+
trait Bar<'a> {
3+
type Assoc: 'static;
4+
}
5+
6+
impl<'a> Bar<'a> for () {
7+
type Assoc = ();
8+
}
9+
10+
struct ImplsStatic<CG: Bar<'static>> {
11+
d: &'static <CG as Bar<'static>>::Assoc,
12+
}
13+
14+
fn caller(b: ImplsStatic<()>)
15+
where
16+
for<'a> (): Bar<'a>
17+
{
18+
let _: &<() as Bar<'static>>::Assoc = b.d;
19+
}
20+
21+
fn main() {}

0 commit comments

Comments
 (0)