about summary refs log tree commit diff
path: root/compiler/rustc_ast/src
AgeCommit message (Collapse)AuthorLines
2022-04-29Rename `visit_interpolated` as `visit_nonterminal`.Nicholas Nethercote-2/+2
Because `Nonterminal` is the type it visits.
2022-04-28rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`Vadim Petrochenkov-38/+45
2022-04-27Avoid producing `NoDelim` values in `MacArgs::delim()`.Nicholas Nethercote-3/+3
2022-04-25Auto merge of #96246 - SparrowLii:bound_contxet, r=compiler-errorsbors-12/+34
Add `BoundKind` in `visit_param_bounds` to check questions in bounds From the FIXME in the impl of `AstValidator`. Better bound checks by adding `BoundCtxt` type parameter to `visit_param_bound` cc `@ecstatic-morse`
2022-04-21Auto merge of #96210 - nnethercote:speed-up-TokenCursor, r=petrochenkovbors-15/+12
Speed up `TokenCursor` Plus a few related clean-ups. r? `@petrochenkov`
2022-04-21Introduced `Cursor::next_with_spacing_ref`.Nicholas Nethercote-0/+8
This lets us clone just the parts within a `TokenTree` that need cloning, rather than the entire thing. This is a surprisingly large performance win, up to 4% on `async-std-1.10.0`.
2022-04-21rename to `BoundKind` and add commentsSparrowLii-14/+26
2022-04-20Add `BoundCtxt` in `visit_param_bounds` to check questions in boundsSparrowLii-12/+22
2022-04-20Inline `Cursor::next_with_spacing`.Nicholas Nethercote-0/+1
2022-04-19rustc_metadata: Store a flag telling whether an item may have doc links in ↵Vadim Petrochenkov-0/+13
its attributes This should be cheap on rustc side, but it's significant optimization for rustdoc that won't need to decode and process attributes unnecessarily
2022-04-19Inline and remove `TokenTree::{open_tt,close_tt}`.Nicholas Nethercote-10/+0
They both have a single call site.
2022-04-19Tweak `Cursor::next_with_spacing`.Nicholas Nethercote-5/+3
This makes it more like `CursorRef::next_with_spacing`. There is no performance effect, just a consistency improvement.
2022-04-17Auto merge of #95779 - cjgillot:ast-lifetimes-undeclared, r=petrochenkovbors-10/+9
Report undeclared lifetimes during late resolution. First step in https://github.com/rust-lang/rust/pull/91557 We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes. r? `@petrochenkov`
2022-04-17Auto merge of #96016 - Aaron1011:hash-name-cleanup, r=cjgillotbors-2/+2
Remove last vestiges of skippng ident span hashing This removes a comment that no longer applies, and properly hashes the full ident for path segments.
2022-04-17Visit generics inside visit_fn.Camille GILLOT-10/+9
2022-04-16Auto merge of #94468 - Amanieu:global_asm_sym, r=nagisabors-10/+54
Implement sym operands for global_asm! Tracking issue: #93333 This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are: - At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`. - At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails). - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`. - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to. - The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression. - At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details. - On Mach-O, all symbols have a leading underscore. - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall. - No mangling is needed on other platforms. r? `@nagisa` cc `@eddyb`
2022-04-15Rollup merge of #94461 - jhpratt:2024-edition, r=pnkfelixDylan DPC-1/+1
Create (unstable) 2024 edition [On Zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Deprecating.20macro.20scoping.20shenanigans/near/272860652), there was a small aside regarding creating the 2024 edition now as opposed to later. There was a reasonable amount of support and no stated opposition. This change creates the 2024 edition in the compiler and creates a prelude for the 2024 edition. There is no current difference between the 2021 and 2024 editions. Cargo and other tools will need to be updated separately, as it's not in the same repository. This change permits the vast majority of work towards the next edition to proceed _now_ instead of waiting until 2024. For sanity purposes, I've merged the "hello" UI tests into a single file with multiple revisions. Otherwise we'd end up with a file per edition, despite them being essentially identical. ````@rustbot```` label +T-lang +S-waiting-on-review Not sure on the relevant team, to be honest.
2022-04-14Reimplement lowering of sym operands for asm! so that it also works with ↵Amanieu d'Antras-10/+54
global_asm!
2022-04-13Remove last vestiges of skippng ident span hashingAaron Hill-2/+2
This removes a comment that no longer applies, and properly hashes the full ident for path segments.
2022-04-11Use const Box::default in P::<[T]>::newJosh Stone-8/+3
2022-04-10better error for binder on associated type boundMichael Goulet-1/+1
2022-04-08Fix invalid array access in `beautify_doc_string`Guillaume Gomez-1/+4
2022-04-07Shrink `Nonterminal`.Nicholas Nethercote-6/+8
By heap allocating the argument within `NtPath`, `NtVis`, and `NtStmt`. This slightly reduces cumulative and peak allocation amounts, most notably on `deep-vector`.
2022-04-02Create 2024 editionJacob Pratt-1/+1
2022-03-31Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errorsDylan DPC-1/+1
Spellchecking compiler comments This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-31Rollup merge of #95251 - GrishaVar:hashes-u16-to-u8, r=dtolnayDylan DPC-3/+3
Reduce max hash in raw strings from u16 to u8 [Relevant discussion](https://rust-lang.zulipchat.com/#narrow/stream/237824-t-lang.2Fdoc/topic/Max.20raw.20string.20delimiters)
2022-03-30Spellchecking compiler commentsYuri Astrakhan-1/+1
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-28Remove `Nonterminal::NtTT`.Nicholas Nethercote-9/+1
It's only needed for macro expansion, not as a general element in the AST. This commit removes it, adds `NtOrTt` for the parser and macro expansion cases, and renames the variants in `NamedMatch` to better match the new type.
2022-03-23Update syntax tree definitionGrisha Vartanyan-3/+3
2022-03-15Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuberbors-6/+23
More robust fallback for `use` suggestion Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion. But this was fragile, as illustrated in issue #87613 This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion. Fix #87613
2022-03-09Implement macro meta-variable expressionsCaio-1/+1
2022-03-05IgnoreJack Huey-2/+2
2022-03-05Add commment covering the case with no where clauseJack Huey-0/+2
2022-03-05Review changesJack Huey-0/+12
2022-03-05Change syntax for TyAlias where clausesJack Huey-6/+41
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-4/+7
then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-03-03Associate multiple with a crate too.Felix S. Klock II-4/+5
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-2/+15
2022-02-262 - Make more use of let_chainsCaio-59/+53
Continuation of #94376. cc #53667
2022-02-24Rollup merge of #94316 - nnethercote:improve-string-literal-unescaping, ↵Dylan DPC-17/+23
r=petrochenkov Improve string literal unescaping Some easy wins that affect a few popular crates. r? ```@matklad```
2022-02-24Rollup merge of #94288 - Mark-Simulacrum:ser-opt, r=nnethercoteMatthias Krüger-2/+1
Cleanup a few Decoder methods This is just some simple follow up to #93839. r? `@nnethercote`
2022-02-24Inline a hot closure in `from_lit_token`.Nicholas Nethercote-17/+23
The change looks big because `rustfmt` rearranges things, but the only real change is the inlining annotation.
2022-02-23Rollup merge of #94128 - mqy:master, r=Dylan-DPCMatthias Krüger-1/+1
rustdoc: several minor fixes ``@rustbot`` label A-docs
2022-02-22Delete Decoder::read_unitMark Rousskov-2/+1
2022-02-19rustdoc: several minor fixesmqy-1/+1
2022-02-18Rollup merge of #93634 - matthiaskrgr:clippy_complexity_jan_2022, r=oli-obkMatthias Krüger-1/+1
compiler: clippy::complexity fixes useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-15Auto merge of #93752 - eholk:drop-tracking-break-continue, r=nikomatsakisbors-1/+1
Generator drop tracking: improve break and continue handling This PR fixes two related issues. One, sometimes break or continue have a block target instead of an expression target. This seems to mainly happen with try blocks. Since the drop tracking analysis only works on expressions, if we see a block target for break or continue, we substitute the last expression of the block as the target instead. Two, break and continue were incorrectly being treated as the same, so continue would also show up as an exit from the loop or block. This patch corrects the way continue is handled by keeping a stack of loop entry points and uses those to find the target of the continue. Fixes #93197 r? `@nikomatsakis`
2022-02-07Drop tracking: improve break and continue handlingEric Holk-1/+1
This commit fixes two issues. One, sometimes break or continue have a block target instead of an expression target. This seems to mainly happen with try blocks. Since the drop tracking analysis only works on expressions, if we see a block target for break or continue, we substitute the last expression of the block as the target instead. Two, break and continue were incorrectly being treated as the same, so continue would also show up as an exit from the loop or block. This patch corrects the way continue is handled by keeping a stack of loop entry points and uses those to find the target of the continue.
2022-02-07Add test for block doc comments horizontal trimGuillaume Gomez-14/+6
2022-02-07Fix horizontal trim for block doc commentsGuillaume Gomez-6/+38