about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-04-08fix "still mutable" ice while metrics are enabledJane Losare-Lusby-5/+10
2025-04-08Remove redundant assignmentNadrieril-17/+5
2025-04-08Return a type from `check_pat_inner`Nadrieril-55/+49
2025-04-08Reorganize `check_pat_inner`Nadrieril-57/+61
2025-04-08Turn the peeling loop into a recursive callNadrieril-34/+46
2025-04-08Insert adjustments incrementallyNadrieril-9/+7
2025-04-08Inline `calc_default_binding_mode`Nadrieril-92/+66
2025-04-08Do not optimize out SwitchInt before borrowck, or if Zmir-preserve-ubMichael Goulet-19/+36
2025-04-08Rollup merge of #139541 - compiler-errors:transmute, r=lcnrMatthias Krüger-3/+3
Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations This avoids an ICE where we weren't keeping track of bound variables correctly in the `Freeze` obligations we emit for transmute goals. We could use `rebind` instead on that goal, but I think it's better just to instantiate the binder. Fixes #139538 r? `@lcnr` or reassign
2025-04-08Rollup merge of #139515 - compiler-errors:sig-mismatch, r=lcnrMatthias Krüger-32/+58
Improve presentation of closure signature mismatch from `Fn` trait goal Flip the order of "expected" and "found" since that wasn't correct. Don't present the arguments as a tuple, since it leaves a trailing comma. Instead, just use `fn(arg, arg)`. Finally, be better with binders since we were just skipping binders. r? oli-obk or reassign
2025-04-08Rollup merge of #139494 - compiler-errors:restrict-queries, r=oli-obkMatthias Krüger-26/+43
Restrict some queries by def-kind more Random cleanup. I prefer things to assert more so as to catch bugs :) r? oli-obk
2025-04-08for large assignment lint, use the correct span for checking for duplicate lintsJonathan Gruner-5/+8
2025-04-08report call site of inlined scopes for large assignment lintsJonathan Gruner-3/+17
2025-04-08Fix unreachable expression warningCelina G. Val-4/+10
Invert the order that we pass the arguments to the `contract_check_ensures` function to avoid the warning when the tail of the function is unreachable. Note that the call itself is also unreachable, but we have already handled that case by ignoring unreachable call for contract calls.
2025-04-08Instantiate higher-ranked transmute goalMichael Goulet-3/+3
2025-04-08Rollup merge of #139509 - xizheyin:issue-139359, r=lcnrMatthias Krüger-121/+111
clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()` Closes #139359 r? `@lcnr`
2025-04-08Rollup merge of #139501 - compiler-errors:suppress-stack-overflow, r=lcnrMatthias Krüger-5/+35
Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types This fixes several spicy non-trivial recursive opaque definitions inferred from HIR typeck, ensuring that they don't cause stack overflows in exhaustiveness code, which currently reveals opaques manually in a way that is not overflow aware (as opposed to something like the normalizer folders). These should eventually be outright rejected, but today (some) non-trivial recursive opaque definitions are accepted, and changing that requires an FCP, so for now just make sure we don't stack overflow :^) Fixes https://github.com/rust-lang/rust/issues/139402 r? lcnr
2025-04-08Rollup merge of #139476 - lcnr:rm-var_infos, r=compiler-errorsMatthias Krüger-14/+8
rm `RegionInferenceContext::var_infos` we already track this info in the `definitions` field r? types
2025-04-08Auto merge of #138499 - lcnr:borrowck-typeck_root, r=oli-obkbors-342/+398
borrowck typeck children together with their root This introduces new cycle errors, even with `feature(inline_const_pat)` removed, see the `non-structural-match-types-cycle-err.rs` test. The new cycle error happens as the layout of `async`-blocks relies on their `optimized_mir`. As that now depends on `mir_borrowck` of its typeck parent, computing the layout of an `async`-block during MIR building, e.g. when evaluating a named `const` pattern. I think there's currently no way to have a named const pattern whose type references an async block while being allowed? cc `@oli-obk` `@RalfJung` I cannot think of other cases where we currently rely on the MIR of a typeck children while borrowchecking their parent. The crater run came back without any breakage. My work here will prevent any future features which rely on this as we'll get locked into borrowchecking them together as I continue to work on https://github.com/rust-lang/types-team/issues/129, cc `@rust-lang/types.` r? compiler-errors
2025-04-08Rollup merge of #139464 - nnethercote:fix-139248-AND-fix-139445, r=petrochenkovStuart Cook-4/+16
Allow for reparsing failure when reparsing a pasted metavar. Fix some metavar reparsing issues. Fixes #139248 and #139445. r? `@petrochenkov`
2025-04-08Rollup merge of #139421 - compiler-errors:upcast-no-principal-with-proj, ↵Stuart Cook-14/+24
r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections #126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of #114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe82563146325674b8d437f9f9f6e703703, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in #126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes #139418 r? ````@oli-obk```` (or anyone)
2025-04-08Rollup merge of #139346 - ↵Stuart Cook-1/+10
compiler-errors:non-lifetime-binder-diag-hir-wf-check, r=oli-obk Don't construct preds w escaping bound vars in `diagnostic_hir_wf_check` See comment inline. Fixes #139330 r? oli-obk
2025-04-08Rollup merge of #139124 - xtexx:gh-139082, r=compiler-errorsStuart Cook-0/+25
compiler: report error when trait object type param reference self Fixes #139082. Emits an error when `Self` is found in the projection bounds of a trait object. In type aliases, `Self` has no meaning, so `type A = &'static dyn B` where `trait B = Fn() -> Self` will expands to `type A = &'static Fn() -> Self` which is illegal, causing the region solver to bail out when hitting the uninferred Self. r? ````@compiler-errors```` ````@fee1-dead````
2025-04-08Rollup merge of #139098 - scottmcm:assert-impossible-tags, r=WaffleLapkinStuart Cook-1/+31
Tell LLVM about impossible niche tags I was trying to find a better way of emitting discriminant calculations, but sadly had no luck. So here's a fairly small PR with the bits that did seem worth bothering: 1. As the [`TagEncoding::Niche` docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.TagEncoding.html#variant.Niche) describe, it's possible to end up with a dead value in the input that's not already communicated via the range parameter attribute nor the range load metadata attribute. So this adds an `llvm.assume` in non-debug mode to tell LLVM about that. (That way it can tell that the sides of the `select` have disjoint possible values.) 2. I'd written a bunch more tests, or at least made them parameterized, in the process of trying things out, so this checks in those tests to hopefully help future people not trip on the same weird edge cases, like when the tag type is `i8` but yet there's still a variant index and discriminant of `258` which doesn't fit in that tag type because the enum is really weird.
2025-04-08Rollup merge of #139024 - compiler-errors:tweak-default-value-err, r=lcnrStuart Cook-2/+6
Make error message for missing fields with `..` and without `..` more consistent When `..` is not present, we say "missing field `bar` in initializer", but when it is present we say "missing mandatory field `bar`". I don't see why the primary error message should change, b/c the root cause is the same. Let's harmonize these error messages and instead use a label to explain that `..` is required b/c it's not defaulted. r? estebank
2025-04-08Rollup merge of #138676 - compiler-errors:overflow-implied-bounds, r=lcnrStuart Cook-4/+17
Implement overflow for infinite implied lifetime bounds Not a great error message, but better than a hang Fixes #138665 Fixes #102966 Fixes #115407 r? lcnr
2025-04-08update if let to match in universal_regions.rsxizheyin-11/+11
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-08Update compiler/rustc_borrowck/src/diagnostics/region_errors.rsxizheyin-1/+2
Co-authored-by: lcnr <rust@lcnr.de>
2025-04-08Remove unnecessary dyn Display in favor of strMichael Goulet-9/+9
2025-04-08Improve presentation of closure signature mismatch from Fn trait goalMichael Goulet-25/+51
2025-04-08clean code: remove Deref<Target=RegionKind> impl for Region and use `.kind()`xizheyin-112/+101
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-08Allow for reparsing failure when reparsing a pasted metavar.Nicholas Nethercote-3/+10
Fixes #139445. The additional errors aren't great but the first one is still good and it's the most important, and imperfect errors are better than ICEing.
2025-04-08Allow for missing invisible close delim when reparsing an expression.Nicholas Nethercote-1/+6
This can happen when invalid syntax is passed to a declarative macro. We shouldn't be too strict about the token stream position once the parser has rejected the invalid syntax. Fixes #139248.
2025-04-07Address PR feedbackScott McMurray-1/+3
2025-04-07Fix stack overflow in exhaustiveness due to recursive HIR opaque type valuesMichael Goulet-5/+35
2025-04-08add negative impllcnr-4/+8
2025-04-08move `ClosureRegionRequirements` to `rustc_borrowck`lcnr-155/+155
2025-04-08borrowck typeck children together with their parentlcnr-191/+243
2025-04-07check_align: we can still check low alignments on MSVCRalf Jung-3/+27
2025-04-07mitigate MSVC unsoundness by not emitting alignment attributes on win32-msvc ↵Ralf Jung-4/+29
targets also mention the MSVC alignment issue in platform-support.md
2025-04-07Auto merge of #133781 - cjgillot:shallow-allowed-lints, r=petrochenkovbors-91/+28
Do not visit whole crate to compute `lints_that_dont_need_to_run`. This allows to reuse the computed lint levels instead of re-visiting the whole crate.
2025-04-07Implement overflow for infinite implied lifetime boundsMichael Goulet-4/+17
2025-04-07Prepend temp files with a string per invocation of rustcMichael Goulet-50/+196
2025-04-07Simplify temp path creation a bitMichael Goulet-92/+70
2025-04-07Make error message for missing fields with .. and without .. more consistentMichael Goulet-2/+6
2025-04-07Only clone mir body if tcx.features().ergonomic_clones()Santiago Pastorino-8/+10
2025-04-07Optimize codegen of use values that are copy post monomorphizationSantiago Pastorino-4/+66
2025-04-07Use a local var for tcxSantiago Pastorino-4/+5
2025-04-07Make use generated TerminatorKind::Call have call_source UseSantiago Pastorino-1/+3
2025-04-07Add `naked_functions_rustic_abi` feature gateFolkert de Vries-68/+29