| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
introduce ::Let.
|
|
|
|
|
|
|
|
|
|
Add unit tests for unescaping raw (byte) strings
Adds unit tests for functionality introduced in #60793.
r? @matklad @petrochenkov
|
|
|
|
rustc: disallow cloning HIR nodes.
Besides being inefficient, cloning also risks creating broken HIR (without properly recreating all the IDs and whatnot, in which case you might as well reconstruct the entire node without ever `Clone`-ing anything).
We detect *some* detrimental situations (based on the occurrence of `HirId`s, I believe?), but it's better to statically disallow it, IMO.
One of the examples that is fixed by this PR is `tcx.hir().fn_decl{,_by_hir_id}`, which was cloning an entire `hir::FnDecl` *every single time it was called*.
r? @petrochenkov cc @rust-lang/compiler
|
|
|
|
Support `cfg` and `cfg_attr` on generic parameters
`cfg` attributes are supported in all other positions where attributes are accepted at all.
They were previously prohibited in https://github.com/rust-lang/rust/pull/51283 because they weren't implemented correctly before that and were simply ignored.
|
|
Improve the explicit_outlives_requirements lint
* Don't use Strings to compare parameters
* Extend the lint to lifetime bounds
* Extend the lint to enums and unions
* Use the correct span for where clauses in tuple structs
* Try to early-out where possible
* Remove unnecessary bounds in rustc crates
|
|
|
|
syntax: Factor out common fields from `SyntaxExtension` variants
And some other related cleanups.
Continuation of https://github.com/rust-lang/rust/pull/61606.
This will also help to unblock https://github.com/rust-lang/rust/pull/61877.
|
|
Also give them a span in the HIR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is an extremely marginal error, so the cost of properly threading
`Handler` everywhere just not seemed justified. However, it's useful
to panic when we create a file, and not when we slice strings with
overflown indexes somewhere in the guts of the compiler.
For this reason, while we provide safe `try_new_source_file`, we don't
change the existing public interface and just panic more or less
cleanly.
|
|
Stabilize underscore_const_names in 1.37.0
You are now permitted to write:
```rust
const _: $type_expression = $term_expression;
```
That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from:
```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
| ...
| Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" }
| ...
;
```
into:
```java
Item = attrs:OuterAttr* vis:Vis? kind:ItemKind;
ItemKind =
| ...
| Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" }
| ...
;
IdentOrUnderscore =
| Named:IDENT
| NoName:"_"
;
```
r? @petrochenkov
|
|
create a "provisional cache" to restore performance in the case of cycles
Introduce a "provisional cache" that caches the results of auto trait resolutions but keeps them from entering the *main* cache until everything is ready. This turned out a bit more complex than I hoped, but I don't see another short term fix -- happy to take suggestions! In the meantime, it's very clear we need to rework the trait solver. This resolves the extreme performance slowdown experienced in #60846 -- I plan to add a perf.rust-lang.org regression test to track this.
Caveat: I've not run `x.py test` in full yet.
r? @pnkfelix
cc @arielb1
Fixes #60846
|
|
Cleanup some new active feature gates
r? @alexreg
|
|
Remove redundant `clone()`s
|
|
|
|
|
|
Change `...` to `..=` where applicable
This is mainly to fix #61816, but I decided to manually check a few thousand `...` throughout the code base to check for any other cases. I think I found a documentation bug in `src\libsyntax\ast.rs` where both `1..` and `1...` where mentioned. If there is internal support for both `1..` and `1..=` (that can exist before error handling gets to it), then I can add that back.
There were some other cases that look like `// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {`, `// <P0 as Trait<P1...Pn>>::Foo: 'a`, and `assert!(min <= max, "discriminant range is {}...{}", min, max);`, but I am not sure if I should change those.
There are a bunch of cases in the `/test/` directory that could be changed, but I presume I should just leave those be.
|
|
r=petrochenkov
Remove some unnecessary symbol interner ops
* Don't gensym symbols that don't need to worry about colliding with other symbols
* Use symbol constants instead of interning string literals in a few places.
* Don't generate a module in `__register_diagnostic`
r? @petrochenkov
|
|
|
|
|
|
|
|
based on https://github.com/rust-lang/rust/pull/61754#issuecomment-501743750 I am adding `bootstrap` to the cfg-preconditions for the two manual `unsafe impls`'s of `Send` and `Sync` for `TokenTree`.
|
|
|
|
Special-case literals in `parse_bottom_expr`.
This makes parsing faster, particularly for code with large constants,
for two reasons:
- it skips all the keyword comparisons for literals;
- it skips the allocation done by the `mk_expr` call in
`parse_literal_maybe_minus`.
r? @petrochenkov
|
|
Allow attributes in formal function parameters
Implements https://github.com/rust-lang/rust/issues/60406.
This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made.
**TODO**
- [x] Forbid some built-in attributes.
- [x] Expand cfg/cfg_attr
|
|
r=oli-obk,Centril
use pattern matching for slices destructuring
refs #61542
Use slices pattern where it seems to make sense .
|
|
Rollup of 11 pull requests
Successful merges:
- #61518 (Add loops to doc list of things not stable in const fn)
- #61526 (move some tests into subfolders)
- #61550 (Windows 10 SDK is also required now.)
- #61606 (Remove some legacy proc macro flavors)
- #61652 (Mention slice patterns in array)
- #61686 (librustc_errors: Add some more documentation)
- #61698 (typeck: Fix const generic in repeat param ICE.)
- #61707 (Azure: retry failed awscli installs)
- #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone)
- #61724 (core: use memcmp optimization for 128 bit integer slices)
- #61726 (Use `for_each` in `Iterator::partition`)
Failed merges:
r? @ghost
|
|
Add deny(unused_lifetimes) to all the crates that have deny(internal).
@Zoxc brought up, regarding #61722, that we don't force the removal of unused lifetimes.
Turns out that it's not that bad to enable for compiler crates (I wonder why it's not `warn` by default?).
I would've liked to enable `single_use_lifetimes` as well, but https://github.com/rust-lang/rust/issues/53738 makes it unusable for now.
For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise.
r? @oli-obk cc @rust-lang/compiler
|
|
Remove some legacy proc macro flavors
Namely
- `IdentTT` (`foo! ident { ... }`). Can be replaced with `foo! { ident ... }` or something similar.
- `MultiDecorator`. Can be replaced by `MultiModifier` (aka `LegacyAttr` after renaming).
- `DeclMacro`. It was a less powerful duplicate of `NormalTT` (aka `LegacyBang` after renaming) and can be replaced by it.
Stuff like this slows down any attempts to refactor the expansion infra, so it's desirable to retire it already.
I'm not sure whether a lang team decision is necessary, but would be nice to land this sooner because I have some further work in this area scheduled.
The documentation commit (https://github.com/rust-lang/rust/commit/a9397fd0d5eede4bbc0ada94bf92657ca8084cb3) describes how the remaining variants are different from each other and shows that there's actually some system behind them.
The last commit renames variants of `SyntaxExtension` in more systematic way.
- `ProcMacro` -> `Bang`
- `NormalTT` -> `LegacyBang`
- `AttrProcMacro` -> `Attr`
- `MultiModifier` -> `LegacyAttr`
- `ProcMacroDerive` -> `Derive`
- `BuiltinDerive` -> `LegacyDerive`
All the `Legacy*` variants are AST-based, as opposed to "modern" token-based variants.
|
|
|
|
Implement RFC 2645 (transparent enums and unions)
Tracking issue: #60405
|
|
Tracking issue: #60405
|
|
lexer: Disallow bare CR in raw byte strings
Handles bare CR ~but doesn't translate `\r\n` to `\n` yet in raw strings yet~ and translates CRLF to LF in raw strings.
As a side-note I think it'd be good to change the `unescape_` to return plain iterators to reduce some boilerplate (e.g. `has_error` could benefit from collecting `Result<T>` and aborting early on errors) but will do that separately, unless I missed something here that prevents it.
@matklad @petrochenkov thoughts?
|
|
|
|
|
|
It's a less powerful duplicate of `SyntaxExtension::NormalTT`
|