about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-08-10Auto merge of #145144 - scottmcm:unsigned_overflow_intr, r=nikicbors-7/+19
Stop using uadd.with.overflow As discussed in [#t-compiler/llvm > `uadd.with.overflow` (again) @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/.60uadd.2Ewith.2Eoverflow.60.20.28again.29/near/533041085), stop emitting `uadd.with.overflow` in favour of `add`+`icmp` instead. r? nikic
2025-08-10Start reporting future breakage for `ILL_FORMED_ATTRIBUTE_INPUT` in dependenciesJonathan Brouwer-0/+1
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-09mbe: Fix typo in attribute tracingJosh Triplett-1/+1
2025-08-10Auto merge of #144873 - cjgillot:implications, r=lqdbors-80/+73
Implement `stability_implications` without a visitor. Since https://github.com/rust-lang/rust/pull/143845, the `Annotator` visitor was a no-op when the crate is not staged_api. This PR avoids using a visitor altogether, making `stability_implications` truly a no-op in most cases.
2025-08-10Use `eq_ignore_ascii_case` to avoid heap alloc in `detect_confuse_type`xizheyin-1/+1
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-08-10Ignore coroutine witness type region args in auto trait confirmationMichael Goulet-2/+15
2025-08-09`suggest_borrow_generic_arg`: use the correct generic argsdianne-7/+22
2025-08-09Auto merge of #145146 - fee1-dead-contrib:push-zmqrkurlzrxy, r=nnethercotebors-954/+941
remove `P` Previous work: rust-lang/rust#141603 MCP: https://github.com/rust-lang/compiler-team/issues/878 cc `@nnethercote`
2025-08-09Fix an unstable feature comment that wasn't a doc commentJosh Triplett-1/+1
Every other feature in the list uses a doc comment; fix one that used a regular comment to use a doc comment.
2025-08-09some `derive_more` refactorsDeadbeef-100/+180
some clauses can be merged together without requiring an attribute for each trait derived. also manually impl `Eq` because the `derive_where` generated code is too much for my comfort
2025-08-09Auto merge of #145142 - Zalathar:rollup-oi6s8kg, r=Zalatharbors-413/+373
Rollup of 23 pull requests Successful merges: - rust-lang/rust#141658 (rustdoc search: prefer stable items in search results) - rust-lang/rust#141828 (Add diagnostic explaining STATUS_STACK_BUFFER_OVERRUN not only being used for stack buffer overruns if link.exe exits with that exit code) - rust-lang/rust#144823 (coverage: Extract HIR-related helper code out of the main module) - rust-lang/rust#144883 (Remove unneeded `drop_in_place` calls) - rust-lang/rust#144923 (Move several more float tests to floats/mod.rs) - rust-lang/rust#144988 (Add annotations to the graphviz region graph on region origins) - rust-lang/rust#145010 (Couple of minor abi handling cleanups) - rust-lang/rust#145017 (Explicitly disable vector feature on s390x baseline of bad-reg test) - rust-lang/rust#145027 (Optimize `char::is_alphanumeric`) - rust-lang/rust#145050 (add member constraints tests) - rust-lang/rust#145073 (update enzyme submodule to handle llvm 21) - rust-lang/rust#145080 (Escape diff strings in MIR dataflow graphviz) - rust-lang/rust#145082 (Fix some bad formatting in `-Zmacro-stats` output.) - rust-lang/rust#145083 (Fix cross-compilation of Cargo) - rust-lang/rust#145096 (Fix wasm target build with atomics feature) - rust-lang/rust#145097 (remove unnecessary `TypeFoldable` impls) - rust-lang/rust#145100 (Rank doc aliases lower than equivalently matched items) - rust-lang/rust#145103 (rustc_metadata: remove unused private trait impls) - rust-lang/rust#145115 (defer opaque type errors, generally greatly reduce tainting) - rust-lang/rust#145119 (rustc_public: fix missing parenthesis in pretty discriminant) - rust-lang/rust#145124 (Recover `for PAT = EXPR {}`) - rust-lang/rust#145132 (Refactor map_unit_fn lint) - rust-lang/rust#145134 (Reduce indirect assoc parent queries) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-09remove `P`Deadbeef-954/+941
2025-08-09rename `TraitRef::from_method` to `from_assoc`Deadbeef-13/+13
also add a note to `GenericArgs::truncate_to`
2025-08-09rustc_target: Add the `32s` target feature for LoongArchWANG Rui-0/+2
2025-08-08Stop using uadd.with.overflowScott McMurray-7/+19
2025-08-09Rollup merge of #145134 - camsteffen:indirect-assoc-parent, r=cjgillotStuart Cook-7/+4
Reduce indirect assoc parent queries Simplify some code that uses multiple queries to get the parent of an associated item.
2025-08-09Rollup merge of #145132 - camsteffen:refactor-map-unit-fn, r=fee1-deadStuart Cook-68/+39
Refactor map_unit_fn lint Just some light refactoring.
2025-08-09Rollup merge of #145124 - compiler-errors:for-eq, r=lqdStuart Cook-7/+8
Recover `for PAT = EXPR {}` I type this constantly, and the existing suggestion to put `in` before the `=` is misleading.
2025-08-09Rollup merge of #145119 - makai410:pretty-fix, r=compiler-errorsStuart Cook-1/+1
rustc_public: fix missing parenthesis in pretty discriminant
2025-08-09Rollup merge of #145115 - lcnr:less-borrowck-tainting, r=compiler-errorsStuart Cook-64/+87
defer opaque type errors, generally greatly reduce tainting fixes the test for rust-lang/rust#135528, does not actually fix that issue properly. This is useful as it causes the migration to rust-lang/rust#139587 to be a lot easier.
2025-08-09Rollup merge of #145103 - fee1-dead-contrib:push-plompruwywvk, r=compiler-errorsStuart Cook-87/+1
rustc_metadata: remove unused private trait impls These are impls for non-reachable traits that don't appear to be used. Please let me know if there is value in keeping some of them for now. cc `@cjgillot`
2025-08-09Rollup merge of #145097 - lcnr:type-foldable-yeet, r=wesleywiserStuart Cook-9/+3
remove unnecessary `TypeFoldable` impls
2025-08-09Rollup merge of #145082 - nnethercote:macro-stats-fix-widths, r=petrochenkovStuart Cook-1/+1
Fix some bad formatting in `-Zmacro-stats` output. r? `@petrochenkov`
2025-08-09Rollup merge of #145080 - ashivaram23:graphviz_escape, r=lqdStuart Cook-0/+1
Escape diff strings in MIR dataflow graphviz This uses `dot::escape_html` on diff strings so that `<` and `>` are properly escaped in MIR dataflow graphviz. Previously the output could be malformed. For example, the graphviz for borrow check `MaybeInitializedPlaces` for the example in rust-lang/rust#145032 contained an unescaped `Fork<'_>`.
2025-08-09Rollup merge of #145010 - bjorn3:couple_abi_cleanups, r=compiler-errorsStuart Cook-20/+16
Couple of minor abi handling cleanups These are extracted out of a wip branch I have to get rid of the `extern "unadjusted"` ABI for anything other than LLVM intrinsics.
2025-08-09Rollup merge of #144988 - amandasystems:more-detailed-region-graph, r=lcnrStuart Cook-6/+22
Add annotations to the graphviz region graph on region origins This adds - `(ex<'e>)` for regions whose origin is existential, with name if one exists, - `(for<'p>)` for regions whose origin is a placeholder, with name if one exists For any region whose name we don't know, use `'_`. This has helped _my_ debugging and it doesn't create too bad clutter, I feel. The change ~~is~~was ridiculously small, but I turned it into a separate PR so we can bikeshed the format. The following snippet: ```rust struct Co<'a>(&'a ()); struct Contra<'a>(fn(&'a ())); // `exists<'e> forall<'p> 'p: 'e` -> ERROR fn p_outlives_e( x: for<'e> fn(for<'p> fn(fn(fn(Contra<'e>, Co<'p>)))), ) -> fn(fn(fn(for<'unify> fn(Contra<'unify>, Co<'unify>)))) { x ``` Gives this graph: ![new-naming](https://github.com/user-attachments/assets/f2c8f17c-d29b-4d42-9da7-4b8e520e76a6)
2025-08-09Rollup merge of #144883 - scottmcm:remove-unneeded-drop_in_place, r=nnethercoteStuart Cook-7/+24
Remove unneeded `drop_in_place` calls Might as well pull this out from rust-lang/rust#144561 because this is still used in things like `Vec::truncate` where it'd be nice to allow it be removed if inlined enough to see that the type is `Copy`. So long as perf says it's ok, at least 🤞
2025-08-09Rollup merge of #144823 - Zalathar:hir-info, r=oli-obkStuart Cook-136/+142
coverage: Extract HIR-related helper code out of the main module This is a decent chunk of helper code with a narrow external interface (one function returning one struct), making it a good candidate to be extracted out of the main `rustc_mir_transform::coverage` module. No functional changes.
2025-08-09Rollup merge of #141828 - Fulgen301:status-stack-buffer-overrun-diagnostic, ↵Stuart Cook-0/+24
r=wesleywiser Add diagnostic explaining STATUS_STACK_BUFFER_OVERRUN not only being used for stack buffer overruns if link.exe exits with that exit code `STATUS_STACK_BUFFER_OVERRUN` is also used for fast abnormal program termination, e.g. by abort(). Emit a special diagnostic to let people know that this most likely doesn't indicate a stack buffer overrun. This doesn't look up the crash report in the event log to determine what the fast fail error code is. This is due to the way crashes are logged: When a process crash happens, the system logs an "Application Error" event, which contains the exit code and the process ID, but not the fast fail error code. A second event by Windows Error Reporting does contain that fast fail code, but not the process ID - but that event is not emitted at process exit, but when WER has dealt with it (on my system, it happens roughly two seconds later), so querying the code would have to read the `IntegratorReportId`, wait two seconds or potentially longer for the WER event with the same `ReportID`, and read out the code. (Also, that second event doesn't happen if WER is disabled.) Fixes rust-lang/rust#100519.
2025-08-09Auto merge of #143376 - dianne:guard-scope, r=matthewjasperbors-46/+84
add a scope for `if let` guard temporaries and bindings This fixes my concern with `if let` guard drop order, namely that the guard's bindings and temporaries were being dropped after their arm's pattern's bindings, instead of before (https://github.com/rust-lang/rust/pull/141295#issuecomment-2968975596). The guard's bindings and temporaries now live in a new scope, which extends until (but not past) the end of the arm, guaranteeing they're dropped before the arm's pattern's bindings. This only introduces a new scope for match arms with guards. Perf results (https://github.com/rust-lang/rust/pull/143376#issuecomment-3034922617) seemed to indicate there wasn't a significant hit to introduce a new scope on all match arms, but guard patterns (rust-lang/rust#129967) will likely benefit from only adding new scopes when necessary (with some patterns requiring multiple nested scopes). Tracking issue for `if_let_guard`: rust-lang/rust#51114 Tests are adapted from examples by `@traviscross,` `@est31,` and myself on rust-lang/rust#141295.
2025-08-09Auto merge of #145086 - jdonszelmann:revert-allow-internal-unsafe, r=Kobzolbors-73/+17
Revert "Port `#[allow_internal_unsafe]` to the new attribute system" This reverts commit 4f7a6ace9e2f2192af7b5d32f4b1664189e0e143 (PR: https://github.com/rust-lang/rust/pull/144857) r? `@Kobzol` cc: `@scrabsha` clean revert it seems :3
2025-08-08Reduce indirect assoc parent queriesCameron Steffen-7/+4
2025-08-08Refactor map_unit_fn lintCameron Steffen-68/+39
2025-08-08Rollup merge of #144987 - tgross35:llvm21-f16-f128, r=nikicTrevor Gross-11/+13
Enable f16 and f128 on targets that were fixed in LLVM21 LLVM21 fixed the new float types on a number of targets: * SystemZ gained f16 support https://github.com/llvm/llvm-project/pull/109164 * Hexagon now uses soft f16 to avoid recursion bugs https://github.com/llvm/llvm-project/pull/130977 * Mips now correctly handles f128 (actually since LLVM20) https://github.com/llvm/llvm-project/pull/117525 * f128 is now correctly aligned when passing the stack on x86 https://github.com/llvm/llvm-project/pull/138092 Thus, enable the types on relevant targets for LLVM > 21.0.0. NVPTX also gained handling of f128 as a storage type, but it lacks support for basic math operations so is still disabled here. try-job: dist-i586-gnu-i586-i686-musl try-job: dist-i686-linux try-job: dist-i686-msvc try-job: dist-s390x-linux try-job: dist-various-1 try-job: dist-various-2 try-job: dist-x86_64-linux try-job: i686-gnu-1 try-job: i686-gnu-2 try-job: i686-msvc-1 try-job: i686-msvc-2 try-job: test-various
2025-08-08Rollup merge of #144775 - lcnr:skip_binder-comment, r=BoxyUwUTrevor Gross-30/+30
more strongly dissuade use of `skip_binder` People unfortunately encounter `Binder` and `EarlyBinder` very early on when starting out. In these cases its often very easy to use `skip_binder` incorrectly. This makes it more explicit that it should generally not be used and points to the relevant `rustc-dev-guide` chapters. r? `@BoxyUwU`
2025-08-08Rollup merge of #144649 - estebank:issue-144602, r=lcnrTrevor Gross-50/+63
Account for bare tuples and `Pin` methods in field searching logic When looking for the field names and types of a given type, account for tuples. This allows suggestions for incorrectly nested field accesses and field name typos to trigger as intended. Previously these suggestions only worked on `ty::Adt`, including tuple structs which are no different to tuples, so they should behave the same in suggestions. When suggesting field access which would encounter a method not found, do not suggest pinning when those methods are on `impl Pin` itself. ``` error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope --> $DIR/missing-field-access.rs:11:15 | LL | let x = f.get_ref(); | ^^^^^^^ method not found in `(BufReader<File>,)` | help: one of the expressions' fields has a method of the same name | LL | let x = f.0.get_ref(); | ++ ``` instead of ``` error[E0599]: no method named `get_ref` found for tuple `(BufReader<File>,)` in the current scope --> $DIR/missing-field-access.rs:11:15 | LL | let x = f.get_ref(); | ^^^^^^^ method not found in `(BufReader<File>,)` | help: consider pinning the expression | LL ~ let mut pinned = std::pin::pin!(f); LL ~ let x = pinned.as_ref().get_ref(); | ``` Fix rust-lang/rust#144602.
2025-08-08Rollup merge of #144579 - joshtriplett:mbe-attr, r=petrochenkovTrevor Gross-55/+331
Implement declarative (`macro_rules!`) attribute macros (RFC 3697) This implements [RFC 3697](https://github.com/rust-lang/rust/issues/143547), "Declarative (`macro_rules!`) attribute macros". I would suggest reading this commit-by-commit. This first introduces the feature gate, then adds parsing for attribute rules (doing nothing with them), then adds the ability to look up and apply `macro_rules!` attributes by path, then adds support for local attributes, then adds a test, and finally makes various improvements to errors.
2025-08-08Rollup merge of #144545 - ChayimFriedman2:bool-witness-order, r=NadrierilTrevor Gross-5/+8
In rustc_pattern_analysis, put `true` witnesses before `false` witnesses In rustc it doesn't really matter what the order of the witnesses is, but I'm planning to use the witnesses for implementing the "add missing match arms" assist in rust-analyzer, and there `true` before `false` is the natural order (like `Some` before `None`), and also what the current assist does. The current order doesn't seem to be intentional; the code was created when bool ctors became their own thing, not just int ctors, but for integer, 0 before 1 is indeed the natural order. r? `@Nadrieril`
2025-08-08Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikicTrevor Gross-48/+121
atomicrmw on pointers: move integer-pointer cast hacks into backend Conceptually, we want to have atomic operations on pointers of the form `fn atomic_add(ptr: *mut T, offset: usize, ...)`. However, LLVM does not directly support such operations (https://github.com/llvm/llvm-project/issues/120837), so we have to cast the `offset` to a pointer somewhere. This PR moves that hack into the LLVM backend, so that the standard library, intrinsic, and Miri all work with the conceptual operation we actually want. Hopefully, one day LLVM will gain a way to represent these operations without integer-pointer casts, and then the hack will disappear entirely. Cc ```@nikic``` -- this is the best we can do right now, right? Fixes https://github.com/rust-lang/rust/issues/134617
2025-08-08Rollup merge of #144039 - estebank:short-paths, r=fee1-deadTrevor Gross-216/+240
Use `tcx.short_string()` in more diagnostics `TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`. We add support for shortening the path of "trait path only". Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).
2025-08-08Check coroutine upvars and in dtorck constraintMichael Goulet-24/+50
2025-08-08Recover for PAT = EXPR {}Michael Goulet-7/+8
2025-08-08mbe: Handle local `macro_rules` attr resolutionJosh Triplett-4/+16
Teach the resolver to consider `macro_rules` macros when looking for a local attribute. When looking for an attribute and considering a `macro_rules` macro, load the macro in order to see if it has attribute rules. Include a FIXME about tracking multiple macro kinds for a Def instead.
2025-08-08mbe: Handle applying attribute rules with pathsJosh Triplett-28/+185
Add infrastructure to apply an attribute macro given argument tokens and body tokens. Teach the resolver to consider `macro_rules` macros when looking for an attribute via a path. This does not yet handle local `macro_rules` attributes.
2025-08-08mbe: Emit an error if a macro call has no function-like rulesJosh Triplett-3/+21
Add a FIXME for moving this error earlier.
2025-08-08mbe: Fix error message for using a macro with no `attr` rules as an attributeJosh Triplett-1/+1
Avoid saying "a declarative macro cannot be used as an attribute macro"; instead, say that the macro has no `attr` rules.
2025-08-08mbe: Parse macro attribute rulesJosh Triplett-20/+109
This handles various kinds of errors, but does not allow applying the attributes yet. This adds the feature gate `macro_attr`.
2025-08-09fix missing parenthesis in pretty discriminantMakai-1/+1
2025-08-08mbe: In error messages, don't assume attributes are always proc macrosJosh Triplett-1/+1
Now that `macro_rules` macros can define attribute rules, make sure error messages account for that.
2025-08-08borrowck: defer opaque type errorslcnr-47/+70