Skip to content

Commit c5961ad

Browse files
committed
Auto merge of #21522 - nikomatsakis:assoc-type-ice-hunt-take-3, r=nick29581
Do not propagate the region requirements on the projected type to the input types it is being projected from. Fixes #21520. r? @aturon
2 parents ee0be3b + 69bc112 commit c5961ad

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/librustc_typeck/check/regionmanip.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
123123
// `<T as TraitRef<..>>::Name`
124124

125125
self.push_projection_constraint_from_top(data);
126-
127-
// this seems like a minimal requirement:
128-
let trait_def = ty::lookup_trait_def(self.tcx, data.trait_ref.def_id);
129-
self.accumulate_from_adt(ty, data.trait_ref.def_id,
130-
&trait_def.generics, data.trait_ref.substs)
131126
}
132127

133128
ty::ty_tup(ref tuptys) => {

src/test/run-pass/issue-21520.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Test that the requirement (in `Bar`) that `T::Bar : 'static` does
12+
// not wind up propagating to `T`.
13+
14+
pub trait Foo {
15+
type Bar;
16+
17+
fn foo(&self) -> Self;
18+
}
19+
20+
pub struct Static<T:'static>(T);
21+
22+
struct Bar<T:Foo>
23+
where T::Bar : 'static
24+
{
25+
x: Static<Option<T::Bar>>
26+
}
27+
28+
fn main() { }
29+

0 commit comments

Comments
 (0)