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

Region parameterization inference does not consider inheritance #4723

Closed
erickt opened this issue Feb 1, 2013 · 6 comments
Closed

Region parameterization inference does not consider inheritance #4723

erickt opened this issue Feb 1, 2013 · 6 comments
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions
Milestone

Comments

@erickt
Copy link
Contributor

erickt commented Feb 1, 2013

See this code:

pub trait Map<K, V> {
    pure fn f(&self) -> Option<&self/V>;
}

pub trait MutableMap<K, V>: Map<K, V> {
}

fn main() { }

It fails with:

foo.rs:7:28: 7:37 error: to use region types here, the containing type must be declared with a region bound
foo.rs:7 pub trait MutableMap<K, V>: Map<K, V> {
                                     ^~~~~~~~~
error: aborting due to previous error

I'm not quite sure what to do in this case. Is this an error? If not, how do I pass a region bound to a parent trait?

@nikomatsakis
Copy link
Contributor

This is a failure of region inference.

@nikomatsakis
Copy link
Contributor

That is, region parameterization inference. It is not aware of supertraits. However, I am reluctant to try and fix it because we plan to make all these region parameters more explicit. Also, I think that in this case the trait should not be region-parameterized anyhow.

@nikomatsakis
Copy link
Contributor

(So actually there are two bugs, in a way)

@ghost ghost assigned nikomatsakis Feb 21, 2013
@nikomatsakis
Copy link
Contributor

The first bug should be fixed now (dup of #5225), the second bug (region parameterization inference doesn't consider trait inheritance) I don't plan to fix since I plan to remove RPI.

@nikomatsakis
Copy link
Contributor

On second thought, some from of RPI will remain (variance inference), so I am re-opening and re-titling.

@nikomatsakis nikomatsakis reopened this Mar 8, 2013
@nikomatsakis
Copy link
Contributor

Never mind, dup of #3598.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions
Projects
None yet
Development

No branches or pull requests

2 participants