diff options
| author | bors <bors@rust-lang.org> | 2014-03-31 15:51:33 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-31 15:51:33 -0700 |
| commit | b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64 (patch) | |
| tree | 1e66451d207e19694d62608a8e1724c71796dc00 /src/libsyntax/parse/parser.rs | |
| parent | a7e057d402a345f547e67a326871621472d04035 (diff) | |
| parent | 37a3131640d0fa2633aa26db7f849d110250ce51 (diff) | |
| download | rust-b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64.tar.gz rust-b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64.zip | |
auto merge of #13184 : alexcrichton/rust/priv-fields, r=brson
This is an implementation of a portion of [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md). This PR makes named struct fields private by default (as opposed to inherited by default). The only real meaty change is the first commit to `rustc`, all other commits are just fallout of that change. Summary of changes made: * Named fields are private by default *everywhere* * The `priv` keyword is now default-deny on named fields (done in a "lint" pass in privacy) Changes yet to be done (before the RFC is closed) * Change tuple structs to have private fields by default * Remove `priv` enum variants * Make `priv` a reserved keyword
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index bf96983cc7f..2d0c4ca488e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -78,7 +78,6 @@ use parse::{new_sub_parser_from_file, ParseSess}; use owned_slice::OwnedSlice; use collections::HashSet; -use std::kinds::marker; use std::mem::replace; use std::rc::Rc; @@ -113,8 +112,8 @@ pub enum PathParsingMode { /// A path paired with optional type bounds. pub struct PathAndBounds { - path: ast::Path, - bounds: Option<OwnedSlice<TyParamBound>>, + pub path: ast::Path, + pub bounds: Option<OwnedSlice<TyParamBound>>, } enum ItemOrViewItem { @@ -306,38 +305,35 @@ pub fn Parser<'a>(sess: &'a ParseSess, cfg: ast::CrateConfig, mut rdr: ~Reader:) obsolete_set: HashSet::new(), mod_path_stack: Vec::new(), open_braces: Vec::new(), - nocopy: marker::NoCopy } } pub struct Parser<'a> { - sess: &'a ParseSess, - cfg: CrateConfig, + pub sess: &'a ParseSess, // the current token: - token: token::Token, + pub token: token::Token, // the span of the current token: - span: Span, + pub span: Span, // the span of the prior token: - last_span: Span, + pub last_span: Span, + pub cfg: CrateConfig, // the previous token or None (only stashed sometimes). - last_token: Option<~token::Token>, - buffer: [TokenAndSpan, ..4], - buffer_start: int, - buffer_end: int, - tokens_consumed: uint, - restriction: restriction, - quote_depth: uint, // not (yet) related to the quasiquoter - reader: ~Reader:, - interner: Rc<token::IdentInterner>, + pub last_token: Option<~token::Token>, + pub buffer: [TokenAndSpan, ..4], + pub buffer_start: int, + pub buffer_end: int, + pub tokens_consumed: uint, + pub restriction: restriction, + pub quote_depth: uint, // not (yet) related to the quasiquoter + pub reader: ~Reader:, + pub interner: Rc<token::IdentInterner>, /// The set of seen errors about obsolete syntax. Used to suppress /// extra detail when the same error is seen twice - obsolete_set: HashSet<ObsoleteSyntax>, + pub obsolete_set: HashSet<ObsoleteSyntax>, /// Used to determine the path to externally loaded source files - mod_path_stack: Vec<InternedString> , + pub mod_path_stack: Vec<InternedString>, /// Stack of spans of open delimiters. Used for error message. - open_braces: Vec<Span> , - /* do not copy the parser; its state is tied to outside state */ - priv nocopy: marker::NoCopy + pub open_braces: Vec<Span>, } fn is_plain_ident_or_underscore(t: &token::Token) -> bool { |
