| Age | Commit message (Collapse) | Author | Lines |
|
Add the -Zcrate-attr=foo unstable rustc option
This PR adds a new unstable option to `rustc`: `-Zcrate-attr=foo`. The option can be used to inject crate-level attributes from the CLI, and it's meant to be used by tools like Crater that needs to add their own attributes to a crate without changing the source code.
The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable.
cc https://github.com/rust-lang-nursery/crater/issues/282 @Mark-Simulacrum
|
|
Improve a few vectors - calculate capacity or build from iterators
Collecting from iterators improves readability and tailoring vector capacities should be beneficial in terms of performance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The method relied on the FileMap still being under construction in
order for it to do what the name promises. It's now independent of
the current state.
|
|
|
|
|
|
|
|
|
|
These were stabilized in March 2018's #47813, and are the Preferred Way
to Do It going forward (q.v. #51043).
|
|
|
|
Implement edition hygiene for keywords
Determine "keywordness" of an identifier in its hygienic context.
cc https://github.com/rust-lang/rust/pull/49611
I've resurrected `proc` as an Edition-2015-only keyword for testing purposes, but it should probably be buried again. EDIT: `proc` is removed again.
|
|
Rollup of 10 pull requests
Successful merges:
- #50387 (Remove leftover tab in libtest outputs)
- #50553 (Add Option::xor method)
- #50610 (Improve format string errors)
- #50649 (Tweak `nearest_common_ancestor()`.)
- #50790 (Fix grammar documentation wrt Unicode identifiers)
- #50791 (Fix null exclusions in grammar docs)
- #50806 (Add `bless` x.py subcommand for easy ui test replacement)
- #50818 (Speed up `opt_normalize_projection_type`)
- #50837 (Revert #49767)
- #50839 (Make sure people know the book is free oline)
Failed merges:
|
|
|
|
|
|
Improve format string errors
Point at format string position inside the formatting string:
```
error: invalid format string: unmatched `}` found
--> $DIR/format-string-error.rs:21:22
|
LL | let _ = format!("}");
| ^ unmatched `}` in format string
```
Explain that argument names can't start with an underscore:
```
error: invalid format string: invalid argument name `_foo`
--> $DIR/format-string-error.rs:15:23
|
LL | let _ = format!("{_foo}", _foo = 6usize);
| ^^^^ invalid argument name in format string
|
= note: argument names cannot start with an underscore
```
Fix #23476.
The more accurate spans will only be seen when using `format!` directly, when using `println!` the diagnostics machinery makes the span be the entire statement.
|
|
It only has a single use, within code handling indented block comments.
We can replace that with the new `FileMap::col_pos()`, which computes
the col position (BytePos instead of CharPos) based on the record of the
last newline char (which we already record).
This is actually an improvement, because
`trim_whitespace_prefix_and_push_line()` was using `col`, which is a
`CharPos`, as a slice index, which is a byte/char confusion.
|
|
Because `bump()` is hot.
|
|
- Point at format string position inside the formatting string
- Explain that argument names can't start with an underscore
|
|
|
|
Because they are (a) trivial, and (b) super hot.
This change speeds up most rustc-benchmarks, the best by 5%.
|
|
|
|
... and reimplement proc_macro::Span::parent using it. This function turns out
to be useful in the compiler as well
|
|
This permits easier iteration without having to worry about warnings
being denied.
Fixes #49517
|
|
Bump the bootstrap compiler to 1.26.0 beta
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
|
|
|
|
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
|
|
|
|
Misc changes from my parallel rustc branch
r? @michaelwoerister
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fixes #47311.
r? @nrc
|
|
Remove experimental -Zremap-path-prefix-from/to, and replace it with
the stabilized --remap-path-prefix=from=to variant.
This is an implementation for issue of #41555.
|
|
|
|
|
|
spans involving macro context Sometimes the parser attempts to synthesize spans from within a macro context with the span for the captured argument, leading to non-sensical spans with very bad output. Given that an incorrect span is worse than a partially incomplete span, when detecting this situation return only one of the spans without merging them. Fix #32072, #47778. CC #23480.
|
|
Sometimes the parser attempts to synthesize spans from within a macro
context with the span for the captured argument, leading to non-sensical
spans with very bad output. Given that an incorrect span is worse than
a partially incomplete span, when detecting this situation return only
one of the spans without mergin them.
|
|
|
|
|
|
|
|
|