about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/check
AgeCommit message (Collapse)AuthorLines
2025-09-27Rename various "concrete opaque type" terminology to say "hidden type"Boxy Uwu-2/+2
2025-09-23Make missed precondition-free float intrinsics safeltdk-0/+8
2025-09-22Auto merge of #146683 - clarfonthey:safe-intrinsics, r=RalfJung,Amanieubors-58/+126
Mark float intrinsics with no preconditions as safe Note: for ease of reviewing, the list of safe intrinsics is sorted in the first commit, and then safe intrinsics are added in the second commit. All *recently added* float intrinsics have been correctly marked as safe to call due to the fact that they have no preconditions. This adds the remaining float intrinsics which are safe to call to the safe intrinsic list, and removes the unsafe blocks around their calls. --- Side note: this may want a try run before being added to the queue, since I'm not sure if there's any tier-2 code that uses these intrinsics that might not be tested on the usual PR flow. We've already uncovered a few places in subtrees that do this, and it's worth double-checking before clogging up the queue.
2025-09-21Mark float intrinsics with no preconditions as safeltdk-0/+64
2025-09-17Sort safe intrinsic listltdk-58/+62
2025-09-17Rollup merge of #145838 - dianne:non-extending-super-let, r=jackh726,traviscrossStuart Cook-5/+19
don't apply temporary lifetime extension rules to non-extended `super let` Reference PR: rust-lang/reference#1980 This changes the semantics for `super let` (and macros implemented in terms of it, such as `pin!`, `format_args!`, `write!`, and `println!`) as suggested by ````@theemathas```` in https://github.com/rust-lang/rust/issues/145784#issuecomment-3218658335, making `super let` initializers only count as [extending expressions](https://doc.rust-lang.org/nightly/reference/destructors.html#extending-based-on-expressions) when the `super let` itself is within an extending block. Since `super let` initializers aren't temporary drop scopes, their temporaries outside of inner temporary scopes are effectively always extended, even when not in extending positions; this only affects two cases as far as I can tell: - Block tail expressions in Rust 2024. This PR makes `f(pin!({ &temp() }))` drop `temp()` at the end of the block in Rust 2024, whereas previously it would live until after the call to `f` because syntactically the `temp()` was in an extending position as a result of `super let` in `pin!`'s expansion. - `super let` nested within a non-extended `super let` is no longer extended. i.e. a normal `let` is required to treat `super let`s as extending (in which case nested `super let`s will also be extending). Closes rust-lang/rust#145784 This is a breaking change. Both static and dynamic semantics are affected. The most likely breakage is for programs to stop compiling, but it's technically possible for drop order to silently change as well (as in rust-lang/rust#145784). Since this affects stable macros, it probably would need a crater run. Nominating for discussion alongside rust-lang/rust#145784: ````@rustbot```` label +I-lang-nominated +I-libs-api-nominated Tracking issue for `super let`: rust-lang/rust#139076
2025-09-16Rollup merge of #146442 - Qelxiros:trait-suggestion-generics, r=BoxyUwUMatthias Krüger-11/+33
Display ?Sized, const, and lifetime parameters in trait item suggestions across a crate boundary context: rust-lang/rust#145929 This fixes the MetaSized issue and adds const generics and early bound lifetimes. Late bound lifetimes are harder because they aren't returned by `generics_of`. I'm going to look into it, but there's no guarantee I'll be successful. Fixes https://github.com/rust-lang/rust/issues/146404. r? `@BoxyUwu`
2025-09-16handle const generics, ?Sized, early bound lifetimesJeremy Smart-11/+33
2025-09-16Rollup merge of #145095 - tiif:unstable_const_param, r=BoxyUwUStuart Cook-12/+1
Migrate `UnsizedConstParamTy` to unstable impl of `ConstParamTy_` Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait. r? `@BoxyUwU`
2025-09-15Remove UnsizedConstParamTy trait and make it into an unstable impltiif-12/+1
2025-09-13Auto merge of #146491 - ↵bors-8/+3
jdonszelmann:update-fixme-compare_method_predicate_entailment, r=lcnr update fixme in compare_method_predicate_entailment resulting from review of EII r? `@lcnr` Just the comment update separately from https://github.com/rust-lang/rust/pull/146348/files since it doesn't really belong in that PR. Should be trivial
2025-09-13update fixme in compare_method_predicate_entailment resulting from review of EIIJana Dönszelmann-8/+3
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-16/+20
2025-09-12Rename AssocItemContainer -> AssocContainerCameron Steffen-15/+13
2025-09-09Auto merge of #146375 - matthiaskrgr:rollup-utik9zj, r=matthiaskrgrbors-27/+46
Rollup of 6 pull requests Successful merges: - rust-lang/rust#145463 (Reject invalid literal suffixes in tuple indexing, tuple struct indexing, and struct field name position) - rust-lang/rust#145929 (fix APITIT being treated as a normal generic parameter in suggestions) - rust-lang/rust#146001 (Update getopts to remove unicode-width dependency) - rust-lang/rust#146365 (triagebot: warn about #[rustc_intrinsic_const_stable_indirect]) - rust-lang/rust#146366 (add approx_delta to all gamma tests) - rust-lang/rust#146373 (fix comments about trait solver cycle heads) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-09Rollup merge of #145929 - Qelxiros:apitit-suggestion, r=BoxyUwUMatthias Krüger-27/+46
fix APITIT being treated as a normal generic parameter in suggestions closes rust-lang/rust#126395
2025-09-09erase_regions to erase_and_anonymize_regionsBoxy-1/+1
2025-09-08fix APITIT being treated as a normal generic parameter in suggestionsJeremy Smart-27/+46
2025-09-04don't extend non-extended `super let` initializers' block tail tempsdianne-5/+19
2025-09-04Rollup merge of #145690 - sayantn:integer-funnel-shift, r=tgross35Jacob Pratt-0/+3
Implement Integer funnel shifts Tracking issue: rust-lang/rust#145686 ACP: https://github.com/rust-lang/libs-team/issues/642 This implements funnel shifts on primitive integer types. Implements this for cg_llvm, with a fallback impl for everything else Thanks `@folkertdev` for the fixes and tests cc `@rust-lang/libs-api`
2025-09-04Rollup merge of #145342 - dianne:if-let-super-let, r=nnethercoteStuart Cook-6/+2
fix drop scope for `super let` bindings within `if let` Fixes rust-lang/rust#145328 by making non-lifetime-extended `super let` reuse the logic used to compute drop scopes for non-lifetime-extended temporaries. Also fixes rust-lang/rust#145374, which regressed due to rust-lang/rust#143376 introducing `if let`-like scopes for match arms with guards. Tracking issue for `super let`: rust-lang/rust#139076 This is a regression fix / breaking change for macros stably exposing `super let`, including `pin!` and `format_args!`. Nominating to be discussed alongside rust-lang/rust#145328: ```@rustbot``` label +I-lang-nominated +I-libs-api-nominated
2025-09-03Add `funnel_sh{l,r}` functions and intrinsicssayantn-0/+3
- Add a fallback implementation for the intrinsics - Add LLVM backend support for funnel shifts Co-Authored-By: folkertdev <folkert@folkertdev.nl>
2025-09-02stabilize extended_varargs_abi_supportRalf Jung-2/+2
2025-08-22change HIR typeck unification handling approachlcnr-0/+27
2025-08-20make `prefetch` intrinsics safeFolkert de Vries-1/+5
2025-08-14Complete functionality and general cleanupMarcelo Domínguez-2/+1
2025-08-14Basic implementation of `autodiff` intrinsicMarcelo Domínguez-1/+4
2025-08-13Cleanup assoc parent utilsCameron Steffen-5/+4
2025-08-13fix scope of `super let` bindings within `if let`dianne-6/+2
They now use the enclosing temporary scope as their scope, regardless of which `ScopeData` was used to mark it.
2025-08-11Propagate TraitImplHeader to hirCameron Steffen-47/+46
2025-08-09Auto merge of #143376 - dianne:guard-scope, r=matthewjasperbors-0/+5
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-08Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikicTrevor Gross-6/+6
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-07only introduce a guard scope for arms with guardsdianne-5/+5
2025-08-07add a scope for `if let` guard temporaries and bindingsdianne-0/+5
This ensures `if let` guard temporaries and bindings are dropped before the match arm's pattern's bindings.
2025-08-04Rollup merge of #144694 - compiler-errors:with-self-ty, r=SparrowLiiStuart Cook-1/+1
Distinguish prepending and replacing self ty in predicates There are two kinds of functions called `with_self_ty`: 1. Prepends the `Self` type onto an `ExistentialPredicate` which lacks it in its internal representation. 2. Replaces the `Self` type of an existing predicate, either for diagnostics purposes or in the new trait solver when normalizing that self type. This PR distinguishes these two because I often want to only grep for one of them. Namely, let's call it `with_replaced_self_ty` when all we're doing is replacing the self type.
2025-08-03Auto merge of #144704 - compiler-errors:explode-wf, r=lcnrbors-8/+8
expand WF obligations when checking method calls Don't wrap a bunch of signatures in `FnPtr` then check their WF; instead, check the WFness of each input/output separately. This is useful for the new trait solver, since because we stall on root obligations we end up needing to repeatedly recompute the WFness of possibly very large function signature types if it ends up bottoming out in ambiguity. This may also give us more chances to hit the WF fast path for certain types like built-ins. Finally, this just seems conceptually correct to do. There's nothing conceptually that suggests that wrapping the function signature in an fn pointer makes sense at all to do; I'm guessing that it was just convenient so that we didn't have to register WF obligations in a loop, but it doesn't affect the readability of this code at all.
2025-08-03Auto merge of #144677 - nnethercote:bound-const-handling, r=lcnrbors-1/+1
Improve bound const handling A few changes to make const handling more similar to type handling. r? `@compiler-errors` -errors
2025-08-02Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=AmanieuSamuel Tardieu-1/+1
Improve formatting of doc code blocks We don't currently apply automatic formatting to doc comment code blocks. As a result, it has built up various idiosyncracies, which make such automatic formatting difficult. Some of those idiosyncracies also make things harder for human readers or other tools. This PR makes a few improvements to doc code formatting, in the hopes of making future automatic formatting easier, as well as in many cases providing net readability improvements. I would suggest reading each commit separately, as each commit contains one class of changes.
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-9/+9
2025-07-31Make const bound handling more like types/regions.Nicholas Nethercote-1/+1
Currently there is `Ty` and `BoundTy`, and `Region` and `BoundRegion`, and `Const` and... `BoundVar`. An annoying inconsistency. This commit repurposes the existing `BoundConst`, which was barely used, so it's the partner to `Const`. Unlike `BoundTy`/`BoundRegion` it lacks a `kind` field but it's still nice to have because it makes the const code more similar to the ty/region code everywhere. The commit also removes `impl From<BoundVar> for BoundTy`, which has a single use and doesn't seem worth it. These changes fix the "FIXME: We really should have a separate `BoundConst` for consts".
2025-07-30expand WF obligations when checking method callsMichael Goulet-8/+8
2025-07-30Distinguish appending and replacing self ty in predicatesMichael Goulet-1/+1
2025-07-27check_static_item: explain should_check_for_sync choicesRalf Jung-1/+3
2025-07-27Rollup merge of #144226 - cjgillot:known-panics-panics, r=oli-obkMatthias Krüger-6/+8
Do not assert layout in KnownPanicsLint. Fixes rust-lang/rust#121176 Fixes rust-lang/rust#129109 Fixes rust-lang/rust#130970 Fixes rust-lang/rust#131347 Fixes rust-lang/rust#139872 Fixes rust-lang/rust#140332
2025-07-26Do not check Sync during type_of.Camille GILLOT-2/+5
2025-07-25Improve and regularize comment placement in doc codeJosh Triplett-1/+1
Because doc code does not get automatically formatted, some doc code has creative placements of comments that automatic formatting can't handle. Reformat those comments to make the resulting code support standard Rust formatting without breaking; this is generally an improvement to readability as well. Some comments are not indented to the prevailing indent, and are instead aligned under some bit of code. Indent them to the prevailing indent, and put spaces *inside* the comments to align them with code. Some comments span several lines of code (which aren't the line the comment is about) and expect alignment. Reformat them into one comment not broken up by unrelated intervening code. Some comments are placed on the same line as an opening brace, placing them effectively inside the subsequent block, such that formatting would typically format them like a line of that block. Move those comments to attach them to what they apply to. Some comments are placed on the same line as a one-line braced block, effectively attaching them to the closing brace, even though they're about the code inside the block. Reformat to make sure the comment will stay on the same line as the code it's commenting.
2025-07-25Check statics' type in type_of.Camille GILLOT-4/+3
2025-07-24Remove dead code and extend test coverage and diagnostics around itOli Scherer-9/+29
We lost the following comment during refactorings: The current code for niche-filling relies on variant indices instead of actual discriminants, so enums with explicit discriminants (RFC 2363) would misbehave.
2025-07-23atomicrmw on pointers: move integer-pointer cast hacks into backendRalf Jung-6/+6
2025-07-19rename `emit_unless` to `emit_unless_delay`xizheyin-7/+7
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>