Skip to content

Nightly regression in borrow checker #28936

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
msullivan opened this issue Oct 9, 2015 · 8 comments
Closed

Nightly regression in borrow checker #28936

msullivan opened this issue Oct 9, 2015 · 8 comments
Labels
A-lifetimes Area: Lifetimes / regions E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@msullivan
Copy link
Contributor

pub type Session = i32;
pub struct StreamParser<'a, T> {
    _tokens: T,
    _session: &'a mut Session,
}

impl<'a, T> StreamParser<'a, T> {
    pub fn thing(&mut self) -> bool { true }
}

pub fn parse_stream<T: Iterator<Item=i32>, U, F>(
        _session: &mut Session, _tokens: T, _f: F) -> U
    where F: Fn(&mut StreamParser<T>) -> U { panic!(); }

pub fn thing(session: &mut Session) {
    let mut stream = vec!(1, 2, 3).into_iter();

    let _b = parse_stream(session,
                          stream.by_ref(),
                          // replacing the above with the following fixes it
                          //&mut stream,
                          |p| p.thing());

}

fn main() {}

compiles on 1.3 stable and 1.4 beta but not on current nightly. It did compile on nightly 6e5a325. Replacing the .by_ref() in the call to parse_stream fixes it.

Potentially related to/a dupe of #28934.

@msullivan
Copy link
Contributor Author

(Probably want these lables: A-lifetimes T-compiler regression-from-stable-to-nightly)

@alexcrichton
Copy link
Member

May be similar or the same as #28853, #28854, or #28934, but seems good to track regardless!

@alexcrichton alexcrichton added A-lifetimes Area: Lifetimes / regions I-nominated regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 9, 2015
@arielb1
Copy link
Contributor

arielb1 commented Oct 10, 2015

This looks like a closure inference issue: annotating the closure type fixes it.

@nikomatsakis
Copy link
Contributor

I believe this was fixed by #29006

@arielb1
Copy link
Contributor

arielb1 commented Oct 15, 2015

This was indeed fixed by #29006.

@arielb1 arielb1 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 15, 2015
@nikomatsakis
Copy link
Contributor

triage: P-medium

@rust-highfive rust-highfive added P-medium Medium priority and removed I-nominated labels Oct 15, 2015
@nikomatsakis
Copy link
Contributor

triage: P-low

@rust-highfive rust-highfive added P-low Low priority and removed P-medium Medium priority labels Oct 15, 2015
@nikomatsakis nikomatsakis removed the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Oct 20, 2015
@nikomatsakis
Copy link
Contributor

Removing regression tag since the core issue is fixed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lifetimes Area: Lifetimes / regions E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. P-low Low 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

5 participants