Skip to content

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

Closed
@nikomatsakis

Description

@nikomatsakis

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.

Metadata

Metadata

Assignees

Labels

I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions