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

regionck uses wrong body-id, overlooks some region obligations #41502

Closed
nikomatsakis opened this issue Apr 24, 2017 · 2 comments
Closed

regionck uses wrong body-id, overlooks some region obligations #41502

nikomatsakis opened this issue Apr 24, 2017 · 2 comments
Assignees
Labels
I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

While working on #41327, I encountered this bug. The following program is accepted but should not be:

trait Foo {
    fn foo<'a, T: Iterator>(&self) where T: 'a;
}

impl Foo for () {
    fn foo<'a, T: Iterator>(&self) where T::Item: 'a {
    }
}

fn main() { }

The fix is fairly straightforward: compare_method needs to use the impl-method id for the "body_id" field, not the id of the impl method's body. This is because it calls regionck_item which assumes it will do so. I'll have a PR up shortly.

@nikomatsakis nikomatsakis added I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 24, 2017
@nikomatsakis
Copy link
Contributor Author

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Apr 24, 2017
@nikomatsakis nikomatsakis self-assigned this Apr 24, 2017
@nikomatsakis
Copy link
Contributor Author

nikomatsakis commented Apr 24, 2017

Oh, wait, maybe this should work =) -- in particular, since we know that T: 'a, we also know that T::Item: 'a.

I still feel there's a bug here, but this doesn't demonstrate it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants