about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-07-10Fully privatize (vs. crate visibility) functionsMark Rousskov-18/+18
2019-07-10Move pp::Printer out field to owned StringMark Rousskov-26/+21
This enforces that eof() must be called to get the String out, and generally is better from an API perspective. No users of pretty printing pre-allocate the buffer.
2019-07-10Inline State::new_from_input in pprustMark Rousskov-18/+6
This function took too many arguments and are simple on the inside; inlining them makes complexity go down. hir::print's copy is unfortunately used from librustc_driver so inlining it is not as straightforward.
2019-07-10print_crate returns String instead of taking an out pointerMark Rousskov-4/+5
2019-07-10Replace src: &mut dyn Read with StringMark Rousskov-7/+3
2019-07-10Combine comment-handling logic into structMark Rousskov-37/+57
This also permits sharing the underlying code between pprust and hir::print.
2019-07-10Inline State::newMark Rousskov-9/+1
There was only one callsite for each and this removes the unwrap_or_default's on the comments argument
2019-07-10Stop Option-wrapping commentsMark Rousskov-14/+10
We always check against the length before indexing anyway.
2019-07-10Remove unused boxes vectorMark Rousskov-12/+0
2019-07-10Privatize and remove unused functionsMark Rousskov-19/+9
2019-07-10Move lifetime_to_string to Display implMark Rousskov-5/+7
2019-07-10Remove unused arm_to_stringMark Rousskov-4/+0
2019-07-10Remove duplicate attr_to_stringMark Rousskov-5/+1
attribute_to_string exists.
2019-07-10Move literal_to_string to fmt::DisplayMark Rousskov-6/+30
2019-07-10Rollup merge of #62393 - petrochenkov:notto-disu, r=Mark-SimulacrumMazdak Farrokhzad-49/+64
Fix pretty-printing of `$crate` (take 4) Pretty-print `$crate` as `crate` or `crate_name` in unstructured tokens like `a $crate c` in `foo!(a $crate c)`, but only if those tokens are printed as a part of AST pretty-printing, rather than as a standalone token stream. Fixes https://github.com/rust-lang/rust/issues/62325 Previous iterations - https://github.com/rust-lang/rust/pull/56647, https://github.com/rust-lang/rust/pull/57155, https://github.com/rust-lang/rust/pull/57915.
2019-07-09Resolve `$crate` in all hygienic contexts for pretty-pringingVadim Petrochenkov-2/+2
Stop visiting AST to discover those contexts, just iterate through hygiene data instead
2019-07-09Pretty-print `$crate` as `crate`/`::my_crate` in tokensVadim Petrochenkov-47/+62
...but only if those tokens are printed from inside of AST pretty-printing.
2019-07-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-13/+13
https://github.com/rust-lang/rust/issues/60532
2019-07-07syntax: Add feature gate.David Wood-2/+5
This commit adds a `const_in_array_repeat_expressions` feature gate and only create `Candidate::Repeat` if it is enabled.
2019-07-07Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomezMazdak Farrokhzad-0/+4
rustdoc: set cfg(doctest) when collecting doctests Note: This PR builds on top of https://github.com/rust-lang/rust/pull/61199; only the last commit is specific to this PR. As discussed in https://github.com/rust-lang/rust/pull/61199, we want the ability to isolate items to only when rustdoc is collecting doctests, but we can't use `cfg(test)` because of libcore's `#![cfg(not(test))]`. This PR proposes a new cfg flag, `cfg(doctest)`, specific to this situation, rather than reusing an existing flag. I've isolated it behind a feature gate so that we can contain the effects to nightly only. (A stable workaround that can be used in lieu of `#[cfg(doctest)]` is `#[cfg(rustdoc)] #[doc(hidden)]`, at least once https://github.com/rust-lang/rust/pull/61351 lands.) Tracking issue: https://github.com/rust-lang/rust/issues/62210
2019-07-07Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasperMazdak Farrokhzad-130/+53
Support stability and deprecation checking for all macros RELNOTES: Deprecation attributes on macros now have effect. Fixes https://github.com/rust-lang/rust/issues/34079 Fixes https://github.com/rust-lang/rust/issues/49912 Unblocks https://github.com/rust-lang/rust/pull/62086 Unblocks https://github.com/rust-lang/rust/pull/61000
2019-07-07syntax: Pre-intern names of all built-in macrosVadim Petrochenkov-4/+4
They always end up interned anyway
2019-07-07syntax: Migrate built-in macros to the regular stability checkingVadim Petrochenkov-60/+23
2019-07-07Support deprecation checking for macrosVadim Petrochenkov-2/+6
2019-07-07syntax: Keep full `Stability` in `SyntaxExtension`Vadim Petrochenkov-18/+8
2019-07-07resolve/expand: Move macro stability checking to an earlier pointVadim Petrochenkov-42/+9
2019-07-07syntax: Remove `NodeId` from `SyntaxExtension`Vadim Petrochenkov-8/+7
2019-07-06rustdoc: set cfg(doctest) when collecting doctestsQuietMisdreavus-0/+4
2019-07-07rustc: Remove `dylib` crate type from most rustc cratesAlex Crichton-1/+1
Now that procedural macros no longer link transitively to libsyntax, this shouldn't be needed any more! This commit is an experiment in removing all dynamic libraries from rustc except for librustc_driver itself. Let's see how far we can get with that!
2019-07-06privacy: Only opaque macros leak private thingsVadim Petrochenkov-18/+48
2019-07-06Fix tidy issuesVadim Petrochenkov-1/+1
2019-07-06`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`Vadim Petrochenkov-8/+14
2019-07-06`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`Vadim Petrochenkov-1/+1
2019-07-06Rollup merge of #62329 - matklad:no-peeking, r=petrochenkovMazdak Farrokhzad-157/+94
Remove support for 1-token lookahead from the lexer `StringReader` maintained `peek_token` and `peek_span_src_raw` for look ahead. `peek_token` was used only by rustdoc syntax coloring. After moving peeking logic into highlighter, I was able to remove `peek_token` from the lexer. I tried to use `iter::Peekable`, but that wasn't as pretty as I hoped, due to buffered fatal errors. So I went with hand-rolled peeking. After that I've noticed that the only peeking behavior left was for raw tokens to test tt jointness. I've rewritten it in terms of trivia tokens, and not just spans. After that it became possible to simplify the awkward constructor of the lexer, which could return `Err` if the first peeked token contained error.
2019-07-05Rollup merge of #62133 - petrochenkov:norustc, r=eddybMazdak Farrokhzad-16/+48
Feature gate `rustc` attributes harder Fixes https://github.com/rust-lang/rust/issues/62116
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-2/+1
Implement another internal lints cc #49509 This adds ~~two~~ one internal lint~~s~~: 1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669 2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~ ~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~ TODO (not directly relevant for review): - [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb) - [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870 - [x] Check explicitly for the `{declare,impl}_lint_pass!` macros r? @oli-obk
2019-07-05Rollup merge of #62292 - Centril:split-async-closures, r=cramertjMazdak Farrokhzad-39/+53
Move `async || ...` closures into `#![feature(async_closure)]` The `async || expr` syntax is moved out from `#![feature(async_await)]` into its own gate `#![feature(async_closure)]`. New tracking issue: https://github.com/rust-lang/rust/issues/62290 Closes https://github.com/rust-lang/rust/issues/62214. cc https://github.com/rust-lang/rust/issues/62149 r? @varkor
2019-07-05Auto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddybbors-1298/+1147
Remove io::Result from syntax::print Since we're now writing directly to the vector, there's no need to thread results through the whole printing infrastructure
2019-07-04Switch master to 1.38Mark Rousskov-11/+0
2019-07-04make unwrap_or_abort non-generic againAleksey Kladov-1/+1
2019-07-04remove unused mk_sp_and_rawAleksey Kladov-10/+3
2019-07-04don't rely on spans when checking tokens for jointnessAleksey Kladov-47/+29
2019-07-04slightly comment lexer APIAleksey Kladov-11/+18
2019-07-04move constructors to topAleksey Kladov-51/+51
2019-07-04cleanup lexer constructorsAleksey Kladov-15/+7
2019-07-04remove peek_span_src_raw from StringReaderAleksey Kladov-68/+45
2019-07-04remove peek_token from StringReaderAleksey Kladov-18/+8
2019-07-04remove StringReader::peekAleksey Kladov-4/+0
The reader itself doesn't need ability to peek tokens, so it's better if clients implement this functionality. This hopefully becomes especially easy once we use iterator interface for lexer, but this is not too easy at the moment, because of buffered errors.
2019-07-04Rollup merge of #62297 - matklad:peek-delimited, r=petrochenkovMazdak Farrokhzad-67/+72
refactor check_for_substitution No behavior change, just flatter and simpler code. r? @petrochenkov
2019-07-04Rollup merge of #62258 - petrochenkov:idclean, r=CentrilMazdak Farrokhzad-170/+89
syntax: Unsupport `foo! bar { ... }` macros in the parser Their support in expansion was removed in https://github.com/rust-lang/rust/pull/61606. Also un-reserve `macro_rules` as a macro name, there's no ambiguity between `macro_rules` definitions and macro calls (it also wasn't reserved correctly). cc https://github.com/rust-lang-nursery/wg-grammar/issues/51