about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-07-27Make more informative error on outer attr after innerEvgenii P-15/+32
2019-07-26Auto merge of #62086 - petrochenkov:builtout, r=eddybbors-1/+6
Define built-in macros through libcore This PR defines built-in macros through libcore using a scheme similar to lang items (attribute `#[rustc_builtin_macro]`). All the macro properties (stability, visibility, etc.) are taken from the source code in libcore, with exception of the expander function transforming input tokens/AST into output tokens/AST, which is still provided by the compiler. The macros are made available to user code through the standard library prelude (`{core,std}::prelude::v1`), so they are still always in scope. As a result **built-in macros now have stable absolute addresses in the library**, like `core::prelude::v1::line!()`, this is an insta-stable change. Right now `prelude::v1` is the only publicly available absolute address for these macros, but eventually they can be moved into more appropriate locations with library team approval (e.g. `Clone` derive -> `core::clone::Clone`). Now when built-in macros have canonical definitions they can be imported or reexported without issues (https://github.com/rust-lang/rust/issues/61687). Other changes: - You can now define a derive macro with a name matching one of the built-in derives (https://github.com/rust-lang/rust/issues/52269). This was an artificial restriction that could be worked around with import renaming anyway. Known regressions: - Empty library crate with a crate-level `#![test]` attribute no longer compiles without `--test`. Previously it didn't compile *with* `--test` or with the bin crate type. Fixes https://github.com/rust-lang/rust/issues/61687 Fixes https://github.com/rust-lang/rust/issues/61804 r? @eddyb
2019-07-26Rollup merge of #62983 - Mark-Simulacrum:remove-needless-rc, r=petrochenkovMazdak Farrokhzad-20/+16
Remove needless indirection through Rc NamedMatch is already cheap to clone due to Lrc's inside.
2019-07-26Rollup merge of #62963 - estebank:homoglyph-recovery, r=petrochenkovMazdak Farrokhzad-35/+52
Allow lexer to recover from some homoglyphs
2019-07-26Rollup merge of #62956 - ia0:fix_62831, r=petrochenkovMazdak Farrokhzad-27/+26
Implement slow-path for FirstSets::first When 2 or more sequences share the same span, we can't use the precomputed map for their first set. So we compute it recursively. Fixes #62831.
2019-07-26Introduce built-in macros through libcoreVadim Petrochenkov-1/+6
2019-07-25Implement slow-path for FirstSets::firstJulien Cretin-27/+26
When 2 or more sequences share the same span, we can't use the precomputed map for their first set. So we compute it recursively. Fixes #62831.
2019-07-25Rollup merge of #62887 - estebank:issue-62881, r=petrochenkovMazdak Farrokhzad-1/+14
Make the parser TokenStream more resilient after mismatched delimiter recovery Fix #62881, fix #62895.
2019-07-25Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichtonMazdak Farrokhzad-89/+175
Turn `#[global_allocator]` into a regular attribute macro It was a 99% macro with exception of some diagnostic details. As a result of the change, `#[global_allocator]` now works in nested modules and even in nameless blocks. Fixes https://github.com/rust-lang/rust/issues/44113 Fixes https://github.com/rust-lang/rust/issues/58072
2019-07-25Rollup merge of #60938 - jonas-schievink:doc-include-paths, r=petrochenkovMazdak Farrokhzad-33/+32
rustdoc: make #[doc(include)] relative to the containing file This matches the behavior of other in-source paths like `#[path]` and the `include_X!` macros. Fixes https://github.com/rust-lang/rust/pull/58373#issuecomment-462349380 Also addresses https://github.com/rust-lang/rust/issues/44732#issuecomment-467660239 cc #44732 This is still missing a stdsimd change (https://github.com/jonas-schievink/stdsimd/commit/42ed30e0b5fb5e2d11765b5d1e1f36234af85984), so CI will currently fail. I'll land that change once I get initial feedback for this PR.
2019-07-25review comments: add FIXME comments and formattingEsteban Küber-8/+21
2019-07-25Remove needless indirection through RcMark Rousskov-20/+16
NamedMatch is already cheap to clone due to Lrc's inside.
2019-07-24Allow lexer to recover from some homoglyphsEsteban Küber-33/+37
2019-07-25Rollup merge of #62901 - petrochenkov:serde, r=CentrilMazdak Farrokhzad-11/+7
cleanup: Remove `extern crate serialize as rustc_serialize`s
2019-07-24Rollup merge of #62917 - estebank:trailing-slash, r=matkladMazdak Farrokhzad-1/+1
Always emit trailing slash error Fix #62913. r? @petrochenkov
2019-07-24Rollup merge of #62890 - ↵Mazdak Farrokhzad-5/+5
fakenine:normalize_use_of_backticks_compiler_messages_p15, r=Centril Normalize use of backticks in compiler messages for libsyntax/* https://github.com/rust-lang/rust/issues/60532
2019-07-24Demote template check error to a lint for `#[test]` and `#[bench]`Vadim Petrochenkov-1/+2
2019-07-24syntax_ext: Reuse built-in attribute template checking for macro attributesVadim Petrochenkov-88/+98
2019-07-24syntax_ext: Turn `#[global_allocator]` into a regular attribute macroVadim Petrochenkov-1/+22
2019-07-24Merge `rustc_allocator` into `libsyntax_ext`Vadim Petrochenkov-0/+54
2019-07-23Always emit trailing slash errorEsteban Küber-1/+1
2019-07-23review commentsEsteban Küber-3/+4
2019-07-23Fix another caseEsteban Küber-3/+12
2019-07-23Normalize use of backticks in compiler messages for libsyntax/*Samy Kacimi-5/+5
https://github.com/rust-lang/rust/issues/60532
2019-07-23Rollup merge of #62869 - matklad:feature-gate, r=Mark-SimulacrumMark Rousskov-0/+3
add rustc_private as a proper language feature gate At the moment, `rustc_private` as a (library) feature exists by accident: `char::is_xid_start`, `char::is_xid_continue` methods in libcore define it. cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/How.20to.20declare.20new.20langauge.20feature.3F I don't know if this is at all reasonable, but at least tests seem to pass locally. That probably means that we can remove/rename to something more resonable the feature in libcore in the next release?
2019-07-23Rollup merge of #62851 - matklad:unescape, r=petrochenkovMark Rousskov-609/+5
move unescape module to rustc_lexer It makes sense to keep the definition of escape sequences closer to the lexer itself, and it is also a bit of code that I would like to share with rust-analyzer. r? @petrochenkov
2019-07-23Rollup merge of #62791 - estebank:type-ascription, r=petrochenkovMark Rousskov-65/+73
Handle more cases of typos misinterpreted as type ascription Fix #60933, #54516. CC #47666, #34255, #48016.
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-11/+7
2019-07-23Make path::resolve a method on ExtCtxtJonas Schievink-36/+30
2019-07-23Make #[doc(include)] paths behave like other pathsJonas Schievink-5/+2
This makes them relative to the containing file instead of the crate root
2019-07-23libsyntax: factor out file path resolvingJonas Schievink-27/+35
This allows the same logic used by `include_X!` macros to be used by `#[doc(include)]`.
2019-07-22Make the parser TokenStream more resilient after mismatched delimiter recoveryEsteban Küber-0/+3
2019-07-22Rollup merge of #62870 - matklad:issue-62863, r=petrochenkovMazdak Farrokhzad-1/+1
fix lexing of comments with many \r closes #62863
2019-07-22add rustc_private as a proper language feature gateAleksey Kladov-0/+3
At the moment, `rustc_private` as a (library) feature exists by accident: `char::is_xid_start`, `char::is_xid_continue` methods in libcore define it.
2019-07-22fix lexing of comments with many \rAleksey Kladov-1/+1
closes #62863
2019-07-21Fix typo in Unicode character nameAndrew Dassonville-1/+1
2019-07-21move unescape module to rustc_lexerAleksey Kladov-609/+5
2019-07-20Introduce rustc_lexerAleksey Kladov-1251/+536
The idea here is to make a reusable library out of the existing rust-lexer, by separating out pure lexing and rustc-specific concerns, like spans, error reporting an interning. So, rustc_lexer operates directly on `&str`, produces simple tokens which are a pair of type-tag and a bit of original text, and does not report errors, instead storing them as flags on the token.
2019-07-20Auto merge of #62008 - ia0:issues_61053, r=petrochenkovbors-67/+683
Add meta-variable checks in macro definitions This is an implementation of #61053. It is not sound (some errors are not reported) and not complete (reports may not be actual errors). This is due to the possibility to define macros in macros in indirect ways. See module documentation of `macro_check` for more details. What remains to be done: - [x] Migrate from an error to an allow-by-default lint. - [x] Add more comments in particular for the handling of nested macros. - [x] Add more tests if needed. - [x] Try to avoid cloning too much (one idea is to use lists on the stack). - [ ] Run crater with deny-by-default lint (measure rate of false positives). - [ ] Remove extra commit for deny-by-default lint - [x] Create a PR to remove the old `question_mark_macro_sep` lint #62160
2019-07-19review commentsEsteban Küber-16/+10
2019-07-19Implement checks for meta-variables in macrosJulien Cretin-46/+650
2019-07-19Remember the span of the Kleene operator in macrosJulien Cretin-21/+33
This is needed for having complete error messages where reporting macro variable errors. Here is what they would look like: error: meta-variable repeats with different kleene operator --> $DIR/issue-61053-different-kleene.rs:3:57 | LL | ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* }; | - expected repetition ^^ - conflicting repetition
2019-07-19Handle more cases of typos misinterpreted as type ascriptionEsteban Küber-61/+75
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-35/+35
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-25/+25
2019-07-18Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddybbors-2/+5
rustc/rustc_mir: Implement RFC 2203. This PR implements RFC 2203, allowing constants in array repeat expressions. Part of #49147. r? @eddyb
2019-07-16Rollup merge of #62703 - ↵Mark Rousskov-3/+3
fakenine:normalize_use_of_backticks_compiler_messages_p6, r=eddyb normalize use of backticks in compiler messages for libsyntax/parse https://github.com/rust-lang/rust/issues/60532
2019-07-16Rollup merge of #62666 - estebank:preempt-ice, r=eddybMark Rousskov-8/+9
Cancel unemitted diagnostics during error recovery Follow up to https://github.com/rust-lang/rust/pull/62604. Use @eddyb's preferred style and catch other case of the same problem. r? @eddyb
2019-07-15Rollup merge of #62668 - goodmanjonathan:fix-62660, r=estebankMark Rousskov-1/+1
Fix #62660 If the explicitly given type of a `self` parameter fails to parse correctly, we need to propagate the error rather than dropping it and causing an ICE. Fixes #62660.
2019-07-15Rollup merge of #62646 - estebank:wording, r=petrochenkovMark Rousskov-3/+3
Tweak wording in feature gate errors