diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-05-12 12:48:14 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-05-12 12:48:14 +1200 |
| commit | e0216fcc42d5f4961d07378a783c87814097015f (patch) | |
| tree | e5f503c129942a2b7c2815b1c8e4db85b5bbcf1b /src/libsyntax/parse | |
| parent | aa5ca282b20391c6df51fdfa94e0de5672ccfac1 (diff) | |
| parent | 750f2c63f2737305d33288303cdecb7a470a7922 (diff) | |
| download | rust-e0216fcc42d5f4961d07378a783c87814097015f.tar.gz rust-e0216fcc42d5f4961d07378a783c87814097015f.zip | |
Merge branch 'master' into
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 16 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5f76c214927..eb1c338ac85 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -88,7 +88,6 @@ use std::slice; bitflags! { flags Restrictions: u8 { - const UNRESTRICTED = 0, const RESTRICTION_STMT_EXPR = 1 << 0, const RESTRICTION_NO_STRUCT_LITERAL = 1 << 1, } @@ -339,7 +338,7 @@ impl<'a> Parser<'a> { buffer_start: 0, buffer_end: 0, tokens_consumed: 0, - restrictions: Restrictions::UNRESTRICTED, + restrictions: Restrictions::empty(), quote_depth: 0, obsolete_set: HashSet::new(), mod_path_stack: Vec::new(), @@ -2991,7 +2990,7 @@ impl<'a> Parser<'a> { /// Parse an expression pub fn parse_expr_nopanic(&mut self) -> PResult<P<Expr>> { - return self.parse_expr_res(Restrictions::UNRESTRICTED); + self.parse_expr_res(Restrictions::empty()) } /// Parse an expression, subject to the given restrictions @@ -4775,7 +4774,7 @@ impl<'a> Parser<'a> { return self.parse_single_struct_field(Inherited, attrs); } - /// Parse visibility: PUB, PRIV, or nothing + /// Parse visibility: PUB or nothing fn parse_visibility(&mut self) -> PResult<Visibility> { if try!(self.eat_keyword(keywords::Pub)) { Ok(Public) } else { Ok(Inherited) } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 0106de913bb..53ed4f351d3 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -601,7 +601,7 @@ pub type IdentInterner = StrInterner; // if an interner exists in TLS, return it. Otherwise, prepare a // fresh one. -// FIXME(eddyb) #8726 This should probably use a task-local reference. +// FIXME(eddyb) #8726 This should probably use a thread-local reference. pub fn get_ident_interner() -> Rc<IdentInterner> { thread_local!(static KEY: Rc<::parse::token::IdentInterner> = { Rc::new(mk_fresh_ident_interner()) @@ -615,14 +615,14 @@ pub fn reset_ident_interner() { interner.reset(mk_fresh_ident_interner()); } -/// Represents a string stored in the task-local interner. Because the -/// interner lives for the life of the task, this can be safely treated as an -/// immortal string, as long as it never crosses between tasks. +/// Represents a string stored in the thread-local interner. Because the +/// interner lives for the life of the thread, this can be safely treated as an +/// immortal string, as long as it never crosses between threads. /// /// FIXME(pcwalton): You must be careful about what you do in the destructors /// of objects stored in TLS, because they may run after the interner is /// destroyed. In particular, they must not access string contents. This can -/// be fixed in the future by just leaking all strings until task death +/// be fixed in the future by just leaking all strings until thread death /// somehow. #[derive(Clone, PartialEq, Hash, PartialOrd, Eq, Ord)] pub struct InternedString { @@ -697,14 +697,14 @@ impl Encodable for InternedString { } } -/// Returns the string contents of a name, using the task-local interner. +/// Returns the string contents of a name, using the thread-local interner. #[inline] pub fn get_name(name: ast::Name) -> InternedString { let interner = get_ident_interner(); InternedString::new_from_rc_str(interner.get(name)) } -/// Returns the string contents of an identifier, using the task-local +/// Returns the string contents of an identifier, using the thread-local /// interner. #[inline] pub fn get_ident(ident: ast::Ident) -> InternedString { @@ -712,7 +712,7 @@ pub fn get_ident(ident: ast::Ident) -> InternedString { } /// Interns and returns the string contents of an identifier, using the -/// task-local interner. +/// thread-local interner. #[inline] pub fn intern_and_get_ident(s: &str) -> InternedString { get_name(intern(s)) |
