about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-06-14Refactor away field `ctxt` of `ast::Mac_`Jeffrey Seyfried-11/+8
2016-06-14Remove inherent method `attrs()` on AST nodes. `attrs()` is now a method of ↵Jeffrey Seyfried-29/+1
trait `HasAttrs`.
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-86/+173
2016-06-12Load macros from `#[macro_use]` crates earlier in expansionJeffrey Seyfried-11/+41
2016-06-12Implement `Into<Vec<T>>` for `SmallVector<T>`Jeffrey Seyfried-0/+10
2016-06-12Add method `visit_with` to `MacroGenerable`Jeffrey Seyfried-9/+21
2016-06-11Support nested `cfg_attr` attributesJeffrey Seyfried-1/+1
2016-06-11Refactor away the `CfgFolder` trait.Jeffrey Seyfried-34/+18
2016-06-11Forbid `#[test]` attributes on non-optional expressions.Jeffrey Seyfried-1/+1
2016-06-11Strip `#[test]` nodes during `cfg` processing on non-test builds.Jeffrey Seyfried-16/+18
2016-06-10Auto merge of #34172 - jseyfried:avoid_configuring_interpolated_ast, ↵bors-0/+7
r=alexcrichton Fix ICE regression caused by configuring interpolated AST Fixes #34171. r? @nrc
2016-06-11Remove last traces of identifier hygiene from HIRVadim Petrochenkov-4/+0
2016-06-10Visit statement and expression attributesJeffrey Seyfried-0/+6
2016-06-09Auto merge of #34108 - jseyfried:refactor_prelude_injection, r=nrcbors-125/+47
Refactor away the prelude injection fold Instead, just inject `#[prelude_import] use [core|std]::prelude::v1::*;` at the crate root while injecting `extern crate [core|std];` and process `#[no_implicit_prelude]` attributes in `resolve`. r? @nrc
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-22/+46
2016-06-09Avoid configuring interpolated items.Jeffrey Seyfried-0/+7
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-07Refactor away the prelude injection passJeffrey Seyfried-125/+47
2016-06-06Remove the old FOLLOW checking (aka `check_matcher_old`).Leo Testard-233/+18
2016-06-05Respect #[rustc_inherit_overflow_checks] in mir::build and trans.Eduard Burtescu-0/+7
2016-06-04Auto merge of #34031 - jseyfried:fix_cfg_bug, r=eddybbors-9/+11
Fix a regression in the configuration folder This fixes #34028, a regression caused by #33706 in which unconfigured impl items generated by a macro in an impl item position are not removed. r? @nrc
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-02Fix bug in the `syntax::config::StripUnconfigured` folderJeffrey Seyfried-9/+11
2016-06-01Remove redundant `check_for_macros` AST pass.Jeffrey Seyfried-19/+0
2016-06-01Auto merge of #33794 - petrochenkov:sanity, r=nrcbors-29/+13
Add AST validation pass and move some checks to it The purpose of this pass is to catch constructions that fit into AST data structures, but not permitted by the language. As an example, `impl`s don't have visibilities, but for convenience and uniformity with other items they are represented with a structure `Item` which has `Visibility` field. This pass is intended to run after expansion of macros and syntax extensions (and before lowering to HIR), so it can catch erroneous constructions that were generated by them. This pass allows to remove ad hoc semantic checks from the parser, which can be overruled by syntax extensions and occasionally macros. The checks can be put here if they are simple, local, don't require results of any complex analysis like name resolution or type checking and maybe don't logically fall into other passes. I expect most of errors generated by this pass to be non-fatal and allowing the compilation to proceed. I intend to move some more checks to this pass later and maybe extend it with new checks, like, for example, identifier validity. Given that syntax extensions are going to be stabilized in the measurable future, it's important that they would not be able to subvert usual language rules. In this patch I've added two new checks - a check for labels named `'static` and a check for lifetimes and labels named `'_`. The first one gives a hard error, the second one - a future compatibility warning. Fixes https://github.com/rust-lang/rust/issues/33059 ([breaking-change]) cc https://github.com/rust-lang/rfcs/pull/1177 r? @nrc
2016-06-01Run decorators on expanded AST.Jeffrey Seyfried-13/+14
2016-06-01Rollup merge of #33973 - ↵Manish Goregaokar-3/+7
zackmdavis:stable_features_warning_notes_version_stabilized, r=brson stable features lint warning mentions version stabilized To accomplish this, we alter the checks in `rustc::middle::stability` to use the `StabilityLevel` defined in `syntax::attr` (which includes the version in which the feature was stabilized) rather than the local `StabilityLevel` in the same module, and make the `declared_stable_lang_features` field of `syntax::feature_gate::Features` hold a Vec of feature-name, span tuples (in analogy to the `declared_lib_features` field) rather than just spans. Fixes #33394. ![stable_features_version_lint_before_and_after](https://cloud.githubusercontent.com/assets/1076988/15659237/5d952a3a-267c-11e6-9181-c9e612eefd7d.png) r? @brson (tagging Brian because he [wrote](https://github.com/rust-lang/rust/pull/21958) the lint)
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-30stable features lint warning mentions version stabilizedZack M. Davis-3/+7
To accomplish this, we alter the checks in `rustc::middle::stability` to use the `StabilityLevel` defined in `syntax::attr` (which includes the version in which the feature was stabilized) rather than the local `StabilityLevel` in the same module, and make the `declared_stable_lang_features` field of `syntax::feature_gate::Features` hold a Vec of feature-name, span tuples (in analogy to the `declared_lib_features` field) rather than just spans. This is in the matter of issue #33394.
2016-05-29Auto merge of #33929 - petrochenkov:pathir, r=eddybbors-8/+4
Separate bindings from other patterns in HIR Now when name resolution is done on AST, we can avoid dumping everything that looks like an identifier into `PatKind::Ident` in HIR. `hir::PatKind::Ident` is removed, fresh bindings are now called `hir::PatKind::Binding`, everything else goes to `hir::PatKind::Path`. I intend to do something with `PatKind::Path`/`PatKind::QPath` as well using resolution results, but it requires some audit and maybe some deeper refactoring of relevant resolution/type checking code to do it properly. I'm submitting this part of the patch earlier to notify interested parties that I'm working on this. cc @jseyfried r? @eddyb
2016-05-29Auto merge of #33934 - Byron:libsyntex-ring-buffer-size, r=pnkfelixbors-2/+2
Prevent overflows by increasing ring buffer size Please note that this change is just done to prevent issues as currently seen by syntex_syntax in future. See https://github.com/serde-rs/syntex/pull/47 for details. As shown in https://github.com/serde-rs/syntex/issues/33, complex code can easily overflow the ring-buffer and cause an assertion error.
2016-05-28Prevent overflows by increasing ring buffer sizeSebastian Thiel-2/+2
Please note that this change is just done to prevent issues as currently seen by syntex_syntax in future. See https://github.com/serde-rs/syntex/pull/47 for details. As shown in https://github.com/serde-rs/syntex/issues/33, complex code can easily overflow the ring-buffer and cause an assertion error.
2016-05-28Move some other checks to AST sanity passVadim Petrochenkov-29/+13
2016-05-28Auto merge of #33821 - sanxiyn:cfg-test, r=nikomatsakisbors-11/+3
Do not inject test harness for --cfg test Fix #33670.
2016-05-28Address review commentsVadim Petrochenkov-2/+4
2016-05-28Refactor away some functions from hir::pat_utilVadim Petrochenkov-12/+6
2016-05-28Rollup merge of #33854 - petrochenkov:prefvis, r=eddybManish Goregaokar-11/+4
Apply visit_path to import prefixes by default Overriding `visit_path` is not enough to visit all paths, some import prefixes are not visited and `visit_path_list_item` need to be overridden as well. This PR removes this catch, it should be less error prone this way. Also, the prefix is visited once now, not repeatedly for each path list item. r? @eddyb
2016-05-28Rollup merge of #33820 - jonathandturner:format_readability_updates, ↵Manish Goregaokar-0/+32
r=nikomatsakis Increase spacing in error format for readability. Two small tweaks that seem to help readability quite a bit: * Add spacing header<->snippet, but use the |> on the side for visual consistency * Fix #33819 * Fix #33763 * Move format-sensitive test (issue-26480 in cfail) to ui test r? @nikomatsakis
2016-05-28Fix macro call site spansJeffrey Seyfried-23/+1
2016-05-27Auto merge of #33706 - jseyfried:refactor_cfg, r=nrcbors-603/+348
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-27Comment methods in `CfgFolder`Jeffrey Seyfried-0/+7
2016-05-27Auto merge of #33900 - GuillaumeGomez:rollup, r=GuillaumeGomezbors-7/+10
Rollup of 10 pull requests - Successful merges: #33753, #33815, #33829, #33858, #33865, #33866, #33870, #33874, #33891, #33898 - Failed merges:
2016-05-27Rollup merge of #33870 - jseyfried:ice-issue-33569, r=pnkfelixGuillaume Gomez-7/+10
Fix ICE on parsing a bad metavariable in a macro definition Fixes #33569, fixes #33728. r? @pnkfelix
2016-05-27Rollup merge of #33839 - kamalmarhubi:codemape-get-filemap-option, r=nmatsakisManish Goregaokar-3/+3
This is more idiomatic, putting the caller in charge of whether or not to panic.
2016-05-27Rollup merge of #33644 - petrochenkov:selfast, r=nrcManish Goregaokar-221/+124
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-76/+97
cc https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth