Skip to content
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

Clarify outlives requirements on associated types #20303

Closed
nikomatsakis opened this issue Dec 29, 2014 · 1 comment · Fixed by #20465
Closed

Clarify outlives requirements on associated types #20303

nikomatsakis opened this issue Dec 29, 2014 · 1 comment · Fixed by #20465

Comments

@nikomatsakis
Copy link
Contributor

Right now we check that the outlives requirements in the trait are met, but say nothing about an associated type. I think the correct thing is to treat them exactly like type parameters, basically. So we should be checking that they outlive the relevant region bound -- and we should assume that they outlive the current fn, but nothing else. This seems to be roughly equivalent to the current treatment of type parameters (for better/worse).

@nikomatsakis
Copy link
Contributor Author

Nominating for 1.0 p-backcompat-lang.

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Jan 5, 2015
…egion bounding. Fixes rust-lang#20303.

Strictly speaking, this is a [breaking-change] (if you are using
associated types). You are no longer free to wantonly violate the type
system rules by closing associated types into objects without any form
of region bound. Instead you should add region bounds like `T::X :
'a`, just as you would with a normal type parameter.
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 6, 2015
Treat associated types the same as type parameters when it comes to region bounding. Fixes rust-lang#20303.

Strictly speaking, this is a [breaking-change] (if you are using
associated types). You are no longer free to wantonly violate the type
system rules by closing associated types into objects without any form
of region bound. Instead you should add region bounds like `T::X :
'a`, just as you would with a normal type parameter.

r? @aturon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant