about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
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 #137713 - vayunbiyani:fix-enzyme-build-errors, r=oli-obk许杰友 Jieyou Xu (Joe)-32/+10
Fix enzyme build errors After [this PR](https://github.com/rust-lang/rust/pull/136428) was merged, I switched to master and attempted building `./x.py build --stage 1 library` with the config mentioned in the enzyme rustbook but it resulted in some errors tho the config.example.toml build succeeded The errors were re: ### 1. Use of ref in match patterns The errors were related to match ergonomics in Rust 2024, where ref is no longer needed when matching on references. Examples: ``` error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:136:31 | 136 | Annotatable::Item(ref iitem) => { | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:136:13 | 136 | Annotatable::Item(ref iitem) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 136 - Annotatable::Item(ref iitem) => { 136 + Annotatable::Item(iitem) => { | error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:146:36 | 146 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:146:13 | 146 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 146 - Annotatable::AssocItem(ref assoc_item, _) => { 146 + Annotatable::AssocItem(assoc_item, _) => { | error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:174:31 | 174 | ... Annotatable::Item(ref iitem) => (iitem.vis.clone(), iitem.ide... | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:174:13 | 174 | ... Annotatable::Item(ref iitem) => (iitem.vis.clone(), iitem.ident.c... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 174 - Annotatable::Item(ref iitem) => (iitem.vis.clone(), iitem.ident.clone()), 174 + Annotatable::Item(iitem) => (iitem.vis.clone(), iitem.ident.clone()), | error: binding modifiers may only be written when the default binding mode is `move` --> compiler/rustc_builtin_macros/src/autodiff.rs:175:36 | 175 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> note: matching on a reference type with a non-reference pattern changes the default binding mode --> compiler/rustc_builtin_macros/src/autodiff.rs:175:13 | 175 | Annotatable::AssocItem(ref assoc_item, _) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: remove the unnecessary binding modifier | 175 - Annotatable::AssocItem(ref assoc_item, _) => { 175 + Annotatable::AssocItem(assoc_item, _) => { | error: could not compile `rustc_builtin_macros` (lib) due to 4 previous errors warning: build failed, waiting for other jobs to finish... Build completed unsuccessfully in 0:19:39 ``` ### 2. the use of external C blocks without unsafe in compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs (I don't have the error message handy) The first commit fixes the errors above --- ## Additional Improvement: `@ZuseZ4` suggested we consolidate the variants under `#[cfg(llvm_enzyme)]` and `#[cfg(not(llvm_enzyme))]` by conditionally checking for `cfg!(llvm_enzyme)` instead. This way, the autodiff code is compiled but not executed avoiding such regressions r? `@ZuseZ4` cc: `@oli-obk`
2025-02-28Rollup merge of #137712 - meithecatte:extract-binding-mode, r=oli-obk许杰友 Jieyou Xu (Joe)-44/+44
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-28Rollup merge of #137220 - ferrocene:pa-channel-ci, r=Kobzol许杰友 Jieyou Xu (Joe)-5/+15
Support `rust.channel = "auto-detect"` As [discussed in Zulip](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/vibe.20check.20for.20a.20few.20config.20changes), this PR adds the new `"auto-detect"` value for `rust.channel`, to load the channel name from `src/ci/channel`. Note that in a previous iteration of this PR the value was "ci" instead of "auto-detect".
2025-02-28Rollup merge of #136824 - lcnr:yeet, r=compiler-errors许杰友 Jieyou Xu (Joe)-456/+691
solver cycles are coinductive once they have one coinductive step Implements the new cycle semantics in the new solver, dealing with the fallout from https://github.com/rust-lang/trait-system-refactor-initiative/issues/10. The first commit has been extensively fuzzed via https://github.com/lcnr/search_graph_fuzz. A trait solver cycle is now coinductive if it has at least one *coinductive step*. A step is only considered coinductive if it's a where-clause of an impl of a coinductive trait. The only coinductive traits are `Sized` and auto traits. This differs from the current stable because where a cycle had to consist of exclusively coinductive goals. This is overly limiting and wasn't properly enforced as it (mostly) ignored all non-trait goals. A more in-depth explanation of my reasoning can be found in this separate doc: https://gist.github.com/lcnr/c49d887bbd34f5d05c36d1cf7a1bf5a5. A summary: - imagine using dictionary passing style: map where-bounds to additional "dictonary" fn arguments instead of monomorphization - impls are the only source of truth and introduce a *constructor* of the dictionary type - a trait goal holds if mapping its proof tree to dictionary passing style results in a valid corecursive function - a corecursive function is valid if it is guarded: matching on it should result in a constructor in a finite amount of time. This property should recursively hold for all fields of the constructor - a function is guarded if the recursive call is *behind* a constructor - **and** this constructor is not *moved out of*, e.g. by accessing a field of the dictionary - the "not moved out of" condition is difficult to guarantee in general, e.g. for item bounds of associated types. However, there is no way to *move out* of an auto trait as there is no information you can get from *the inside of* an auto trait bound in the trait system - if we encounter a cycle/recursive call which involves an auto trait, we can always convert the proof tree into a non-recursive function which calls a corecursive function whose first step is the construction of the auto trait dict and which only recursively depends on itself (by inlining the original function until they reach the uses of the auto trait) **we can therefore make any cycle during which we step into an auto trait (or `Sized`) impl coinductive** ---- To fix https://github.com/rust-lang/trait-system-refactor-initiative/issues/10 we could go with a more restrictive version which tries to restrict cycles to only allow code already supported on stable, potentially forcing cycles to be ambiguous if they step through an impl-where clause of a non-coinductive trait. `PathKind` should be a strictly ordered set to allow merging paths without worry. We could therefore add another variant `PathKind::ForceUnknown` which is greater than `PathKind::Coinductive`. We already have to add such a third `PathKind` in #137314 anyways. I am not doing this here due to multiple reasons: - I cannot think of a principled reason why cycles using an impl to normalize differ in any way from simply using that impl to prove a trait bound. It feels unnecessary and like it makes it more difficult to reason about our cycle semantics :< - This PR does not affect stable as coherence doesn't care about whether a goal holds or is ambiguous. So we don't yet have to make a final decision r? `@compiler-errors` `@nikomatsakis`
2025-02-28Rollup merge of #136424 - 11happy:overflow.hex.fix, r=fmease许杰友 Jieyou Xu (Joe)-5/+22
fix: overflowing bin hex **Overview:** - This PR fixes #135404. **Testing** - Tested the updated functionality. - previously emitted diagnostics: ```bash error: literal out of range for `i32` --> src/main.rs:2:9 | 2 | _ = 0x8FFF_FFFF_FFFF_FFFE; | ^^^^^^^^^^^^^^^^^^^^^ | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into the type `i32` and will become `-2i32` = help: consider using the type `i128` instead = note: `#[deny(overflowing_literals)]` on by default help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | 2 | _ = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` - current diagnostics: ```bash error: literal out of range for `i32` --> ../temp.rs:2:13 | 2 | let x = 0x8FFF_FFFF_FFFF_FFFE; | ^^^^^^^^^^^^^^^^^^^^^ | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into the type `i32` and will become `-2i32` = help: consider using the type `u64` instead = note: `#[deny(overflowing_literals)]` on by default help: to use as a negative number (decimal `-2`), consider using the type `u64` for the literal and cast it to `i32` | 2 | let x = 0x8FFF_FFFF_FFFF_FFFEu64 as i32; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
2025-02-28add test using only trait boundslcnr-0/+48
2025-02-28reviewlcnr-22/+36
2025-02-28add test for newly supported behaviorlcnr-0/+43
2025-02-28normalizing where-clauses is also coinductive, add testslcnr-20/+255
2025-02-28remove useless testslcnr-238/+0
they don't detect any bugs in the search graph. We instead check for these via `search_graph_fuzz`.
2025-02-28fix typolcnr-1/+1
2025-02-28fix rustc_type_ir without the nightly featurelcnr-1/+1
2025-02-28rework cycle handlinglcnr-182/+315
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-28Auto merge of #137753 - ChrisDenton:remove-sdk, r=Kobzolbors-3/+17
Remove latest Windows SDK from 32-bit CI This is an alternative to #137766, in case that doesn't work. It is in some ways simpler but is less principled and may be more flaky (as it involves deleting stuff). try-job: i686-msvc-1 try-job: i686-msvc-2 try-job: dist-i686-msvc
2025-02-28support rust.channel = "auto-detect"Pietro Albini-5/+15
2025-02-28Remove Win SDK 10.0.26100.0 from CIChris Denton-0/+14
2025-02-28Auto merge of #137710 - matthiaskrgr:rollup-3vmxxu9, r=matthiaskrgrbors-644/+1067
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-28fix: fix overflowing hex wrong suggestion11happy-5/+22
Signed-off-by: 11happy <soni5happy@gmail.com> rebase Signed-off-by: 11happy <soni5happy@gmail.com> fix: rebless Signed-off-by: 11happy <soni5happy@gmail.com>
2025-02-28Revert "Fix 32-bit MSVC CI"Chris Denton-3/+3
This reverts commit 6ea4823733254432aee255465177b8e53f01a79d.
2025-02-28Auto merge of #137669 - DianQK:fn-atts-virtual, r=saethlinbors-38/+123
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-27Auto merge of #137749 - Kobzol:fix-ci-2, r=Kobzolbors-3/+3
Fix 32-bit MSVC CI By throwing more hardware at it. The large runners should still use the old image. This could buy us a couple of... hours? Days? Who knows. See https://github.com/rust-lang/rust/issues/137733 for context. r? `@ghost` try-job: i686-msvc-1 try-job: i686-msvc-2 try-job: dist-i686-msvc
2025-02-27Fix 32-bit MSVC CIJakub Beránek-3/+3
By throwing more hardware at it.
2025-02-27switch #[cfg(not(llvm_enzyme))] to cfg!(llvm_enzyme)Vayun Biyani-26/+4
2025-02-27Clean up TypeckResults::extract_binding_modeMaja Kądziołka-44/+44
- 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 #137694 - aDotInTheVoid:aDotInTheVoid-patch-1, r=jdonszelmannMatthias Krüger-5/+8
Spruce up `AttributeKind` docs - Remove dead link to `rustc_attr` crate. - Add link to `rustc_attr_parsing` crate. - Split up first paragraph so it looks better at crate-level summary r? `@jdonszelmann`
2025-02-27Rollup merge of #137480 - fuzzypixelz:fix/124466, r=workingjubileeMatthias Krüger-1/+10
Return unexpected termination error instead of panicing in `Thread::join` There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes #124466.
2025-02-27Rollup merge of #137455 - compiler-errors:drop-lint-dtor, r=oli-obkMatthias Krüger-186/+425
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 #137304 - pitaj:rangebounds-is_empty-intersect, r=ibraheemdevMatthias Krüger-6/+137
add `IntoBounds::intersect` and `RangeBounds::is_empty` - ACP: https://github.com/rust-lang/libs-team/issues/539 - Tracking issue for `is_empty`: #137300 - Tracking issue for `IntoBounds`: #136903
2025-02-27Rollup merge of #136846 - nnethercote:make-AssocOp-more-like-ExprKind, ↵Matthias Krüger-374/+205
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-27Rollup merge of #136688 - fee1-dead-contrib:push-nppsusmpokqo, r=compiler-errorsMatthias Krüger-15/+200
require trait impls to have matching const stabilities as the traits This resolves https://github.com/rust-lang/project-const-traits/issues/5 by implementing the suggested solution in the given thread r? ``@RalfJung`` cc ``@rust-lang/project-const-traits``
2025-02-27Rollup merge of #136579 - bjorn3:fix_thinvec_ext_ub, r=BoxyUwUMatthias Krüger-17/+25
Fix UB in ThinVec::flat_map_in_place `thin_vec.as_ptr()` goes through the `Deref` impl of `ThinVec`, which will not allow access to any memory as we did call `set_len(0)` first. Found in the process of investigating https://github.com/rust-lang/rust/issues/135870.
2025-02-27Rollup merge of #136542 - jieyouxu:build-base, r=onur-ozkanMatthias Krüger-40/+57
[`compiletest`-related cleanups 4/7] Make the distinction between root build directory vs test suite specific build directory in compiletest less confusing Reference for overall changes: https://github.com/rust-lang/rust/pull/136437 Part **4** of **7** of the *`compiletest`-related cleanups* PR series. ### Summary - Remove `--build-base` compiletest flag, and introduce `--build-{root,test-suite-root}` flags instead. `--build-base` previously actually is test suite specific build directory, not the root `build/` directory. - Feed the root build directory directly from bootstrap to compiletest via `--build-root` instead of doing multiple layers of parent unwrapping[^parent] based on the test suite specific build directory. - Remove a redundant `to_path_buf()`. [^parent]: Please do not unwrap the parents. r? bootstrap
2025-02-27Don't infer unwinding of virtual calls based on the function attributesDianQK-6/+32
2025-02-27Don't infer attributes of virtual calls based on the function bodyDianQK-60/+52
2025-02-27require trait impls to have matching const stabilities as the traitsDeadbeef-15/+200
2025-02-27Auto merge of #132295 - the8472:remove-randomize-exclusion1, r=onur-ozkanbors-3/+2
fixed wast version was released, remove randomization exemption
2025-02-27Rename `AssocOp::As` as `AssocOp::Cast`.Nicholas Nethercote-16/+16
To match `ExprKind::Cast`, and because a semantic name makes more sense here than a syntactic name.
2025-02-27Replace `AssocOp::DotDot{,Eq}` with `AssocOp::Range`.Nicholas Nethercote-43/+32
It makes `AssocOp` more similar to `ExprKind` and makes things a little simpler. And the semantic names make more sense here than the syntactic names.
2025-02-27Introduce `AssocOp::Binary`.Nicholas Nethercote-256/+152
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-27In `AssocOp::AssignOp`, use `BinOpKind` instead of `BinOpToken`Nicholas Nethercote-77/+23
`AssocOp::AssignOp` contains a `BinOpToken`. `ExprKind::AssignOp` contains a `BinOpKind`. Given that `AssocOp` is basically a cut-down version of `ExprKind`, it makes sense to make `AssocOp` more like `ExprKind`. Especially given that `AssocOp` and `BinOpKind` use semantic operation names (e.g. `Mul`, `Div`), but `BinOpToken` uses syntactic names (e.g. `Star`, `Slash`). This results in more concise code, and removes the need for various conversions. (Note that the removed functions `hirbinop2assignop` and `astbinop2assignop` are semantically identical, because `hir::BinOp` is just a synonum for `ast::BinOp`!) The only downside to this is that it allows the possibility of some nonsensical combinations, such as `AssocOp::AssignOp(BinOpKind::Lt)`. But `ExprKind::AssignOp` already has that problem. The problem can be fixed for both types in the future with some effort, by introducing an `AssignOpKind` type.
2025-02-26Spruce up `AttributeKind` docsAlona Enraght-Moony-5/+8
- Remove dead link to `rustc_attr` crate. - Add link to `rustc_attr_parsing` crate. - Split up first paragraph so it looks better at crate-level summary
2025-02-26Auto merge of #137688 - fmease:rollup-gbeuj9j, r=fmeasebors-327/+699
Rollup of 10 pull requests Successful merges: - #134585 (remove `MaybeUninit::uninit_array`) - #136187 (Use less CString in the examples of CStr.) - #137201 (Teach structured errors to display short `Ty<'_>`) - #137620 (Fix `attr` cast for espidf) - #137631 (Avoid collecting associated types for undefined trait) - #137635 (Don't suggest constraining unstable associated types) - #137642 (Rustc dev guide subtree update) - #137660 (Update gcc submodule) - #137670 (revert accidental change in get_closest_merge_commit) - #137671 (Make -Z unpretty=mir suggest -Z dump-mir as well for discoverability) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-26Print out destructorMichael Goulet-186/+425
2025-02-26Rollup merge of #137671 - meithecatte:discoverable-dump-mir, r=NadrierilLeón Orell Valerian Liehr-0/+2
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 #137670 - RalfJung:llvm-commit-logic-revert, r=KobzolLeón Orell Valerian Liehr-0/+1
revert accidental change in get_closest_merge_commit This was accidentally merged as part of https://github.com/rust-lang/rust/pull/137594. I need this local diff to be able to debug miri syncs, and then typed `git commit -a` too fast and didn't realize it includes this change... sorry for that. r? ``@Kobzol``
2025-02-26Rollup merge of #137660 - Kobzol:gcc-update, r=GuillaumeGomezLeón Orell Valerian Liehr-0/+0
Update gcc submodule To add support for the x87 feature (see https://github.com/rust-lang/rust/pull/137612#issuecomment-2683303111). r? `@antoyo`
2025-02-26Rollup merge of #137642 - BoxyUwU:rdg-push, r=KobzolLeón Orell Valerian Liehr-27/+121
Rustc dev guide subtree update r? ``@Kobzol`` ``@jieyouxu``
2025-02-26Rollup merge of #137635 - compiler-errors:constrain-unstable, r=SparrowLiiLeón Orell Valerian Liehr-1/+33
Don't suggest constraining unstable associated types Fixes #137624 This could be made a bit more specific, considering the local crate's stability or nightly status or something, but I think in general we should not be suggesting associated type bounds on unstable associated items.