1
Fork 0

Rollup merge of #48441 - petrochenkov:exty, r=estebank

Fix parsing of extern paths in types and poly-traits

Fixes https://github.com/rust-lang/rust/issues/48262
This commit is contained in:
Manish Goregaokar 2018-02-24 15:52:13 -08:00 committed by GitHub
commit 69757c5bb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -1321,7 +1321,7 @@ impl<'a> Parser<'a> {
pub fn token_is_bare_fn_keyword(&mut self) -> bool { pub fn token_is_bare_fn_keyword(&mut self) -> bool {
self.check_keyword(keywords::Fn) || self.check_keyword(keywords::Fn) ||
self.check_keyword(keywords::Unsafe) || self.check_keyword(keywords::Unsafe) ||
self.check_keyword(keywords::Extern) self.check_keyword(keywords::Extern) && self.is_extern_non_path()
} }
fn eat_label(&mut self) -> Option<Label> { fn eat_label(&mut self) -> Option<Label> {

View file

@ -8,8 +8,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub struct S; pub struct S;
#[derive(Debug)] #[derive(Debug)]
pub struct Z; pub struct Z;
pub trait Tr<'a> {}

View file

@ -14,6 +14,9 @@
use extern::xcrate::Z; use extern::xcrate::Z;
type A = extern::xcrate::S;
type B = for<'a> extern::xcrate::Tr<'a>;
fn f() { fn f() {
use extern::xcrate; use extern::xcrate;
use extern::xcrate as ycrate; use extern::xcrate as ycrate;
@ -28,4 +31,5 @@ fn main() {
assert_eq!(format!("{:?}", s), "S"); assert_eq!(format!("{:?}", s), "S");
let z = Z; let z = Z;
assert_eq!(format!("{:?}", z), "Z"); assert_eq!(format!("{:?}", z), "Z");
assert_eq!(A {}, extern::xcrate::S {});
} }