| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
Move SmallVector and ThinVec out of libsyntax
- move `libsyntax::util::SmallVector` tests to `librustc_data_structures::small_vec`
- remove `libsyntax::util::SmallVector`
- move `libsyntax::util::thin_vec` to `librustc_data_structures::thin_vec`
Other than moving these data structures where they belong it allows modules using `SmallVector<T>` (`SmallVec<[T; 1]>`) to specify their own length (e.g. 8 or 32) independently from `libsyntax`.
|
|
|
|
|
|
|
|
|
|
|
|
Fix a few regressions from enabling macro modularization
The first commit restores the old behavior for some minor unstable stuff (`rustc_*` and `derive_*` attributes) and adds a new feature gate for arbitrary tokens in non-macro attributes.
The second commit fixes https://github.com/rust-lang/rust/issues/53205
The third commit fixes https://github.com/rust-lang/rust/issues/53144.
Same technique is used as for other things blocking expansion progress - if something causes indeterminacy too often, then prohibit it.
In this case referring to crate-local macro-expanded `#[macro_export]` macros via module-relative paths is prohibited, see comments in code for more details.
cc https://github.com/rust-lang/rust/pull/50911
|
|
|
|
|
|
r=petrochenkov
Emit error for pattern arguments in trait methods
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
This improves the error message described in https://github.com/rust-lang/rust/issues/53046.
r? @petrochenkov
|
|
[nll] enable feature(nll) on various crates for bootstrap: part 4
#53172
r? @nikomatsakis
|
|
Don't collect() when size_hint is useless
This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.
It is a performance win.
|
|
|
|
|
|
|
|
|
|
|
|
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
|
|
Feature gate `rustc_` and `derive_` with their own gates again instead of `custom_attribute`
|
|
Suggest comma when missing in macro call
When missing a comma in a macro call, suggest it, regardless of
position. When a macro call doesn't match any of the patterns, check
if the call's token stream could be missing a comma between two idents,
and if so, create a new token stream containing the comma and try to
match against the macro patterns. If successful, emit the suggestion.
This works on arbitrary macros, with no need of special support from
the macro writers.
```
error: no rules expected the token `d`
--> $DIR/missing-comma.rs:26:18
|
LL | foo!(a, b, c d, e);
| -^
| |
| help: missing comma here
```
Follow up to #52397.
|
|
Whitelist wasm32 simd128 target feature
r? @alexcrichton
|
|
|
|
Avoid unnecessary pattern matching against Option and Result
|
|
resolve: Support custom attributes when macro modularization is enabled
Basically, if resolution of a single-segment attribute is a determined error, then we interpret it as a custom attribute.
Since custom attributes are integrated into general macro resolution, `feature(custom_attribute)` now requires and implicitly enables macro modularization (`feature(use_extern_macros)`).
Actually, a few other "advanced" macro features now implicitly enable macro modularization too (and one bug was found and fixed in process of enabling it).
The first two commits are preliminary cleanups/refactorings.
|
|
When missing a comma in a macro call, suggest it, regardless of
position. When a macro call doesn't match any of the patterns, check
if the call's token stream could be missing a comma between two idents,
and if so, create a new token stream containing the comma and try to
match against the macro patterns. If successful, emit the suggestion.
|
|
|
|
Suggest comma when writing `println!("{}" a);`
Fix #49370.
|
|
Place unions, pointer casts and pointer derefs behind extra feature gates
To ensure we don't stabilize these things together with const fn stabilization (or any other stabilization)
This PR moves union field accesses inside `const fn` behind a feature gate. It was possible without a feature gate before, but since `const fn` was behind a feature gate we can do this change.
While "dereferencing raw pointers" and "casting raw pointers to usize" were hard errors before this PR, one could work around them by abusing unions:
```rust
// deref
union Foo<T> {
x: &'static T,
y: *const T,
}
const FOO: u32 = unsafe { *Foo { y: 42 as *const T }.x };
// as usize cast
union Bar<T> {
x: usize,
y: *const T,
}
const BAR: usize = unsafe { Bar { y: &1u8 }.x };
```
r? @eddyb
cc @nikomatsakis
|
|
|
|
|
|
r=Mark-Simulacrum
Rust 2018: Disable catch_expr, not targeted for 2018 edition
Fixes #52604
|
|
Enable macros to pass $:literal to another macro
Fixes #52169.
|
|
|
|
|
|
|
|
Extract impl_header_lifetime_elision out of in_band_lifetimes
This way we can experiment with `impl Debug for &MyType` separately from `impl Debug for &'a MyType`.
I can't say I know what the code in here is doing, so please let me know if there's a better way :slightly_smiling_face:
I marked this as enabled in 2018 so that edition code continues to work without another flag.
Actual feature PR https://github.com/rust-lang/rust/pull/49251; Tracking Issue https://github.com/rust-lang/rust/issues/15872; In-band lifetimes tracking issue https://github.com/rust-lang/rust/issues/44524.
cc @aturon, per discussion on discord earlier
cc @cramertj & @nikomatsakis, who actually wrote these features
|
|
Fixes #52604
|
|
Adjust a few fulldeps and pretty-printing tests
Fix rebase
|
|
is enabled
Do not mark all builtin attributes as used when macro modularization is enabled
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|