mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
update :vis implementation to current rust
This commit is contained in:
parent
a2489495d9
commit
d53e413e04
@ -793,13 +793,13 @@ fn is_in_follow(tok: "ed::TokenTree, frag: &str) -> Result<bool, (String, &'
|
|||||||
"vis" => {
|
"vis" => {
|
||||||
// Explicitly disallow `priv`, on the off chance it comes back.
|
// Explicitly disallow `priv`, on the off chance it comes back.
|
||||||
match *tok {
|
match *tok {
|
||||||
Comma => Ok(true),
|
TokenTree::Token(_, ref tok) => match *tok {
|
||||||
ModSep => Ok(true),
|
Comma => Ok(true),
|
||||||
MatchNt(_, ref frag, _, _) => {
|
ModSep => Ok(true),
|
||||||
let name = frag.name.as_str();
|
Ident(i) if i.name != "priv" => Ok(true),
|
||||||
Ok(name == "ident" || name == "ty")
|
_ => Ok(false)
|
||||||
},
|
},
|
||||||
Ident(i, _) if i.name.as_str() != "priv" => Ok(true),
|
TokenTree::MetaVarDecl(_, _, frag) if frag.name =="ident" || frag.name == "ty" => Ok(true),
|
||||||
_ => Ok(false)
|
_ => Ok(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5056,7 +5056,7 @@ impl<'a> Parser<'a> {
|
|||||||
/// and `pub(super)` for `pub(in super)`. If the following element can't be a tuple (i.e. it's
|
/// and `pub(super)` for `pub(in super)`. If the following element can't be a tuple (i.e. it's
|
||||||
/// a function definition, it's not a tuple struct field) and the contents within the parens
|
/// a function definition, it's not a tuple struct field) and the contents within the parens
|
||||||
/// isn't valid, emit a proper diagnostic.
|
/// isn't valid, emit a proper diagnostic.
|
||||||
fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibility> {
|
pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibility> {
|
||||||
if !self.eat_keyword(keywords::Pub) {
|
if !self.eat_keyword(keywords::Pub) {
|
||||||
return Ok(Visibility::Inherited)
|
return Ok(Visibility::Inherited)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#![allow(dead_code, unused_imports)]
|
#![allow(dead_code, unused_imports)]
|
||||||
#![feature(pub_restricted)]
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ensure that `:vis` matches can be captured in existing positions, and passed
|
Ensure that `:vis` matches can be captured in existing positions, and passed
|
||||||
@ -56,15 +55,15 @@ mod with_pub_restricted {
|
|||||||
|
|
||||||
mod garden {
|
mod garden {
|
||||||
mod with_pub_restricted_path {
|
mod with_pub_restricted_path {
|
||||||
vis_passthru! { pub(::garden) const A: i32 = 0; }
|
vis_passthru! { pub(in garden) const A: i32 = 0; }
|
||||||
vis_passthru! { pub(::garden) enum B {} }
|
vis_passthru! { pub(in garden) enum B {} }
|
||||||
vis_passthru! { pub(::garden) extern "C" fn c() {} }
|
vis_passthru! { pub(in garden) extern "C" fn c() {} }
|
||||||
vis_passthru! { pub(::garden) mod d {} }
|
vis_passthru! { pub(in garden) mod d {} }
|
||||||
vis_passthru! { pub(::garden) static E: i32 = 0; }
|
vis_passthru! { pub(in garden) static E: i32 = 0; }
|
||||||
vis_passthru! { pub(::garden) struct F; }
|
vis_passthru! { pub(in garden) struct F; }
|
||||||
vis_passthru! { pub(::garden) trait G {} }
|
vis_passthru! { pub(in garden) trait G {} }
|
||||||
vis_passthru! { pub(::garden) type H = i32; }
|
vis_passthru! { pub(in garden) type H = i32; }
|
||||||
vis_passthru! { pub(::garden) use A as I; }
|
vis_passthru! { pub(in garden) use A as I; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user