about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-06-15Refactor `rustc_attr_data_structures` documentationxizheyin-14/+48
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-13Auto merge of #142353 - workingjubilee:warn-less-about-cdecl-and-other-abis, ↵bors-1/+1
r=ChrisDenton,RalfJung compiler: Ease off the accelerator on `unsupported_calling_conventions` This is to give us more time to discuss rust-lang/rust#142330 without the ecosystem having an anxiety attack. I have withdrawn `unsupported_calling_conventions` from report-in-deps I believe we should consider this a simple suspension of the decision in rust-lang/rust#141435 to start this process, rather than a reversal. That is, we may continue with linting again. But I believe we are about to get a... reasonable amount of feedback just from currently available information and should allow ourselves time to process it.
2025-06-12Auto merge of #142438 - matthiaskrgr:rollup-u1jdnhz, r=matthiaskrgrbors-39/+218
Rollup of 9 pull requests Successful merges: - rust-lang/rust#134536 (Lint on fn pointers comparisons in external macros) - rust-lang/rust#141069 (Suggest mut when possbile for temporary value dropped while borrowed) - rust-lang/rust#141934 (resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes) - rust-lang/rust#142034 (Detect method not being present that is present in other tuple types) - rust-lang/rust#142402 (chore(doctest): Remove redundant blank lines) - rust-lang/rust#142406 (Note when enum variants shadow an associated function) - rust-lang/rust#142407 (Remove bootstrap adhoc group) - rust-lang/rust#142408 (Add myself (WaffleLapkin) to review rotation) - rust-lang/rust#142418 (Remove lower_arg_ty as all callers were passing `None`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-12Rollup merge of #142418 - oli-obk:lower_arg_ty, r=BoxyUwU,fmeaseMatthias Krüger-12/+2
Remove lower_arg_ty as all callers were passing `None` r? ``@fmease`` or ``@BoxyUwU`` I think this is just leftover from other refactorings
2025-06-12Rollup merge of #142406 - jdonszelmann:dead-code-enum-variant, r=WaffleLapkinMatthias Krüger-1/+44
Note when enum variants shadow an associated function r? ``@WaffleLapkin`` Closes rust-lang/rust#142263
2025-06-12Rollup merge of #142034 - estebank:issue-141258, r=davidtwcoMatthias Krüger-2/+121
Detect method not being present that is present in other tuple types When a method is not present because of a trait bound not being met, and that trait bound is on a tuple, we check if making the tuple have no borrowed types makes the method to be found and highlight it if it does. This is a common problem for Bevy in particular and ORMs in general. <img width="1166" alt="Screenshot 2025-06-04 at 10 38 24 AM" src="https://github.com/user-attachments/assets/d257c9ea-c2d7-42e7-8473-8b93aa54b8e0" /> Address rust-lang/rust#141258. I believe that more combination of cases in the tuple types should be handled (like adding borrows and checking when a specific type needs to not be a borrow while the rest stay the same), but for now this handles the most common case.
2025-06-12Rollup merge of #141934 - petrochenkov:privmacuse, r=compiler-errorsMatthias Krüger-22/+36
resolve: Tweak `private_macro_use` lint to be compatible with upcoming macro prelude changes Unblocks https://github.com/rust-lang/rust/pull/139493. Zulip thread requesting help - [#t-compiler/help > Help requested for effects of #139493](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Help.20requested.20for.20effects.20of.20.23139493/with/514653911). This PR by itself shouldn't cause any observable changes, its only observable effect is that the prelude changes from https://github.com/rust-lang/rust/pull/139493 will no longer cause regressions in tests like `tests/ui/imports/issue-119369.rs` or `tests/ui/extern/issue-80074.rs`. This is achieved by moving the "is this thing in stdlib prelude" check from an early point (`fn process_macro_use_imports`) to a later point (`fn record_use_inner`), at which the stdlib prelude is already populated and can be inspected. (The `is_builtin_macro` check is subsumed by the stdlib prelude check, all built-in macros go through the stdlib prelude anyway.)
2025-06-12Rollup merge of #141069 - chenyukang:yukang-fix-137486-suggest-mut, r=davidtwcoMatthias Krüger-1/+13
Suggest mut when possbile for temporary value dropped while borrowed Fixes #137486
2025-06-12Rollup merge of #134536 - Urgau:fn-ptr-option, r=compiler-errors,traviscrossMatthias Krüger-1/+2
Lint on fn pointers comparisons in external macros This PR extends the recently stabilized `unpredictable_function_pointer_comparisons` lint ~~to also lint on `Option<{function pointer}>` and~~ as well as linting in external macros (as to catch `assert_eq!` and others). ```rust assert_eq!(Some::<FnPtr>(func), Some(func as unsafe extern "C" fn())); //~^ WARN function pointer comparisons #[derive(PartialEq, Eq)] struct A { f: fn(), //~^ WARN function pointer comparisons } ``` Fixes https://github.com/rust-lang/rust/issues/134527
2025-06-12Auto merge of #138164 - jdonszelmann:attr-parsing-lint-infra, r=oli-obkbors-226/+725
Infrastructure for lints during attribute parsing, specifically duplicate usages of attributes r? `@oli-obk` This PR adds a new field to OwnerInfo to buffer lints which are generated during attribute parsing and ast lowering in general. They can't be emitted at this stage because at that point there's no HIR yet, and early lints are already emitted. This also adds the generic `S: Stage` to attribute parsers. Currently we don't emit any lints during early attribute parsing, but if we ever want to that logic will be different. That's because there we don't have hir ids yet, while at the same time still having access to node ids and early lints. Even though that logic isn't completely there in this PR (no worries, we don't use it), that's why the parameter is there. With this PR, we also add 2 associated consts to `SingleAttributeParser`. Those determine what logic should be applied when finding a duplicate attribute. This PR was getting pretty large, so the first code using this logic is in rust-lang/rust#138165. This code is all new things that weren't possible before so it also doesn't break any behaviour. However, some of it will be dead code right now. I recommend reviewing both before merging, though in some sense that doubles the size of the review again, and the other PR might be more controversial. Let me know how you want to do this `@oli-obk`
2025-06-12Remove lower_arg_ty as all callers were passing `None`Oli Scherer-12/+2
2025-06-12Auto merge of #142127 - compiler-errors:nested-goals-certainty, r=lcnrbors-44/+65
Apply nested goals certainty to `InspectGoals` for normalizes-to ...so that normalizes-to goals don't have `Certainty::Yes` even if they have nested goals which don't hold. r? lcnr
2025-06-12detect when variants have the same name as an associated functionJana Dönszelmann-1/+44
2025-06-12remove 'static in some placesJana Dönszelmann-13/+13
2025-06-12add error message for unused duplicateJana Dönszelmann-4/+2
2025-06-12introduce new lint infraJana Dönszelmann-227/+662
lint on duplicates during attribute parsing To do this we stuff them in the diagnostic context to be emitted after hir is constructed
2025-06-12Start using new diagnostic logic on all existing `single` parsersJonathan Dönszelmann-43/+14
2025-06-12introduce duplicate attribute diagnostic logicJana Dönszelmann-17/+112
2025-06-12Report the `unpredictable_function_pointer_comparisons` lint in macroUrgau-1/+2
2025-06-12Rollup merge of #142352 - workingjubilee:c-int-width-is-an-integer, ↵Matthias Krüger-26/+24
r=wesleywiser compiler: Make `c_int_width` an integer Because it is. That's all I got.
2025-06-12Rollup merge of #142318 - Urgau:cleanup-rust-src-remap, r=jieyouxuMatthias Krüger-28/+1
Cleanup `rust-src` remapping and real dir When remapping, `bootstrap` sets `CFG_VIRTUAL_RUST_SOURCE_BASE_DIR` to indicate what the base build dir (`/` of this repo) was remapped to, ie. `/rustc/...`. It is therefore impossible when stripping `/rustc/...` from a remapped path to be inside the our `library/` directory, nevertheless we have code that assumed it was possible and helpfully tried to correct it. I don't why this was done, but it's not necessary. ~~The normalization in compiletest of `$SRC_DIR_REAL` was also slightly wrong, it ate the `library` part for no reason.~~ EDIT: there is a reason, it affects too much tests otherwise r? `@jieyouxu`
2025-06-12Rollup merge of #142261 - folkertdev:unstable-attr-correct-edition, ↵Matthias Krüger-1/+6
r=compiler-errors use correct edition when warning for unsafe attributes fixes https://github.com/rust-lang/rust/issues/142182 If an attribute is re-emitted by a macro, the incorrect edition was used to emit warnings for unsafe attributes. This logic was introduced in https://github.com/rust-lang/rust/pull/139718 cc `@compiler-errors` `@ehuss`
2025-06-12Rollup merge of #142157 - Enselic:trivial-anon-const-use-cases, ↵Matthias Krüger-1/+1
r=compiler-errors rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const` wording In some contexts, const expressions are OK. Add a `here` to the error message to clarify this. Closes rust-lang/rust#79429 which has 15 x 👍
2025-06-12Rollup merge of #142040 - jswrenn:transmute-ty-region-generic, r=compiler-errorsMatthias Krüger-348/+346
transmutability: shift abstraction boundary Previously, `rustc_transmute`'s layout representations were genericized over `R`, a reference. Now, it's instead genericized over representations of type and region. This allows us to move reference transmutability logic from `rustc_trait_selection` to `rustc_transmutability` (and thus unit test it independently of the compiler), and — in a follow-up PR — will make it possible to support analyzing function pointer transmutability with minimal surgery. r? `@compiler-errors`
2025-06-12Rollup merge of #141307 - b-naber:closure-body, r=celinvalMatthias Krüger-0/+8
Add method to retrieve body of closure in stable-mir fixes https://github.com/rust-lang/project-stable-mir/issues/85 r? `@celinval`
2025-06-11Rollup merge of #142369 - jdonszelmann:attr-docs, r=fmeaseMatthias Krüger-12/+23
Improve some attribute docs and rename groups r? `@nnethercote` Some naming here got changed at some point, and this feels more consistent. The docs changes were a direct response to `@mejrs` trying to implement a new parsers and running into this.
2025-06-11Rollup merge of #142362 - Veykril:push-rzmrsswqourz, r=oli-obkMatthias Krüger-13/+19
Add expectation for `{` when parsing lone coroutine qualifiers Fixes https://github.com/rust-lang/rust/issues/80931
2025-06-11Rollup merge of #142356 - Stypox:fix-enter_trace_span, r=RalfJungMatthias Krüger-2/+2
Fix enter_trace_span!() using wrong $crate paths This is a followup to rust-lang/rust#140972, where I made a silly mistake and forgot to update `$crate::interpret::tracing_utils::...` to `$crate::interpret::util::...` inside the macro after moving the referenced code from `tracing_utils.rs` to `util.rs`. Sorry about this. r? `@RalfJung`
2025-06-11Rollup merge of #142305 - ↵Matthias Krüger-2/+0
GuillaumeGomez:remove-visit_id-EarlyContextAndPass, r=oli-obk Remove unneeded `check_id` calls as they are already called in `visit_id` in `EarlyContextAndPass` type Follow-up from [this message](https://github.com/rust-lang/rust/pull/142240/files#r2137474724). Since `check_id` is already called in `visit_id` which is supposed to be called for each item with an ID, we don't need to manually call `check_id`. r? `@oli-obk`
2025-06-11Auto merge of #142358 - matthiaskrgr:rollup-fxe6m7k, r=matthiaskrgrbors-111/+109
Rollup of 9 pull requests Successful merges: - rust-lang/rust#141967 (Configure bootstrap backport nominations through triagebot) - rust-lang/rust#142042 (Make E0621 missing lifetime suggestion verbose) - rust-lang/rust#142272 (tests: Change ABIs in tests to more future-resilient ones) - rust-lang/rust#142282 (Only run `citool` tests on the `auto` branch) - rust-lang/rust#142297 (Implement `//@ needs-target-std` compiletest directive) - rust-lang/rust#142298 (Make loongarch-none target maintainers more easily pingable) - rust-lang/rust#142306 (Dont unwrap and re-wrap typing envs) - rust-lang/rust#142324 (Remove unneeded `FunctionCx` from some codegen methods) - rust-lang/rust#142328 (feat: Add `bit_width` for unsigned integer types) Failed merges: - rust-lang/rust#141639 (Expose discriminant values in stable_mir) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-11compiler: Avoid reporting unsupported_calling_conventions in depsJubilee Young-1/+1
2025-06-11consistently rename (old) attribute groupsJana Dönszelmann-12/+14
2025-06-11document attribute parsers betterJana Dönszelmann-0/+9
2025-06-11Add expectation for `{` when parsing lone coroutine qualifiersLukas Wirth-13/+19
2025-06-11Rollup merge of #142324 - scottmcm:less-functioncx, r=workingjubileeMatthias Krüger-96/+94
Remove unneeded `FunctionCx` from some codegen methods No changes; just removing the `self` that wasn't needed. r? workingjubilee cc https://github.com/rust-lang/rust/pull/138759#issuecomment-2920860686
2025-06-11Rollup merge of #142306 - compiler-errors:nit-reveal-param-env-query, r=lcnrMatthias Krüger-11/+7
Dont unwrap and re-wrap typing envs Just a tiny tweak to make the query less awkward. r? lcnr
2025-06-11Rollup merge of #142042 - estebank:explicit-lifetime-verbose-suggestion, ↵Matthias Krüger-4/+8
r=compiler-errors Make E0621 missing lifetime suggestion verbose ``` error[E0621]: explicit lifetime required in the type of `x` --> $DIR/42701_one_named_and_one_anonymous.rs:10:9 | LL | &*x | ^^^ lifetime `'a` required | help: add explicit lifetime `'a` to the type of `x` | LL | fn foo2<'a>(a: &'a Foo, x: &'a i32) -> &'a i32 { | ++ ``` Part of rust-lang/rust#141973.
2025-06-11Auto merge of #141763 - lcnr:fixme-gamer, r=BoxyUwUbors-36/+67
`FIXME(-Znext-solver)` triage r? `@BoxyUwU`
2025-06-11Fix enter_trace_span!() using wrong $crate pathsStypox-2/+2
2025-06-11Auto merge of #141942 - ShoyuVanilla:smir-repr, r=oli-obkbors-5/+96
Implement representation options to smir Resolves rust-lang/project-stable-mir#89
2025-06-11compiler: Update all targets to the new c_int_width typeJubilee Young-7/+7
2025-06-11compiler: Change c_int_width to be an integer typeJubilee Young-19/+17
2025-06-11Remove useless and wrong std crates special casing when un-remap sysrootUrgau-28/+1
2025-06-11Auto merge of #142090 - compiler-errors:perf-stable-root-var, r=lcnrbors-17/+6
Make root vars more stable Never resolve a ty/ct vid to a higher vid as its root. This should make the optimization in rust-lang/rust#141500 more "stable" when there are a lot of vars flying around. r? `@ghost`
2025-06-10Auto merge of #141883 - oli-obk:remove-check-mod-loops, r=nnethercotebors-204/+187
Remove check_mod_loops query and run the checks per-body instead This analysis is older than my first rustc contribution I believe. It was never querified. Ideally we'd merge it into the analysis happening within typeck anyway (typeck just uses span_delayed_bug instead of erroring), but I didn't want to do that within this PR that also moves things around and subtly changes diagnostic ordering.
2025-06-10Remove unneeded `FunctionCx` from some codegen methodsScott McMurray-96/+94
No changes; just removing the `self` that wasn't needed.
2025-06-10Remove unneeded `check_id` calls as they are already called in `visit_id` in ↵Guillaume Gomez-2/+0
`EarlyContextAndPass` type
2025-06-10Auto merge of #142299 - fmease:rollup-u86s80a, r=fmeasebors-1340/+880
Rollup of 16 pull requests Successful merges: - rust-lang/rust#134442 (Specify the behavior of `file!`) - rust-lang/rust#140372 (Exhaustively handle parsed attributes in CheckAttr) - rust-lang/rust#140766 (Stabilize keylocker) - rust-lang/rust#141642 (Note the version and PR of removed features when using it) - rust-lang/rust#141818 (Don't create .msi installer for gnullvm hosts) - rust-lang/rust#141909 (Add central execution context to bootstrap) - rust-lang/rust#141992 (use `#[naked]` for `__rust_probestack`) - rust-lang/rust#142101 (core::ptr: deduplicate more method docs) - rust-lang/rust#142102 (docs: Small clarification on the usage of read_to_string and read_to_end trait methods) - rust-lang/rust#142124 (Allow transmute casts in pre-runtime-MIR) - rust-lang/rust#142240 (deduplicate the rest of AST walker functions) - rust-lang/rust#142258 (platform-support.md: Mention specific Linux kernel version or later) - rust-lang/rust#142262 (Mark `core::slice::memchr` as `#[doc(hidden)]`) - rust-lang/rust#142271 (compiler: fn ptrs should hit different lints based on ABI) - rust-lang/rust#142275 (rustdoc: Refractor `clean_ty_generics`) - rust-lang/rust#142288 (const_eval: fix some outdated comments) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-10Dont unwrap and re-wrap typing envsMichael Goulet-11/+7
2025-06-10Rollup merge of #142288 - RalfJung:const-eval-comments, r=oli-obkLeón Orell Valerian Liehr-12/+8
const_eval: fix some outdated comments r? ``@oli-obk``