Skip to content

Do not propagate the region requirements on the projected type to the types it is projected from #21522

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 1 commit into from
Jan 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/librustc_typeck/check/regionmanip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
// `<T as TraitRef<..>>::Name`

self.push_projection_constraint_from_top(data);

// this seems like a minimal requirement:
let trait_def = ty::lookup_trait_def(self.tcx, data.trait_ref.def_id);
self.accumulate_from_adt(ty, data.trait_ref.def_id,
&trait_def.generics, data.trait_ref.substs)
}

ty::ty_tup(ref tuptys) => {
Expand Down
29 changes: 29 additions & 0 deletions src/test/run-pass/issue-21520.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Test that the requirement (in `Bar`) that `T::Bar : 'static` does
// not wind up propagating to `T`.

pub trait Foo {
type Bar;

fn foo(&self) -> Self;
}

pub struct Static<T:'static>(T);

struct Bar<T:Foo>
where T::Bar : 'static
{
x: Static<Option<T::Bar>>
}

fn main() { }