about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2025-03-03Rollup merge of #137894 - compiler-errors:no-scalar-pair-opt, r=oli-obkMatthias Krüger-1/+1
Revert "store ScalarPair via memset when one side is undef and the other side can be memset" cc #137892 reverts #135335 r? oli-obk
2025-03-03Rollup merge of #137863 - compiler-errors:unsafe-binder-render, r=oli-obkMatthias Krüger-37/+71
Fix pretty printing of unsafe binders We used to render `unsafe<> i32` as `i32`, and `unsafe<'a> &'a i32` as `for<'a> &'a i32`. r? oli-obk Review with whitespace b/c adding a new argument changes some the wrapping of some function calls.
2025-03-03Remove some unnecessary aliases from `rustc_data_structures::sync`Zalathar-1/+2
With the removal of `cfg(parallel_compiler)`, these are always shared references and `std::sync::OnceLock`.
2025-03-02Simplify `<Postorder as Iterator>::size_hint`Scott McMurray-11/+6
The current version is wrong (cc 137919); let's see if we can get away with a loose but trivially-correct one.
2025-03-03interpret/provenance_map: consistently use range_is_emptyRalf Jung-22/+22
2025-03-03Rename a bitMichael Goulet-15/+6
2025-03-03Fix pretty printing of unsafe bindersMichael Goulet-37/+80
2025-03-02Auto merge of #137704 - nnethercote:opt-empty-prov-range-checks, r=oli-obkbors-10/+27
Optimize empty provenance range checks. Currently it gets the pointers in the range and checks if the result is empty, but it can be done faster if you combine those two steps. r? `@oli-obk`
2025-03-02Revert "Auto merge of #135335 - oli-obk:push-zxwssomxxtnq, r=saethlin"Michael Goulet-1/+1
This reverts commit a7a6c64a657f68113301c2ffe0745b49a16442d1, reversing changes made to ebbe63891f1fae21734cb97f2f863b08b1d44bf8.
2025-03-01Rollup merge of #137837 - fee1-dead-contrib:push-pvqvwuvrnwsy, r=compiler-errorsMatthias Krüger-0/+14
Update `const_conditions` and `explicit_implied_const_bounds` docs Move documentation to query definitions, and add docs to `explicit_implied_const_bounds`. r? project-const-traits
2025-03-01Rollup merge of #137800 - BoxyUwU:param_env_docs, r=compiler-errorsMatthias Krüger-6/+0
Remove `ParamEnv::without_caller_bounds` This doesn't really do anything that `ParamEnv::empty` doesn't do nowadays as `ParamEnv` *only* stores caller bounds since other information has been moved out into `TypingMode` r? ```@compiler-errors``` ```@lcnr```
2025-03-01Rollup merge of #137763 - compiler-errors:ty-nits, r=BoxyUwUMatthias Krüger-2/+2
Use `mk_ty_from_kind` a bit less, clean up lifetime handling in borrowck r? ``@BoxyUwU`` Pulled out of my attempt to turn that `*const dyn Tr + '_` casting into a lint (which failed lmao)
2025-03-01Rollup merge of #137617 - BoxyUwU:generic_const_parameter_types, r=lcnrMatthias Krüger-0/+1
Introduce `feature(generic_const_parameter_types)` Allows to define const generic parameters whose type depends on other generic parameters, e.g. `Foo<const N: usize, const ARR: [u8; N]>;` Wasn't going to implement for this for a while until we could implement it with `bad_inference.rs` resolved but apparently the project simd folks would like to be able to use this for some intrinsics and the inference issue isn't really a huge problem there aiui. (cc ``@workingjubilee`` )
2025-03-01Update `const_conditions` and `explicit_implied_const_bounds` docsDeadbeef-0/+14
Move documentation to query definitions, and add docs to `explicit_implied_const_bounds`.
2025-03-01Rollup merge of #137689 - compiler-errors:coroutine, r=lcnrMatthias Krüger-43/+29
Use `Binder<Vec<Ty>>` instead of `Vec<Binder<Ty>>` in both solvers for sized/auto traits/etc. It's more conceptually justified IMO, especially when binders get implications. r? lcnr
2025-02-28Introduce `feature(generic_const_parameter_types)`Boxy-0/+1
2025-02-28Rollup merge of #137780 - samueltardieu:push-kxorztnkqnsz, r=lcnr许杰友 Jieyou Xu (Joe)-1/+1
Fix typo in query expansion documentation
2025-02-28Rollup merge of #137748 - samueltardieu:push-kozpqrxpkxkk, r=lqd许杰友 Jieyou Xu (Joe)-3/+3
Fix method name in `TyCtxt::hir_crate()` documentation Fix #137745
2025-02-28Rollup merge of #137712 - meithecatte:extract-binding-mode, r=oli-obk许杰友 Jieyou Xu (Joe)-2/+4
Clean up TypeckResults::extract_binding_mode - Remove the `Option` from the result type, as `None` is never returned. - Document the difference from the `BindingMode` in `PatKind::Binding`.
2025-02-28reviewlcnr-14/+0
2025-02-28rework cycle handlinglcnr-4/+6
A cycle was previously coinductive if all steps were coinductive. Change this to instead considerm cycles to be coinductive if they step through at least one where-bound of an impl of a coinductive trait goal.
2025-02-28Fix typo in query expansion documentationSamuel Tardieu-1/+1
2025-02-28Auto merge of #137710 - matthiaskrgr:rollup-3vmxxu9, r=matthiaskrgrbors-4/+174
Rollup of 8 pull requests Successful merges: - #136542 ([`compiletest`-related cleanups 4/7] Make the distinction between root build directory vs test suite specific build directory in compiletest less confusing) - #136579 (Fix UB in ThinVec::flat_map_in_place) - #136688 (require trait impls to have matching const stabilities as the traits) - #136846 (Make `AssocOp` more like `ExprKind`) - #137304 (add `IntoBounds::intersect` and `RangeBounds::is_empty`) - #137455 (Reuse machinery from `tail_expr_drop_order` for `if_let_rescope`) - #137480 (Return unexpected termination error instead of panicing in `Thread::join`) - #137694 (Spruce up `AttributeKind` docs) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-28Use mk_ty_from_kind a bit less, clean up lifetime handling in borrowckMichael Goulet-2/+2
2025-02-28Auto merge of #137669 - DianQK:fn-atts-virtual, r=saethlinbors-2/+3
Don't infer attributes of virtual calls based on the function body Fixes (after backport) #137646. Since we don't know the exact implementation of the virtual call, it might write to parameters, we can't infer the readonly attribute.
2025-02-27Fix method name in `TyCtxt::hir_crate()` documentationSamuel Tardieu-3/+3
2025-02-27Add note to Thir struct about necessity of Clone deriveNiels Saurer-0/+3
2025-02-27Revert "Derive `Clone` on fewer THIR types."Niels Saurer-22/+22
This reverts commit f0b6d660c9c13ab7b19da9e12aeb4dcab45e544b.
2025-02-27Clean up TypeckResults::extract_binding_modeMaja Kądziołka-2/+4
- Remove the `Option` from the result type, as `None` is never returned. - Document the difference from the `BindingMode` in `PatKind::Binding`.
2025-02-27Rollup merge of #137455 - compiler-errors:drop-lint-dtor, r=oli-obkMatthias Krüger-0/+173
Reuse machinery from `tail_expr_drop_order` for `if_let_rescope` Namely, it defines its own `extract_component_with_significant_dtor` which is a bit more accurate than `Ty::has_significant_drop`, since it has a hard-coded list of types from the ecosystem which are opted out of the lint.[^a] Also, since we extract the dtors themselves, adopt the same *label* we use in `tail_expr_drop_order` to point out the destructor impl. This makes it much clear what's actually being dropped, so it should be clearer to know when it's a false positive. This conflicts with #137444, but I will rebase whichever lands first. [^a]: Side-note, it's kinda a shame that now there are two functions that presumably do the same thing. But this isn't my circus, nor are these my monkeys.
2025-02-27Rollup merge of #136846 - nnethercote:make-AssocOp-more-like-ExprKind, ↵Matthias Krüger-4/+1
r=spastorino Make `AssocOp` more like `ExprKind` This is step 1 of [MCP 831](https://github.com/rust-lang/compiler-team/issues/831). r? ``@estebank``
2025-02-27Optimize empty provenance range checks.Nicholas Nethercote-10/+27
Currently it gets the pointers in the range and checks if the result is empty, but it can be done faster if you combine those two steps.
2025-02-27Don't infer attributes of virtual calls based on the function bodyDianQK-2/+3
2025-02-27Always inline `query_get_at`.Nicholas Nethercote-1/+1
2025-02-27Introduce `AssocOp::Binary`.Nicholas Nethercote-4/+1
It mirrors `ExprKind::Binary`, and contains a `BinOpKind`. This makes `AssocOp` more like `ExprKind`. Note that the variants removed from `AssocOp` are all named differently to `BinOpToken`, e.g. `Multiply` instead of `Mul`, so that's an inconsistency removed. The commit adds `precedence` and `fixity` methods to `BinOpKind`, and calls them from the corresponding methods in `AssocOp`. This avoids the need to create an `AssocOp` from a `BinOpKind` in a bunch of places, and `AssocOp::from_ast_binop` is removed. `AssocOp::to_ast_binop` is also no longer needed. Overall things are shorter and nicer.
2025-02-26Remove `ParamEnv::without_caller_bounds`Boxy-6/+0
2025-02-26Print out destructorMichael Goulet-0/+173
2025-02-26Rollup merge of #137671 - meithecatte:discoverable-dump-mir, r=NadrierilLeón Orell Valerian Liehr-0/+1
Make -Z unpretty=mir suggest -Z dump-mir as well for discoverability While debugging something else, I got quite annoyed with `-Z unpretty=mir` showing me post-processed MIR instead of the one just after it is built. I ended up asking on Zulip and got pointed to `-Z dump-mir`. While this feature is documented in the rustc dev guide, I think it'd be good if the possibility of making use of it was staring you in the face while you need it.
2025-02-26Rollup merge of #137201 - estebank:structured-errors-long-ty, r=oli-obkLeón Orell Valerian Liehr-31/+49
Teach structured errors to display short `Ty<'_>` Make it so that in every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to. ``` error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)`` --> long.rs:7:5 | 6 | fn foo(x: D) { //~ `x` has type `(... | - `x` has type `((..., ..., ..., ...), ..., ..., ...)` 7 | x(); //~ ERROR expected function, found `(... | ^-- | | | call expression requires function | = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt' = note: consider using `--verbose` to print the full type name to the console ``` Follow up to and response to the comments on #136898. r? ``@oli-obk``
2025-02-26Use bound_coroutine_witnesses in old solverMichael Goulet-20/+3
2025-02-26Use Binder<Vec<T>> instead of Vec<Binder<T>> in new solverMichael Goulet-23/+26
2025-02-26Auto merge of #137354 - FractalFir:intern_with_cap, r=FractalFirbors-24/+30
Change interners to start preallocated with an increased capacity Inspired by https://github.com/rust-lang/rust/issues/137005. Added a `with_capacity` function to `InternedSet`. Changed the `CtxtInterners` to start with `InternedSets` preallocated with a capacity. This *does* increase memory usage at very slightly(by ~1 MB at the start), altough that increase quickly disaperars for larger crates(since they require such capacity anyway). A local perf run indicates this improves compiletimes for small crates(like `ripgrep`), without a negative effect on larger ones.
2025-02-26Make -Z unpretty=mir suggest -Z dump-mir as wellMaja Kądziołka-0/+1
2025-02-26Rollup merge of #137601 - davidtwco:deduplicate-type-has-metadata, ↵León Orell Valerian Liehr-0/+14
r=fmease,bjorn3 ssa/mono: deduplicate `type_has_metadata` The implementation of the `type_has_metadata` function is duplicated in `rustc_codegen_ssa` and `rustc_monomorphize`, so move this to `rustc_middle`.
2025-02-26Rollup merge of #137529 - klensy:unused3, r=lcnrLeón Orell Valerian Liehr-7/+1
remove few unused args
2025-02-25Teach structured errors to display short `Ty`Esteban Küber-31/+49
Make it so that every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to. ``` error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)`` --> long.rs:7:5 | 6 | fn foo(x: D) { //~ `x` has type `(... | - `x` has type `((..., ..., ..., ...), ..., ..., ...)` 7 | x(); //~ ERROR expected function, found `(... | ^-- | | | call expression requires function | = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt' = note: consider using `--verbose` to print the full type name to the console ```
2025-02-25remove unused field from VariantDef::new and convert debug to instrumentklensy-7/+1
2025-02-25Auto merge of #137571 - tgross35:rollup-i1tcnv1, r=tgross35bors-1/+0
Rollup of 8 pull requests Successful merges: - #134655 (Stabilize `hash_extract_if`) - #135933 (Explain how Vec::with_capacity is faithful) - #136668 (Stabilize `core::str::from_utf8_mut` as `const`) - #136775 (Update `String::from_raw_parts` safety requirements) - #137109 (stabilize extract_if) - #137349 (Implement `read_buf` for zkVM stdin) - #137493 (configure.py: don't instruct user to run nonexistent program) - #137516 (remove some unnecessary rustc_const_unstable) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-25Auto merge of #137573 - compiler-errors:rollup-noq9yhp, r=compiler-errorsbors-7/+6
Rollup of 11 pull requests Successful merges: - #136522 (Remove `feature(dyn_compatible_for_dispatch)` from the compiler) - #137289 (Consolidate and improve error messaging for `CoerceUnsized` and `DispatchFromDyn`) - #137321 (Correct doc about `temp_dir()` behavior on Android) - #137417 (rustc_target: Add more RISC-V atomic-related features) - #137489 (remove `#[rustc_intrinsic_must_be_overridde]`) - #137530 (DWARF mixed versions with LTO on MIPS) - #137543 (std: Fix another new symlink test on Windows) - #137548 (Pass correct `TypingEnv` to `InlineAsmCtxt`) - #137550 (Don't immediately panic if dropck fails without returning errors) - #137552 (Update books) - #137556 (rename simd_shuffle_generic → simd_shuffle_const_generic) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-24Rollup merge of #137489 - ↵Michael Goulet-7/+6
RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In https://github.com/rust-lang/rust/pull/135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`