about summary refs log tree commit diff
path: root/compiler/rustc_macros
AgeCommit message (Collapse)AuthorLines
2025-09-02Revert introduction of `[workspace.dependencies]`.Nicholas Nethercote-2/+2
This was done in #145740 and #145947. It is causing problems for people using r-a on anything that uses the rustc-dev rustup package, e.g. Miri, clippy. This repository has lots of submodules and subtrees and various different projects are carved out of pieces of it. It seems like `[workspace.dependencies]` will just be more trouble than it's worth.
2025-08-28Add `proc-macro2` and `quote` to `[workspace.dependencies]`.Nicholas Nethercote-2/+2
2025-08-16remove `should_render` in `PrintAttribute` deriveDeadbeef-40/+20
2025-08-14cleanup: Remove useless `[T].iter().last()`Esteban Küber-1/+1
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+1
2025-07-22Implement AST visitors using a derive macro.Camille GILLOT-0/+93
2025-07-06Fix line break after ":" in unpretty attribute printJonathan Brouwer-1/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-3/+3
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-3/+3
2025-07-01Remove doc comments from TyCtxtFeedMichael Goulet-1/+0
2025-06-28Use tidy to sort `sym::*` itemsYotam Ofek-27/+0
2025-06-26Only args in main diag are saved and restored without removing the newly ↵xizheyin-11/+5
added ones Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-25Add runtime check to avoid overwrite arg easily in diag and store and ↵xizheyin-5/+25
restore snapshot when set subdiag arg Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-08Remove all unused feature gates from the compilerbjorn3-1/+0
2025-05-20Allow trailing comma after argument in query definitionMichael Goulet-0/+1
2025-05-17Enable rust-analyzer to go from query definition to the corresponding ↵Lukas Wirth-0/+14
provider field
2025-05-13Auto merge of #140887 - pietroalbini:pa-bootstrap-update, r=compiler-errorsbors-1/+0
Stage0 bootstrap update This PR [follows the release process](https://forge.rust-lang.org/release/process.html#master-bootstrap-update-tuesday) to update the stage0 compiler. The only thing of note is https://github.com/rust-lang/rust/commit/58651d1b316e268fac2100c3ae37bb502a36b8ba, which was flagged by clippy as a correctness fix. I think allowing that lint in our case makes sense, but it's worth to have a second pair of eyes on it. r? `@Mark-Simulacrum`
2025-05-12Fix typosomahs-1/+1
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-04-29Rename `rustc_query_append!` to `rustc_with_all_queries!`Zalathar-3/+15
2025-04-25Rollup merge of #140202 - est31:let_chains_feature_compiler, r=lcnrMatthias Krüger-1/+1
Make #![feature(let_chains)] bootstrap conditional in compiler/ Let chains have been stabilized recently in #132833, so we can remove the gating from our uses in the compiler (as the compiler uses edition 2024).
2025-04-23Make #![feature(let_chains)] bootstrap conditional in compiler/est31-1/+1
2025-04-23Remove `synstructure::Structure::underscore_const` calls.Nicholas Nethercote-24/+4
The `synstructure` docs say "This method is a no-op, underscore consts are used by default now." The behaviour change occurred going from `synstructure` version 0.13.0 to 0.13.1.
2025-04-16Move eager translation to a method on `Diag`Jake Goulding-11/+4
This will allow us to eagerly translate messages on a top-level diagnostic, such as a `LintDiagnostic`. As a bonus, we can remove the awkward closure passed into Subdiagnostic and make better use of `Into`.
2025-04-15Split TypeFolder and FallibleTypeFolderMichael Goulet-17/+43
2025-04-10Allow drivers to supply a list of extra symbols to internAlex Macleod-9/+16
2025-03-15Move codec module back into middleMichael Goulet-18/+8
2025-03-15Use {Decodable,Encodable}_NoContext in type_irMichael Goulet-8/+8
2025-03-15Fold visit into tyMichael Goulet-6/+6
2025-03-15Squash fold into tyMichael Goulet-3/+3
2025-03-12Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, ↵Matthias Krüger-1/+0
r=onur-ozkan,jieyouxu Use `RUSTC_LINT_FLAGS` more An alternative to the failed #138084. Fixes #138106. r? ````@jieyouxu````
2025-03-11Rollup merge of #138063 - compiler-errors:improve-attr-unpretty, r=jdonszelmannJakub Beránek-11/+16
Improve `-Zunpretty=hir` for parsed attrs 0. Rename `print_something` to `should_render` to make it distinct from `print_attribute` in that it doesn't print anything, it's just a way to probe if a type renders anything. 1. Fixes a few bugs in the `PrintAttribute` derive. Namely, the `__printed_anything` variable was entangled with the `should_render` call, leading us to always render field names but never render commas. 2. Remove the outermost `""` from the attr. 3. Debug print `Symbol`s. I know that this is redundant for some parsed attributes, but there's no good way to distinguish symbols that are ident-like and symbols which are cooked string literals. We could perhaps *conditionally* to fall back to a debug printing if the symbol doesn't match an ident? But seems like overkill. Based on #138060, only review the commits not in that one.
2025-03-11Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
It's no longer necessary now that `-Wunreachable_pub` is being passed.
2025-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-3/+1
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-10Fix pretty printing of parsed attrs in hir_prettyMichael Goulet-8/+13
2025-03-10Rename print_something to should_renderMichael Goulet-5/+5
2025-03-08Remove `#![warn(unreachable_pub)]` from all `compiler/` crates.Nicholas Nethercote-1/+0
(Except for `rustc_codegen_cranelift`.) It's no longer necessary now that `unreachable_pub` is in the workspace lints.
2025-03-08Specify rust lints for `compiler/` crates via Cargo.Nicholas Nethercote-0/+3
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
2025-02-24pretty print hir attributesJana Dönszelmann-0/+154
2025-02-22Fix binding mode problemsMichael Goulet-2/+2
2025-02-22Upgrade the compiler to edition 2024Michael Goulet-1/+1
2025-02-19Make fewer crates depend on rustc_ast_irMichael Goulet-3/+3
2025-02-08Rustfmtbjorn3-18/+24
2025-02-01Rename `ensure_forwards_result_if_red` to `return_result_from_ensure_ok`Zalathar-10/+16
2025-01-07Avoid naming variables `str`Josh Triplett-8/+8
This renames variables named `str` to other names, to make sure `str` always refers to a type. It's confusing to read code where `str` (or another standard type name) is used as an identifier. It also produces misleading syntax highlighting.
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-10-27give a better error for tuple structs in `derive(Diagnostic)`jyn-3/+6
2024-10-27Use LLVM-C APIs for getting/setting visibilityZalathar-0/+2
2024-10-26Add a macro that derives `TryFrom<u32>` for fieldless enumsZalathar-0/+63
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-53/+44