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

Nightly regression in borrow checker #28936

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

Comments

Projects
None yet
5 participants
@msullivan
Copy link
Contributor

msullivan commented Oct 9, 2015

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

This comment has been minimized.

Copy link
Contributor Author

msullivan commented Oct 9, 2015

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

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Oct 9, 2015

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

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Oct 10, 2015

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

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 14, 2015

I believe this was fixed by #29006

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Oct 15, 2015

This was indeed fixed by #29006.

@arielb1 arielb1 added the E-needstest label Oct 15, 2015

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 15, 2015

triage: P-medium

@rust-highfive rust-highfive added P-medium and removed I-nominated labels Oct 15, 2015

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 15, 2015

triage: P-low

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 20, 2015

Removing regression tag since the core issue is fixed.

bors added a commit that referenced this issue Oct 21, 2015

@bors bors closed this in #29206 Oct 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.