Skip to content

Lifetime Regression using Parser::parse_all_token_trees #30668

Closed
@KyleMayes

Description

@KyleMayes

The below code worked until I updated today. I'm not sure which version of the nightly build I had previously, but it was about ten days old.

#![feature(rustc_private)]

extern crate syntax;

use syntax::parse;
use syntax::ast::{TokenTree};
use syntax::parse::{ParseSess};

fn parse_token_trees(source: &str) -> Vec<TokenTree> {
    let session = ParseSess::new();
    let source = source.into();
    let mut parser = parse::new_parser_from_source_str(&session, vec![], "".into(), source);
    parser.parse_all_token_trees().unwrap()
}

Rust Playpen (this produces the same error I am seeing)

If I change it to this, it compiles:

#![feature(rustc_private)]

extern crate syntax;

use syntax::parse;
use syntax::ast::{TokenTree};
use syntax::parse::{ParseSess};

fn parse_token_trees(source: &str) -> Vec<TokenTree> {
    let session = ParseSess::new();
    let source = source.into();
    let mut parser = parse::new_parser_from_source_str(&session, vec![], "".into(), source);
    let tts = parser.parse_all_token_trees().unwrap();
    tts
}

Meta

rustc 1.7.0-nightly (2370d461a 2015-12-30)
binary: rustc
commit-hash: 2370d461a648035b54aae492e7df66256f0f18c6
commit-date: 2015-12-30
host: x86_64-unknown-linux-gnu
release: 1.7.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions