summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2016-06-16Add an abs_path member to FileMap, use it when writing debug info.Ted Mielczarek-2/+2
When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-16Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrcbors-20/+62
Revert a change in the scope of macros imported from crates to fix a regression Fixes #34212. The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules. r? @nrc
2016-06-16Strip unconfigured nodes from decorator-generated ASTJeffrey Seyfried-4/+16
2016-06-16Avoid expanding decorator-generated items twiceJeffrey Seyfried-2/+0
2016-06-16Allow `MultiItemModifier`s to expand into zero or many itemsJeffrey Seyfried-12/+14
2016-06-16Refactor MultiModifier expansionJeffrey Seyfried-65/+34
2016-06-16Implement `HasAttrs` for `Annotatable`Jeffrey Seyfried-16/+19
2016-06-14Remove the type parameter from `syntax::visit::Visitor`Jeffrey Seyfried-3/+3
2016-06-14Refactor away `WithAttrs` traitJeffrey Seyfried-24/+15
2016-06-14Change `fold_tt` and `fold_tts` to take token trees by value (instead of by ↵Jeffrey Seyfried-38/+30
reference)
2016-06-14Refactor away field `ctxt` of `ast::Mac_`Jeffrey Seyfried-1/+0
2016-06-13Auto merge of #33749 - jseyfried:fix_call_site_span, r=nrcbors-23/+1
Fix macro call site spans Fix macro call site spans. r? @nrc
2016-06-13Add support for macro expansion inside trait itemsJoseph Dunne-19/+64
2016-06-12Load macros from `#[macro_use]` crates earlier in expansionJeffrey Seyfried-11/+41
2016-06-12Add method `visit_with` to `MacroGenerable`Jeffrey Seyfried-9/+21
2016-06-11Strip `#[test]` nodes during `cfg` processing on non-test builds.Jeffrey Seyfried-0/+3
2016-06-09Add comment and clean up `expand_annotatable`Jeffrey Seyfried-8/+8
2016-06-09Load macros from `extern crate`s during expansion.Jeffrey Seyfried-20/+42
2016-06-08Auto merge of #34010 - jseyfried:decorate_expanded, r=nrcbors-13/+14
Run decorators on expanded AST Fixes #32950. r? @nrc
2016-06-07Auto merge of #33982 - LeoTestard:remove-check-matcher-old, r=pnkfelixbors-233/+18
Remove the old FOLLOW checking (aka `check_matcher_old`). It was supposed to be removed at the next release cycle but is still in the tree since like 6 months. Potential breaking change, since some cases (such as #25658) will change from a warning to an error. But the warning stating that it will be a hard error in the next release has been there for 6 months now. I think it's safe to break this code. ^_^
2016-06-06Remove the old FOLLOW checking (aka `check_matcher_old`).Leo Testard-233/+18
2016-06-04Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1bors-1/+1
Projection cache and better warnings for #32330 This PR does three things: - it lays the groundwork for the more precise subtyping rules discussed in #32330, but does not enable them; - it issues warnings when the result of a leak-check or subtyping check relies on a late-bound region which will late become early-bound when #32330 is fixed; - it introduces a cache for projection in the inference context. I'm not 100% happy with the approach taken by the cache here, but it seems like a step in the right direction. It results in big wins on some test cases, but not as big as previous versions -- I think because it is caching the `Vec<Obligation>` (whereas before I just returned the normalized type with an empty vector). However, that change was needed to fix an ICE in @alexcrichton's future-rs module (I haven't fully tracked the cause of that ICE yet). Also, because trans/the collector use a fresh inference context for every call to `fulfill_obligation`, they don't profit nearly as much from this cache as they ought to. Still, here are the results from the future-rs `retry.rs`: ``` 06:26 <nmatsakis> time: 6.246; rss: 44MB item-bodies checking 06:26 <nmatsakis> time: 54.783; rss: 63MB translation item collection 06:26 <nmatsakis> time: 140.086; rss: 86MB translation 06:26 <nmatsakis> time: 0.361; rss: 46MB item-bodies checking 06:26 <nmatsakis> time: 5.299; rss: 63MB translation item collection 06:26 <nmatsakis> time: 12.140; rss: 86MB translation ``` ~~Another example is the example from #31849. For that, I get 34s to run item-bodies without any cache. The version of the cache included here takes 2s to run item-bodies type-checking. An alternative version which doesn't track nested obligations takes 0.2s, but that version ICEs on @alexcrichton's future-rs (and may well be incorrect, I've not fully convinced myself of that). So, a definite win, but I think there's definitely room for further progress.~~ Pushed a modified version which improves performance of the case from #31849: ``` lunch-box. time rustc --stage0 ~/tmp/issue-31849.rs -Z no-trans real 0m33.539s user 0m32.932s sys 0m0.570s lunch-box. time rustc --stage2 ~/tmp/issue-31849.rs -Z no-trans real 0m0.195s user 0m0.154s sys 0m0.042s ``` Some sort of cache is also needed for unblocking further work on lazy normalization, since that will lean even more heavily on the cache, and will also require cycle detection. r? @arielb1
2016-06-01Remove redundant `check_for_macros` AST pass.Jeffrey Seyfried-19/+0
2016-06-01Run decorators on expanded AST.Jeffrey Seyfried-13/+14
2016-06-01Rollup merge of #33841 - LeoTestard:macro-sequence-lhs, r=pnkfelixManish Goregaokar-9/+4
Reject a LHS formed of a single sequence TT during `macro_rules!` checking. This was already rejected during expansion. Encountering malformed LHS or RHS during expansion is now considered a bug. Follow up to #33689. r? @pnkfelix Note: this can break code that defines such macros but does not use them.
2016-05-31simplify HR subtyping back to what we did beforeNiko Matsakis-1/+1
A lot of the refactors, however, seem helpful, so leave those in, particularly since we may want to make this change in the future.
2016-05-28Fix macro call site spansJeffrey Seyfried-23/+1
2016-05-27Auto merge of #33706 - jseyfried:refactor_cfg, r=nrcbors-82/+65
Perform `cfg` attribute processing during macro expansion and fix bugs This PR refactors `cfg` attribute processing and fixes bugs. More specifically: - It merges gated feature checking for stmt/expr attributes, `cfg_attr` processing, and `cfg` processing into a single fold. - This allows feature gated `cfg` variables to be used in `cfg_attr` on unconfigured items. All other feature gated attributes can already be used on unconfigured items. - It performs `cfg` attribute processing during macro expansion instead of after expansion so that macro-expanded items are configured the same as ordinary items. In particular, to match their non-expanded counterparts, - macro-expanded unconfigured macro invocations are no longer expanded, - macro-expanded unconfigured macro definitions are no longer usable, and - feature gated `cfg` variables on macro-expanded macro definitions/invocations are now errors. This is a [breaking-change]. For example, the following would break: ```rust macro_rules! m { () => { #[cfg(attr)] macro_rules! foo { () => {} } foo!(); // This will be an error macro_rules! bar { () => { fn f() {} } } #[cfg(attr)] bar!(); // This will no longer be expanded ... fn g() { f(); } // ... so that `f` will be unresolved. #[cfg(target_thread_local)] // This will be a gated feature error macro_rules! baz { () => {} } } } m!(); ``` r? @nrc
2016-05-27Rollup merge of #33644 - petrochenkov:selfast, r=nrcManish Goregaokar-1/+0
The AST part of https://github.com/rust-lang/rust/pull/33505. https://github.com/rust-lang/rust/pull/33505 isn't landed yet, so this PR is based on top of it. r? @nrc plugin-[breaking-change] cc #31645 @Manishearth
2016-05-27Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakisManish Goregaokar-2/+2
cc https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth
2016-05-27Rollup merge of #33351 - birkenfeld:loop-label-spans, r=pnkfelixManish Goregaokar-7/+7
This makes the \"shadowing labels\" warning *not* print the entire loop as a span, but only the lifetime. Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-05-27Refactor `expand_expr`Jeffrey Seyfried-35/+22
2016-05-27Strip unconfigured items during macro expansionJeffrey Seyfried-1/+33
2016-05-27Update spans' `expn_id` during the marking foldJeffrey Seyfried-56/+20
2016-05-26Reject a LHS formed of a single sequence TT during `macro_rules!` checking.Leo Testard-9/+4
This was already rejected during expansion. Encountering malformed LHS or RHS during expansion is now considered a bug.
2016-05-26Auto merge of #33766 - jseyfried:cleanup_expansion, r=nrcbors-411/+183
Cleanup macro expansion and improve diagnostics Cleanup macro expansion and improve diagnostics. Fixes #33709. r? @nrc
2016-05-26Implement `..` in tuple (struct) patternsVadim Petrochenkov-2/+2
2016-05-25Add a new AST-only type variant `ImplicitSelf`Vadim Petrochenkov-1/+0
2016-05-25Remove ExplicitSelf from ASTVadim Petrochenkov-1/+1
2016-05-25Auto merge of #33713 - LeoTestard:macro-rules-invalid-lhs, r=pnkfelixbors-45/+59
Make sure that macros that didn't pass LHS checking are not expanded. This avoid duplicate errors for things like invalid fragment specifiers, or parsing errors for ambiguous macros.
2016-05-24syntax/hir: give loop labels a spanGeorg Brandl-7/+7
This makes the "shadowing labels" warning *not* print the entire loop as a span, but only the lifetime. Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-05-24Add comments and fix a nitJeffrey Seyfried-1/+9
2016-05-24Avoid iterating two times over the list of LHSes.Leo Testard-5/+4
2016-05-24Make sure that macros that didn't pass LHS checking are not expanded.Leo Testard-41/+56
This avoids duplicate errors for things like invalid fragment specifiers, or parsing errors for ambiguous macros. Fixes #29231.
2016-05-21Move `placement_in_syntax` gated feature checking from expansion to the ↵Jeffrey Seyfried-16/+0
post-expansion visitor
2016-05-21Refactor away `check_attributes`Jeffrey Seyfried-11/+7
2016-05-21Refactor away `expand_item_mac`Jeffrey Seyfried-159/+85
2016-05-21Refactor out `mac_result` in `expand_mac_invoc`Jeffrey Seyfried-54/+53
2016-05-21Check attributes in `expand_mac_invoc`Jeffrey Seyfried-22/+12
2016-05-21Use `expand_mac_invoc` in `expand_pat`Jeffrey Seyfried-75/+3