about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2016-09-17Auto merge of #36485 - nnethercote:char_lit-2, r=nagisabors-43/+28
Overhaul char_lit() This commit does the following. - Removes parsing support for '\X12', '\u123456' and '\U12345678' char literals. These are no longer valid Rust and rejected by the lexer. (This strange-sounding situation occurs because the parser rescans char literals to compute their value.) - Rearranges the function so that all the escaped values are handled in a single `match`. The error-handling strategy is based on the one used by byte_lit().
2016-09-16Auto merge of #36482 - jseyfried:dont_load_unconfigured_noninline_modules, r=nrcbors-10/+19
Avoid loading and parsing unconfigured non-inline modules. For example, `#[cfg(any())] mod foo;` will always compile after this PR, even if `foo.rs` and `foo/mod.rs` do not exist or do not contain valid Rust. Fixes #36478 and fixes #27873. r? @nrc
2016-09-16Auto merge of #36444 - jseyfried:macro_rules_ext, r=nrcbors-62/+58
Remove variant `MacroRulesTT` of `SyntaxExtension` r? @nrc
2016-09-16Overhaul char_lit().Nicholas Nethercote-43/+28
This commit does the following. - Removes parsing support for '\X12', '\u123456' and '\U12345678' char literals. These are no longer valid Rust and rejected by the lexer. (This strange-sounding situation occurs because the parser rescans char literals to compute their value.) - Rearranges the function so that all the escaped values are handled in a single `match`, and changes the error-handling to use vanilla assert!() and unwrap().
2016-09-15Remove `MacroRulesTT`.Jeffrey Seyfried-50/+47
2016-09-15Allow `IdentMacroExpander::expand` to access the ident macro invocation's ↵Jeffrey Seyfried-3/+5
attributes.
2016-09-15Move fields `single_step` and `keep_macs` from `MacroExpander` to ↵Jeffrey Seyfried-10/+7
`ExpansionConfig`.
2016-09-15Auto merge of #36393 - petrochenkov:ancient, r=eddybbors-44/+4
Remove some obsolete code from the compiler
2016-09-15Rollup merge of #36438 - jseyfried:node_ids_in_expansion, r=nrcManish Goregaokar-538/+310
Assign node ids during macro expansion After this PR, - The `ExtCtxt` can access `resolve`'s `Resolver` through the trait object `ext::base::Resolver`. - The `Resolver` trait object can load macros and replaces today's `MacroLoader` trait object. - The macro expander uses the `Resolver` trait object to resolve macro invocations. - The macro expander assigns node ids and builds the `Resolver`'s `macros_at_scope` map. - This is groundwork for merging import resolution and expansion. - Performance of expansion together with node id assignment improves by ~5%. **EDIT:** Since Github is reordering the commits, here is `git log`: - b54e1e399741579612f13e2df98a25ea9447989d: Differentiate between monotonic and non-monotonic expansion and only assign node ids during monotonic expansion. - 78c00398780db6f59ebf43e765fa9368dad436d2: Expand generated test harnesses and macro registries. - f3c2dca3539e6edc745f9c91898cb97d281865c1: Remove scope placeholders from the crate root. - c86c8d41a26b2037e80c9fd028a59313a78b3a66: Perform node id assignment and `macros_at_scope` construction during the `InvocationCollector` and `PlaceholderExpander` folds. - 72a636975fc5d0bb4af45af7bdd97987cc722a6a: Move macro resolution into `librustc_resolve`. - 20b43b23230ce063ccf99a4841d85790ad311bdf: Rewrite the unit tests in `ext/expand.rs` as a `compile-fail` test. - a9821e1658240bb2c056f260a4b6bc9789301fae: Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`. - 60440b226d2f70bdae803443ff7ad2e2af2c9b10: Refactor `noop_fold_stmt_kind` out of `noop_fold_stmt`. - 50f94f6c95c944f08c4af264f48260e42efefd47: Avoid needless reexpansions. r? @nrc
2016-09-15Rollup merge of #36384 - petrochenkov:derclone, r=alexcrichtonManish Goregaokar-0/+18
Improve shallow `Clone` deriving `Copy` unions now support `#[derive(Clone)]`. Less code is generated for `#[derive(Clone, Copy)]`. + Unions now support `#[derive(Eq)]`. Less code is generated for `#[derive(Eq)]`. --- Example of code reduction: ``` enum E { A { a: u8, b: u16 }, B { c: [u8; 100] }, } ``` Before: ``` fn clone(&self) -> E { match (&*self,) { (&E::A { a: ref __self_0, b: ref __self_1 },) => { ::std::clone::assert_receiver_is_clone(&(*__self_0)); ::std::clone::assert_receiver_is_clone(&(*__self_1)); *self } (&E::B { c: ref __self_0 },) => { ::std::clone::assert_receiver_is_clone(&(*__self_0)); *self } } } ``` After: ``` fn clone(&self) -> E { { let _: ::std::clone::AssertParamIsClone<u8>; let _: ::std::clone::AssertParamIsClone<u16>; let _: ::std::clone::AssertParamIsClone<[u8; 100]>; *self } } ``` All the matches are removed, bound assertions are more lightweight. `let _: Checker<CheckMe>;`, unlike `checker(&check_me);`, doesn't have to be translated by rustc_trans and then inlined by LLVM, it doesn't even exist in MIR, this means faster compilation. --- Union impls are generated like this: ``` union U { a: u8, b: u16, c: [u8; 100], } ``` ``` fn clone(&self) -> U { { let _: ::std::clone::AssertParamIsCopy<Self>; *self } } ``` Fixes https://github.com/rust-lang/rust/issues/36043 cc @durka r? @alexcrichton
2016-09-15Avoid loading and parsing unconfigured non-inline modules.Jeffrey Seyfried-10/+19
2016-09-14Rollup merge of #36396 - athulappadan:Default-docs, r=blussGuillaume Gomez-0/+2
Documentation of what Default does for each type Addresses #36265 I haven't changed the following types due to doubts: 1)src/libstd/ffi/c_str.rs 2)src/libcore/iter/sources.rs 3)src/libcore/hash/mod.rs 4)src/libcore/hash/mod.rs 5)src/librustc/middle/privacy.rs r? @steveklabnik
2016-09-13Remove parsing of obsolete pre-1.0 syntaxesVadim Petrochenkov-44/+4
2016-09-13Differentiate between monotonic and non-monotonic expansion andJeffrey Seyfried-15/+31
only assign node ids during monotonic expansion.
2016-09-13Expand generated test harnesses and macro registries.Jeffrey Seyfried-15/+15
2016-09-13Remove scope placeholders from the crate root.Jeffrey Seyfried-2/+13
2016-09-13Perform node id assignment and `macros_at_scope` construction duringJeffrey Seyfried-9/+79
the `InvocationCollector` and `PlaceholderExpander` folds.
2016-09-13Move macro resolution into `librustc_resolve`.Jeffrey Seyfried-349/+150
2016-09-13Rewrite the unit tests in `ext/expand.rs` as a `compile-fail` test.Jeffrey Seyfried-107/+0
2016-09-13Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`.Jeffrey Seyfried-15/+15
2016-09-13Refactor `noop_fold_stmt_kind` out of `noop_fold_stmt`.Jeffrey Seyfried-37/+13
2016-09-13Avoid needless reexpansions.Jeffrey Seyfried-5/+10
2016-09-12crate-ify compiler-rt into compiler-builtinsJorge Aparicio-0/+10
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib This commit moves the logic that used to build libcompiler-rt.a into a compiler-builtins crate on top of the core crate and below the std crate. This new crate still compiles the compiler-rt instrinsics using gcc-rs but produces an .rlib instead of a static library. Also, with this commit rustc no longer passes -lcompiler-rt to the linker. This effectively makes the "no-compiler-rt" field of target specifications a no-op. Users of `no_std` will have to explicitly add the compiler-builtins crate to their crate dependency graph *if* they need the compiler-rt intrinsics. Users of the `std` have to do nothing extra as the std crate depends on compiler-builtins. Finally, this a step towards lazy compilation of std with Cargo as the compiler-rt intrinsics can now be built by Cargo instead of having to be supplied by the user by some other method. closes #34400
2016-09-12Auto merge of #36354 - mikhail-m1:master, r=jonathandturnerbors-5/+5
fix span for errors E0537, E0535 & E0536 fix #36182 as part of #35233
2016-09-12Auto merge of #36414 - nnethercote:char_lit, r=jseyfriedbors-19/+16
Improve char_lit's readability and speed This is my first contribution to rustc. Please let me know if I've done anything wrong. (I ran `make tidy` before making the pull request.)
2016-09-12Lazily construct panic messages in char_lit().Nicholas Nethercote-5/+7
This reduces the time taken to run `rustc -Zparse-only rustc-benchmarks/issue-32278-big-array-of-strings` from 0.18s to 0.15s on my machine, and reduces the number of instructions (as measured by Cachegrind) from 1.34B to 1.01B. With the change applied, the time to fully compile that benchmark is 1.96s, so this is a 1.5% improvement.
2016-09-12Avoid an unnecessary intermediate value in char_lit().Nicholas Nethercote-14/+9
This makes the function more concise and easier to understand.
2016-09-11Documentation for default types modifiedathulappadan-1/+1
2016-09-11Documentation of what does for each typeathulappadan-0/+2
2016-09-10Improve `Eq` derivingVadim Petrochenkov-0/+18
2016-09-10fix span for errors E0537, E0535 & E0536Mikhail Modin-5/+5
2016-09-09Auto merge of #36332 - llogiq:static_consts_feature, r=nikomatsakisbors-0/+3
add static_in_const feature gate also updates tests and deletes the spurious .bk files I inadvertently added last time. r? @nikomatsakis
2016-09-07Auto merge of #36214 - jseyfried:stackless_expansion, r=nrcbors-717/+937
macros: stackless expansion After this PR, macro expansion cannot overflow the stack unless the expanded crate is too deep to fold. Everything but the stackless placeholder expansion commit is also groundwork for macro modularization. r? @nrc or @eddyb
2016-09-07Improve `directory` computation during invocation collection.Jeffrey Seyfried-5/+9
2016-09-07Implement stackless placeholder expansion.Jeffrey Seyfried-8/+22
2016-09-07Strip unconfigured nodes in the `InvocationCollector` fold.Jeffrey Seyfried-19/+67
2016-09-07Refactor code out of the folder implementation for `StripUnconfigured`.Jeffrey Seyfried-55/+75
2016-09-07add static_in_const feature gateAndre Bogus-0/+3
also updates tests and deletes the spurious .bk files I inadvertently added last time.
2016-09-06Auto merge of #36025 - michaelwoerister:incr-comp-hash-spans, r=nikomatsakisbors-20/+4
incr. comp.: Take spans into account for ICH This PR makes the ICH (incr. comp. hash) take spans into account when debuginfo is enabled. A side-effect of this is that the SVH (which is based on the ICHs of all items in the crate) becomes sensitive to the tiniest change in a code base if debuginfo is enabled. Since we are not trying to model ABI compatibility via the SVH anymore (this is done via the crate disambiguator now), this should be not be a problem. Fixes #33888. Fixes #32753.
2016-09-05Rollup merge of #36245 - alexcrichton:add-back-accident, r=arielb1Manish Goregaokar-0/+1
Add back feature accidentally removed This feature was accidentally removed in https://github.com/rust-lang/rust/pull/35957.
2016-09-05Load macros from `extern crate`s in the `InvocationCollector` fold.Jeffrey Seyfried-62/+22
2016-09-05Implement stackless expansion.Jeffrey Seyfried-178/+191
2016-09-05Add module `ext::placeholders` with `placeholder()` and `PlaceholderExpander`.Jeffrey Seyfried-39/+182
2016-09-05Refactor `expand_invoc(.., fld)` -> `self.expand_invoc(..)`.Jeffrey Seyfried-207/+212
2016-09-05Refactor `SyntaxEnv`.Jeffrey Seyfried-126/+119
2016-09-05Refactor `expand_*` into `expander.fold_*`.Jeffrey Seyfried-214/+194
2016-09-05Clean up module processing.Jeffrey Seyfried-34/+20
2016-09-05Refactor out `expand_item` (with better semantics than before).Jeffrey Seyfried-36/+39
2016-09-05Refactor away `expand_item`.Jeffrey Seyfried-7/+3
2016-09-05Generalize `Invocation` to include modifiers/decorators.Jeffrey Seyfried-95/+138