about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-05-02Nit: address various style nitsNiko Matsakis-5/+10
2016-05-02Nit: do not use RLKNiko Matsakis-12/+14
2016-05-02Nit: do not import variants from StyleNiko Matsakis-24/+23
2016-05-02Do not import variants from RenderedLineKindNiko Matsakis-12/+12
2016-05-02Nit: comments should be uppercase letterNiko Matsakis-4/+4
2016-05-02refactor the Emitter traitNiko Matsakis-98/+74
There is now a CoreEmitter that everything desugars to, but without losing any information. Also remove RenderSpan::FileLine. This lets the rustc_driver tests build.
2016-05-02change errors from Yellow to MagentaNiko Matsakis-1/+1
The Yellow text is very hard to read with a white background.
2016-05-02WIP factor out RudimentaryEmitterNiko Matsakis-16/+31
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-29/+26
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-05-02thread tighter span for closures aroundNiko Matsakis-3/+3
Track the span corresponding to the `|...|` part of the closure.
2016-05-02refactor to use new snippet code and modelNiko Matsakis-723/+335
Major changes: - Remove old snippet rendering code and use the new stuff. - Introduce `span_label` method to add a label - Remove EndSpan mode and replace with a fn to get the last character of a span. - Stop using `Option<MultiSpan>` and just use an empty `MultiSpan` - and probably a bunch of other stuff :)
2016-05-02adapt JSON to new modelNiko Matsakis-119/+83
Each Span now carries a `is_primary` boolean along with an optional label. If there are multiple labels for a span, it will appear multiple times.
2016-05-02revamp MultiSpan and introduce new snippet codeNiko Matsakis-135/+1428
MultiSpan model is now: - set of primary spans - set of span+label pairs Primary spans render with `^^^`, secondary spans with `---`. Labels are placed next to the `^^^` or `---` marker as appropriate.
2016-04-30Auto merge of #32846 - jseyfried:allow_unconfigured_gated_expanded_items, r=nrcbors-3/+1
Avoid gated feature checking unconfigured expanded items Avoid gated feature checking unconfigured macro-expanded items (fixes #32840). Unconfigured items that are not macro-expanded are already not gated feature checked. r? @nrc
2016-04-28Rollup merge of #33218 - oli-obk:interned_str_cmp, r=nikomatsakisSteve Klabnik-3/+25
allow InternedString to be compared to &str directly
2016-04-28Auto merge of #33161 - jseyfried:parse_tuple_struct_field_vis, r=nikomatsakisbors-7/+38
Parse `pub(restricted)` visibilities on tuple struct fields Parse `pub(restricted)` on tuple struct fields (cc #32409). r? @nikomatsakis
2016-04-27Auto merge of #32791 - LeoTestard:feature-gate-clean, r=nikomatsakisbors-579/+462
Feature gate clean This PR does a bit of cleaning in the feature-gate-handling code of libsyntax. It also fixes two bugs (#32782 and #32648). Changes include: * Change the way the existing features are declared in `feature_gate.rs`. The array of features and the `Features` struct are now defined together by a single macro. `featureck.py` has been updated accordingly. Note: there are now three different arrays for active, removed and accepted features instead of a single one with a `Status` item to tell wether a feature is active, removed, or accepted. This is mainly due to the way I implemented my macro in the first time and I can switch back to a single array if needed. But an advantage of the way it is now is that when an active feature is used, the parser only searches through the list of active features. It goes through the other arrays only if the feature is not found. I like to think that error checking (in this case, checking that an used feature is active) does not slow down compilation of valid code. :) But this is not very important... * Feature-gate checking pass now use the `Features` structure instead of looking through a string vector. This should speed them up a bit. The construction of the `Features` struct should be faster too since it is build directly when parsing features instead of calling `has_feature` dozens of times. * The MacroVisitor pass has been removed, it was mostly useless since the `#[cfg]-stripping` phase happens before (fixes #32648). The features that must actually be checked before expansion are now checked at the time they are used. This also allows us to check attributes that are generated by macro expansion and not visible to MacroVisitor, but are also removed by macro expansion and thus not visible to PostExpansionVisitor either. This fixes #32782. Note that in order for `#[derive_*]` to be feature-gated but still accepted when generated by `#[derive(Trait)]`, I had to do a little bit of trickery with spans that I'm not totally confident into. Please review that part carefully. (It's in `libsyntax_ext/deriving/mod.rs`.):: Note: this is a [breaking change], since programs with feature-gated attributes on macro-generated macro invocations were not rejected before. For example: ```rust macro_rules! bar ( () => () ); macro_rules! foo ( () => ( #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps bar!(); ); ); ``` foo!();
2016-04-27Make some fatal lexer errors recoverablemitaa-67/+108
2016-04-26allow InternedString to be compared to &str directlyOliver Schneider-3/+25
2016-04-25parse `pub(restricted)` visibilities for struct fieldsJeffrey Seyfried-7/+38
2016-04-25Rollup merge of #33041 - petrochenkov:path, r=nrc,ManishearthManish Goregaokar-665/+401
Paths are mostly parsed without taking whitespaces into account, e.g. `std :: vec :: Vec :: new ()` parses successfully, however, there are some special cases involving keywords `super`, `self` and `Self`. For example, `self::` is considered a path start only if there are no spaces between `self` and `::`. These restrictions probably made sense when `self` and friends weren't keywords, but now they are unnecessary. The first two commits remove this special treatment of whitespaces by removing `token::IdentStyle` entirely and therefore fix https://github.com/rust-lang/rust/issues/14109. This change also affects naked `self` and `super` (which are not tightly followed by `::`, obviously) they can now be parsed as paths, however they are still not resolved correctly in imports (cc @jseyfried, see `compile-fail/use-keyword.rs`), so https://github.com/rust-lang/rust/issues/29036 is not completely fixed. The third commit also makes `super`, `self`, `Self` and `static` keywords nominally (before this they acted as keywords for all purposes) and removes most of remaining \"special idents\". The last commit (before tests) contains some small improvements - some qualified paths with type parameters are parsed correctly, `parse_path` is not used for parsing single identifiers, imports are sanity checked for absence of type parameters - such type parameters can be generated by syntax extensions or by macros when https://github.com/rust-lang/rust/issues/10415 is fixed (~~soon!~~already!). This patch changes some pretty basic things in `libsyntax`, like `token::Token` and the keyword list, so it's a plugin-[breaking-change]. r? @eddyb
2016-04-24Remove some old code from libsyntaxVadim Petrochenkov-59/+14
2016-04-24syntax: Make `is_path_start` precise and improve some error messages about ↵Vadim Petrochenkov-35/+62
unexpected tokens
2016-04-24syntax: Check paths in visibilities for type parametersVadim Petrochenkov-83/+83
syntax: Merge PathParsingMode::NoTypesAllowed and PathParsingMode::ImportPrefix syntax: Rename PathParsingMode and its variants to better express their purpose syntax: Remove obsolete error message about 'self lifetime syntax: Remove ALLOW_MODULE_PATHS workaround syntax/resolve: Adjust some error messages resolve: Compare unhygienic (not renamed) names with keywords::Invalid, invalid identifiers may appear to be valid after renaming
2016-04-24syntax: Merge keywords and remaining special idents in one listVadim Petrochenkov-162/+111
Simplify the macro used for generation of keywords Make `Keyword::ident` private
2016-04-24syntax: Don't parse idents with `parse_path`Vadim Petrochenkov-9/+12
Lift some restrictions on type parameters in paths Sanity check import paths for type parameters
2016-04-24syntax: Make static/super/self/Self keywords + special ident cleanupVadim Petrochenkov-148/+100
2016-04-24syntax: Get rid of token::IdentStyleVadim Petrochenkov-179/+107
2016-04-24syntax: Don't rely on token::IdentStyle in the parserVadim Petrochenkov-131/+53
2016-04-24thread tighter span for closures aroundNiko Matsakis-22/+52
Track the span corresponding to the `|...|` part of the closure.
2016-04-22Remove some useless code.Leo Testard-37/+15
2016-04-22Remove the MacroVisitor pass.Leo Testard-109/+51
This pass was supposed to check use of gated features before `#[cfg]`-stripping but this was not the case since it in fact happens after. Checks that are actually important and must be done before macro expansion are now made where the features are actually used. Close #32648. Also ensure that attributes on macro-generated macro invocations are checked as well. Close #32782 and #32655.
2016-04-21Generate the features structure and arrays with new macros.Leo Testard-421/+196
This is more readable, safer, and allows for a much more efficient parsing.
2016-04-21Rewrite the feature-gate checks to use a structure instead of a list of strings.Leo Testard-223/+411
2016-04-21pacify the merciless acrichto (somewhat)Niko Matsakis-8/+6
Also add a comment or two to pacify the merciless self-critic, who hates a closure without a comment.
2016-04-21port compiletest to use JSON outputNiko Matsakis-122/+226
This uncovered a lot of bugs in compiletest and also some shortcomings of our existing JSON output. We had to add information to the JSON output, such as suggested text and macro backtraces. We also had to fix various bugs in the existing tests. Joint work with jntrnr.
2016-04-17Rollup merge of #33044 - petrochenkov:prefix, r=eddybManish Goregaokar-111/+63
syntax: Parse import prefixes as paths Fixes https://github.com/rust-lang/rust/issues/10415 r? @eddyb (This partially intersects with https://github.com/rust-lang/rust/pull/33041)
2016-04-16Auto merge of #32909 - sanxiyn:unused-trait-import-2, r=alexcrichtonbors-7/+0
Remove unused trait imports
2016-04-17syntax: Parse import prefixes as pathsVadim Petrochenkov-111/+63
2016-04-16Auto merge of #32875 - jseyfried:1422_implementation, r=nikomatsakisbors-23/+50
Implement `pub(restricted)` privacy (RFC 1422) This implements `pub(restricted)` privacy from RFC 1422 (cc #32409) behind a feature gate. `pub(restricted)` paths currently cannot use re-exported modules both for simplicity of implementation and for future compatibility with RFC 1560 (cf #31783). r? @nikomatsakis
2016-04-16Rollup merge of #32945 - durka:rfc1494, r=pnkfelixManish Goregaokar-0/+1
implement RFC amendment 1494 Adds `:block` to the follow set for `:ty` and `:path`. See rust-lang/rfcs#1494.
2016-04-16Rollup merge of #32929 - LeoTestard:featureck-comment, r=GuillaumeGomezManish Goregaokar-2/+2
Update a comment to reflect changes in tidy checks.
2016-04-16Rollup merge of #32923 - jseyfried:fix_hygiene, r=nrcManish Goregaokar-8/+9
Fix macro hygiene bug This fixes #32922 (EDIT: and fixes #31856), macro hygiene bugs. It is a [breaking-change]. For example, the following would break: ```rust fn main() { let x = true; macro_rules! foo { () => { let x = 0; macro_rules! bar { () => {x} } let _: bool = bar!(); //^ `bar!()` used to resolve the first `x` (a bool), //| but will now resolve to the second x (an i32). }} foo! {}; } ``` r? @nrc
2016-04-14Improve message for raw pointer missing mut and constDavid Tolnay-2/+2
"Bare raw pointer" does not exist as a concept.
2016-04-14Feature gate `pub(restricted)`Jeffrey Seyfried-0/+15
2016-04-14Parse `pub(restricted)`Jeffrey Seyfried-16/+25
2016-04-14Visit visibilities in the ast visitor's `walk_*` functionsJeffrey Seyfried-4/+7
2016-04-14Add a span to the `Crate` variant of `ast::Visibility`Jeffrey Seyfried-3/+3
2016-04-13implement RFC amendment 1494Alex Burka-0/+1
2016-04-13Update a comment to reflect changes in tidy checks.Leo Testard-2/+2