Skip to content

NLL: Implied bounds computation misses some relationships #52078

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

Closed
lqd opened this issue Jul 5, 2018 · 1 comment
Closed

NLL: Implied bounds computation misses some relationships #52078

lqd opened this issue Jul 5, 2018 · 1 comment
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) C-enhancement Category: An issue proposing an enhancement or a PR with one. NLL-complete Working towards the "valid code works" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lqd
Copy link
Member

lqd commented Jul 5, 2018

Found while triaging the NLL-enabled crater run, and extracted from specs-0.10.

#![feature(nll)]
#![allow(unused_variables)]

struct Drain<'a, T: 'a> {
    _marker: ::std::marker::PhantomData<&'a T>,
}

trait Join {
    type Value;
    fn get(value: &mut Self::Value);
}

impl<'a, T> Join for Drain<'a, T> {
    type Value = &'a mut Option<T>;
    
    fn get<'b>(value: &'b mut Self::Value) {
    }
}

fn main() {
}

Playground

Note: the added 'b is to make the error message clearer, about a the missed relationship between 'a and 'b from the argument type (maybe because it is going through the associated type).

Otherwise fn get(value: &mut Self::Value) yields this more obscure free region "'a" does not outlive free region "".

@lqd lqd added the A-NLL Area: Non-lexical lifetimes (NLL) label Jul 5, 2018
@matthewjasper matthewjasper added WG-compiler-nll NLL-complete Working towards the "valid code works" goal labels Jul 8, 2018
@jkordish jkordish added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 11, 2018
@nikomatsakis nikomatsakis added this to the Rust 2018 Preview 2 milestone Jul 17, 2018
@nikomatsakis nikomatsakis self-assigned this Jul 17, 2018
@nikomatsakis
Copy link
Contributor

Turns out to be fixed by #51959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) C-enhancement Category: An issue proposing an enhancement or a PR with one. NLL-complete Working towards the "valid code works" goal 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

4 participants