Commit Graph

8883 Commits

Author SHA1 Message Date
Vadim Petrochenkov 987be89db3 Fix tidy issues 2019-07-06 16:59:08 +03:00
Vadim Petrochenkov 22d6d8ac76 #[rustc_transparent_macro] -> #[rustc_macro_transparency = ...] 2019-07-06 16:59:08 +03:00
Vadim Petrochenkov 15042a3c1c #[rustc_doc_only_macro] -> #[rustc_builtin_macro] 2019-07-06 16:59:08 +03:00
Mazdak Farrokhzad 952ee77871 Rollup merge of #62329 - matklad:no-peeking, r=petrochenkov
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-06 02:38:01 +02:00
Mazdak Farrokhzad 0224532493 Rollup merge of #62133 - petrochenkov:norustc, r=eddyb
Feature gate `rustc` attributes harder

Fixes https://github.com/rust-lang/rust/issues/62116
2019-07-05 20:26:54 +02:00
Mazdak Farrokhzad 485a084b45 Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk
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) 🤔 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-05 20:26:51 +02:00
Mazdak Farrokhzad 84527e4676 Rollup merge of #62292 - Centril:split-async-closures, r=cramertj
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-05 13:53:06 +02:00
bors f119bf2761 Auto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
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-05 06:55:48 +00:00
Mark Rousskov 8a7dded1a2 Switch master to 1.38 2019-07-04 11:26:57 -04:00
Aleksey Kladov 3e362a4800 make unwrap_or_abort non-generic again 2019-07-04 09:12:33 +03:00
Aleksey Kladov 3035a05a74 remove unused mk_sp_and_raw 2019-07-04 09:12:33 +03:00
Aleksey Kladov 8bea334a26 don't rely on spans when checking tokens for jointness 2019-07-04 09:12:24 +03:00
Aleksey Kladov 1c6eb19d2f slightly comment lexer API 2019-07-04 09:08:45 +03:00
Aleksey Kladov 30fa99e5b8 move constructors to top 2019-07-04 09:08:45 +03:00
Aleksey Kladov 601bad86b2 cleanup lexer constructors 2019-07-04 09:08:45 +03:00
Aleksey Kladov 256df83f64 remove peek_span_src_raw from StringReader 2019-07-04 09:08:39 +03:00
Aleksey Kladov e9dc95c86e remove peek_token from StringReader 2019-07-04 09:01:37 +03:00
Aleksey Kladov 830ff4a592 remove StringReader::peek
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-04 09:01:37 +03:00
Mazdak Farrokhzad c0ec567214 Rollup merge of #62297 - matklad:peek-delimited, r=petrochenkov
refactor check_for_substitution

No behavior change, just flatter and simpler code.

r? @petrochenkov
2019-07-04 01:38:55 +02:00
Mazdak Farrokhzad 8867ba19de Rollup merge of #62258 - petrochenkov:idclean, r=Centril
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
2019-07-04 01:38:49 +02:00
Mazdak Farrokhzad 88c007cd04 Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
2019-07-04 01:38:46 +02:00
Mazdak Farrokhzad e8a88f7d43 Rollup merge of #62039 - jeremystucki:needless_lifetimes, r=eddyb
Remove needless lifetimes (rustc)
2019-07-04 01:38:41 +02:00
Mazdak Farrokhzad bb7fbb99a2 Add separate 'async_closure' feature gate. 2019-07-03 23:59:36 +02:00
bors 088b987307 Auto merge of #62335 - Mark-Simulacrum:rollup-0pcaz5a, r=Mark-Simulacrum
Rollup of 15 pull requests

Successful merges:

 - #62021 (MSVC link output improve)
 - #62064 (nth_back for chunks_exact)
 - #62128 (Adjust warning of -C extra-filename with -o.)
 - #62161 (Add missing links for TryFrom docs)
 - #62183 (std: Move a process test out of libstd)
 - #62186 (Add missing type urls in Into trait)
 - #62196 (Add Vec::leak)
 - #62199 (import gdb for explicit access to gdb.current_objfile())
 - #62229 (Enable intptrcast for explicit casts)
 - #62250 (Improve box clone doctests to ensure the documentation is valid)
 - #62255 (Switch tracking issue for `#![feature(slice_patterns)]`)
 - #62285 (Fix michaelwoerister's mailmap)
 - #62304 (HashMap is UnwindSafe)
 - #62319 (Fix mismatching Kleene operators)
 - #62327 (Fixed document bug, those replaced each other)

Failed merges:

r? @ghost
2019-07-03 14:29:08 +00:00
Mark Rousskov ea6c1fcf34 Rollup merge of #62255 - Centril:slice-patterns-change-issue, r=varkor
Switch tracking issue for `#![feature(slice_patterns)]`

Switches the tracking issue for `#![feature(slice_patterns)]` to a fresh one in https://github.com/rust-lang/rust/issues/62254 due to new RFCs.

Closes https://github.com/rust-lang/rust/issues/23121.

r? @varkor
2019-07-03 09:59:25 -04:00
bors 8c6fb028ca Auto merge of #61995 - eddyb:hir-sep-ptr, r=petrochenkov
rustc: use a separate copy of P for HIR than for AST.

Note: this currently includes/is based on top of #61987.

Like #61968, but goes one step further and uses a separate `P<...>` for the HIR, with no `Clone`, or the ability to mutate after allocation.
There is still `into_inner`/`into_iter`, but they're only exposed for `hir::lowering`, and they would take more work to untangle.

r? @petrochenkov cc @rust-lang/compiler
2019-07-03 10:57:39 +00:00
Jeremy Stucki b17cec509e Add missing lifetime specifier 2019-07-03 10:01:03 +02:00
Jeremy Stucki 87e8613fd4 Remove needless lifetimes 2019-07-03 10:00:23 +02:00
Niko Matsakis 076b0d0f5c more nits + typos 2019-07-02 12:25:23 -04:00
Niko Matsakis 74a6efbf00 feature-gate member constraints outside of async-await
Minimizes risk.
2019-07-02 12:25:22 -04:00
Aleksey Kladov dc088b26ce refactor check_for_substitution
No behavior change, just flatter and simpler code
2019-07-02 11:16:33 +03:00
Chris Gregory b0c199a969 Enable mem_take feature in relevant crates 2019-07-01 20:21:53 -07:00
Chris Gregory 636f5e6d11 Convert more usages over 2019-07-01 20:21:12 -07:00
Eduard-Mihai Burtescu c6374cfbe2 rustc: use a separate copy of P for HIR than for AST. 2019-07-01 14:34:34 +03:00
Eduard-Mihai Burtescu 25a920648a syntax: use box instead of Box::new in ptr::P. 2019-07-01 13:39:37 +03:00
Vadim Petrochenkov d0dc41a2bd Address review comments 2019-07-01 12:20:54 +03:00
Vadim Petrochenkov 3f39dc1b90 syntax: Unsupport foo! bar { ... } macros in the parser
Unreserve `macro_rules` as a macro name
2019-07-01 12:20:54 +03:00
bors 765eebf064 Auto merge of #62253 - Centril:rollup-115uuuq, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #62062 (Use a more efficient iteration order for forward dataflow)
 - #62063 (Use a more efficient iteration order for backward dataflow)
 - #62224 (rustdoc: remove unused derives and variants)
 - #62228 (Extend the #[must_use] lint to boxed types)
 - #62235 (Extend the `#[must_use]` lint to arrays)
 - #62239 (Fix a typo)
 - #62241 (Always parse 'async unsafe fn' + properly ban in 2015)
 - #62248 (before_exec actually will only get deprecated with 1.37)

Failed merges:

r? @ghost
2019-07-01 06:41:48 +00:00
bors 5748825cc8 Auto merge of #61682 - Centril:stabilize-type_alias_enum_variants, r=petrochenkov
Stabilize `type_alias_enum_variants` in Rust 1.37.0

Stabilize `#![feature(type_alias_enum_variants)]` which allows type-relative resolution with highest priority to `enum` variants in both expression and pattern contexts. For example, you may now write:

```rust
enum Option<T> {
    None,
    Some(T),
}

type OptAlias<T> = Option<T>;

fn work_on_alias(x: Option<u8>) -> u8 {
    match x {
        OptAlias::Some(y) => y + 1,
        OptAlias::None => 0,
    }
}
```

Closes https://github.com/rust-lang/rfcs/issues/2218
Closes https://github.com/rust-lang/rust/issues/52118

r? @petrochenkov
2019-07-01 03:11:19 +00:00
Mazdak Farrokhzad de00ae7266 Switch tracking issue for 'slice_patterns'. 2019-06-30 23:23:11 +02:00
Vadim Petrochenkov e4e7eb2d58 Feature gate rustc attributes harder 2019-06-30 13:57:12 +03:00
Vadim Petrochenkov 0ffb6438a6 Make sure #[rustc_doc_only_macro] and other rustc attributes are registered 2019-06-30 12:47:33 +03:00
Mazdak Farrokhzad ce1d95af4c Always parse 'async unsafe fn' + properly ban in 2015. 2019-06-29 21:38:26 +02:00
Mark Rousskov d26c4b7bd6 Inline rust_printer 2019-06-29 09:10:17 -04:00
Mark Rousskov ff27756a1c Remove unused import 2019-06-29 09:10:17 -04:00
Mark Rousskov da5c835c8b 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-06-29 09:10:17 -04:00
Mark Rousskov 1aff8af213 Replace pretty-printer Box<dyn Write> with &mut String 2019-06-29 09:10:15 -04:00
Mark Rousskov 209bde16c5 Delete now-unused methods 2019-06-29 09:09:32 -04:00
Mark Rousskov e2d7df5067 Privatize a bunch of methods 2019-06-29 09:09:31 -04:00
Mazdak Farrokhzad fdf75af730 Rollup merge of #62160 - ia0:question_mark_macro_sep, r=petrochenkov
Remove outdated question_mark_macro_sep lint
2019-06-27 23:01:15 +02:00