about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2025-09-26Fix expand rest pattern in tuple and slice patternA4-Tacks-19/+289
Assist: expand_tuple_rest_pattern Fills fields by replacing rest pattern in tuple patterns. Example --- ``` fn foo(bar: (char, i32, i32)) { let (ch, ..$0) = bar; } ``` -> ``` fn foo(bar: (char, i32, i32)) { let (ch, _1, _2) = bar; } ``` --- Assist: expand_slice_rest_pattern Fills fields by replacing rest pattern in slice patterns. Example --- ``` fn foo(bar: [i32; 3]) { let [first, ..$0] = bar; } ``` -> ``` fn foo(bar: [i32; 3]) { let [first, _1, _2] = bar; } ```
2025-09-26Merge pull request #20598 from A4-Tacks/let-chain-sup-conv-to-guarded-retShoyu Vanilla (Flint)-45/+252
Add let-chain support for convert_to_guarded_return
2025-09-26Merge pull request #20736 from A4-Tacks/fix-invert-if-let-chainShoyu Vanilla (Flint)-4/+13
Fix applicable on if-let-chain for invert_if
2025-09-26Merge pull request #20742 from A4-Tacks/unused-raw-varShoyu Vanilla (Flint)-2/+16
Fix fixes for unused raw variables
2025-09-26Auto merge of #145882 - m-ou-se:format-args-extend-1-arg, r=petrochenkovbors-22/+38
Extended temporary argument to format_args!() in all cases Fixes https://github.com/rust-lang/rust/issues/145880 by removing the special case.
2025-09-25fix transcriber error in declarative macros for negative integer literal ↵Oblarg-1/+110
const generic params
2025-09-25Auto merge of #147037 - matthiaskrgr:rollup-xtgqzuu, r=matthiaskrgrbors-0/+10
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-25resolve: Do not finalize shadowed bindingsVadim Petrochenkov-7/+4
I.e. do not mark them as used, or non-speculative loaded, or similar. Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
2025-09-25Rollup merge of #141032 - petrosagg:extract-if-ub, r=joboetMatthias Krüger-0/+10
avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if` The implementation of the `Vec::extract_if` iterator violates the safety contract adverized by `slice::from_raw_parts` by always constructing a mutable slice for the entire length of the vector even though that span of memory can contain holes from items already drained. The safety contract of `slice::from_raw_parts` requires that all elements must be properly initialized. As an example we can look at the following code: ```rust let mut v = vec![Box::new(0u64), Box::new(1u64)]; for item in v.extract_if(.., |x| **x == 0) { drop(item); } ``` In the second iteration a `&mut [Box<u64>]` slice of length 2 will be constructed. The first slot of the slice contains the bitpattern of an already deallocated box, which is invalid. This fixes the issue by only creating references to valid items and using pointer manipulation for the rest. I have also taken the liberty to remove the big `unsafe` blocks in place of targetted ones with a SAFETY comment. The approach closely mirrors the implementation of `Vec::retain_mut`. **Note to reviewers:** The diff is easier to follow with whitespace hidden.
2025-09-25Add applicable in closure for convert_to_guarded_returnA4-Tacks-5/+49
Example --- ```rust fn main() { let _f = || { bar(); if$0 true { foo(); // comment bar(); } } } ``` -> ```rust fn main() { let _f = || { bar(); if false { return; } foo(); // comment bar(); } } ```
2025-09-25Fix not applicable for if-expr in let-stmtA4-Tacks-6/+28
Example --- ```rust fn main() { let _x = loop { if$0 let Ok(x) = Err(92) { foo(x); } }; } ``` **Before**: Assist not applicable **After**: ```rust fn main() { let _x = loop { let Ok(x) = Err(92) else { continue }; foo(x); }; } ```
2025-09-25Add let-chain support for convert_to_guarded_returnA4-Tacks-38/+179
- And add early expression `None` in function `Option` return Example --- ```rust fn main() { if$0 let Ok(x) = Err(92) && x < 30 && let Some(y) = Some(8) { foo(x, y); } } ``` -> ```rust fn main() { let Ok(x) = Err(92) else { return }; if x >= 30 { return; } let Some(y) = Some(8) else { return }; foo(x, y); } ```
2025-09-25Fix fixes for unused raw variablesA4-Tacks-2/+16
Example --- ``` fn main() { let $0r#type = 2; } ``` **Before this PR**: ```rust fn main() { let _r#type = 2; } ``` **After this PR**: ```rust fn main() { let _type = 2; } ```
2025-09-25Rollup merge of #146735 - Qelxiros:const_mul_add, r=tgross35,RalfJungStuart Cook-41/+5
unstably constify float mul_add methods Tracking issue: rust-lang/rust#146724 r? `@tgross35`
2025-09-25Rollup merge of #145973 - vexide:vex-std, r=tgross35Stuart Cook-0/+1
Add `std` support for `armv7a-vex-v5` This PR adds standard library support for the VEX V5 Brain (`armv7a-vex-v5` target). It is more-or-less an updated version of the library-side work done in rust-lang/rust#131530. This was a joint effort between me, `@lewisfm,` `@max-niederman,` `@Gavin-Niederman` and several other members of the [`vexide` project](https://github.com/vexide/). ## Background VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as `std::net`, `std::process`, and most of `std::thread`). A more comprehensive list of what does or doesn't work is outlined in the [updated target documentation](https://github.com/vexide/rust/blob/vex-std/src/doc/rustc/src/platform-support/armv7a-vex-v5.md). Despite these limitations, we believe that `libstd` support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see [this comment](https://github.com/rust-lang/rust/pull/131530#issuecomment-2432856841). ## SDK Linkage VEXos doesn't really ship with an official `libc` or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of the `armv6k-nintendo-3ds` team's work in rust-lang/rust#95897, we've opted not to directly link `libstd` to any SDK with the expectation that users will provide their own with one of the following options: - [`vex-sdk-download`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-download), which downloads an official proprietary SDK from VEX using a build script. - [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable), which is a compatible, open-source reimplementation of the SDK using firmware jumps. - [`vex-sdk-pros`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-pros), which uses the [PROS kernel](https://github.com/purduesigbots/pros) as a provider for SDK functions. - Linking their own implementation or stubbing the functions required by libstd. The `vex-sdk` crate used in the VEXos PAL provides `libc`-style FFI bindings for any compatible system library, so any of these options *should* work fine. A functional demo project using `vex-sdk-download` can be found [here](https://github.com/vexide/armv7a-vex-v5-demo/tree/main). ## Future Work This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently [gross enough](https://github.com/vexide/vexide/blob/c6c5bad11e035cf4e51d429dca7e427210185ed4/packages/vexide-core/src/fs/mod.rs#L987) to drive us away from supporting this officially. Additionally, I have a working branch implementing the `panic_unwind` runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.
2025-09-25Merge pull request #20738 from jackh726/next-trait-solver-next4Shoyu Vanilla (Flint)-127/+97
Remove non-ns version of impl_self_ty and impl_trait
2025-09-25Merge pull request #20735 from itsjunetime/fix_scip_salsaShoyu Vanilla (Flint)-1/+1
fix SCIP panicking due to salsa not attaching
2025-09-25Install cargo for proc-macro-srv testsLaurențiu Nicola-2/+2
2025-09-25Auto merge of #146981 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo submodule 17 commits in 966f94733bbc94ca51ff9f1e4c49ad250ebbdc50..f2932725b045d361ff5f18ba02b1409dd1f44e71 2025-09-16 17:24:45 +0000 to 2025-09-24 11:31:26 +0000 - fix: use `host-tuple` for host target subsitution (rust-lang/cargo#16003) - test(build-std): move away from panic_immediate_abort (rust-lang/cargo#16006) - fix: Sparse URLs in `TomlLockfileSourceId` (rust-lang/cargo#15990) - refactor(gctx): extract toml dotted keys validation (rust-lang/cargo#15998) - feat: Add lint for global use of `hint-mostly-unused` (rust-lang/cargo#15995) - Make GlobalContext Sync (rust-lang/cargo#15967) - chore(deps): update cargo-semver-checks to v0.44.0 (rust-lang/cargo#15993) - fix(frontatter): Only allow horizontal whitespace after fences (rust-lang/cargo#15975) - docs: Add Lockfile schemas docs (rust-lang/cargo#15989) - Add parallel frontend to the build performance guide (rust-lang/cargo#15970) - chore(deps): update msrv (3 versions) to v1.88 (rust-lang/cargo#15988) - chore(deps): update msrv (1 version) to v1.90 (rust-lang/cargo#15984) - feat(cargo-util-schemas): Move lockfile schemas (rust-lang/cargo#15980) - Clarify multiple version requirement behavior (rust-lang/cargo#15979) - Adds ghostty as supported terminal for term integration (OSC 9;4) (rust-lang/cargo#15977) - docs(team): Fixed broken office hours link (rust-lang/cargo#15976) - docs: Clarify git sources vs git registries in source replacement documentation (rust-lang/cargo#15974) r? ghost
2025-09-25Also install rustfmt on stableLaurențiu Nicola-3/+3
2025-09-25Merge ref 'caccb4d0368b' from rust-lang/rustThe rustc-josh-sync Cronjob Bot-10361/+24181
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: caccb4d0368bd918ef6668af8e13834d07040417 Filtered ref: 0f345ed05d559bbfb754f1403b16199366cda2e0 Upstream diff: https://github.com/rust-lang/rust/compare/21a19c297d4f5a03501d92ca251bd7a17073c08a...caccb4d0368bd918ef6668af8e13834d07040417 This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-25Prepare for merging from rust-lang/rustThe rustc-josh-sync Cronjob Bot-1/+1
This updates the rust-version file to caccb4d0368bd918ef6668af8e13834d07040417.
2025-09-24fix SCIP panicking due to salsa not attachingitsjunetime-1/+1
2025-09-24unstably constify float mul_add methodsJeremy Smart-41/+5
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-09-24Rollup merge of #146969 - RalfJung:maybe-null-errors, r=oli-obkMatthias Krüger-1/+1
const-eval: better wording for errors involving maybe-null pointers Fixes https://github.com/rust-lang/rust/issues/146748 r? ``@oli-obk``
2025-09-24Rollup merge of #146932 - ShoyuVanilla:ra-in-tree-hack, r=lcnrMatthias Krüger-40/+5
Switch next-solver related rustc dependencies of r-a to crates.io ones r? ``@ghost`` cc ``@lnicola`` ``@lcnr``
2025-09-24Implement fallback properlyChayim Refael Friedman-230/+770
fallback.rs was ported straight from rustc (minus the lint parts). This fixes the `!` regressions.
2025-09-24Merge pull request #20683 from regexident/inference-result-types-iterChayim Refael Friedman-0/+20
Expose iterators over an inference result's types
2025-09-24std: add support for armv7a-vex-v5 targetTropical-0/+1
Co-authored-by: Lewis McClelland <lewis@lewismcclelland.me>
2025-09-24Update cargo submoduleWeihang Lo-0/+0
2025-09-24Switch next-solver related rustc dependencies of r-a to crates.io onesShoyu Vanilla-40/+5
2025-09-24const validation: better error for maybe-null referencesRalf Jung-1/+1
2025-09-24Fix applicable on if-let-chain for invert_ifA4-Tacks-4/+13
Example --- ```rust fn f() { i$0f x && let Some(_) = Some(1) { 1 } else { 0 } } ``` **Before this PR**: ```rust fn f() { if !(x && let Some(_) = Some(1)) { 0 } else { 1 } } ``` **After this PR**: Assist not applicable
2025-09-24Remove non-ns version of impl_self_ty and impl_traitjackh726-127/+97
2025-09-24Merge pull request #20733 from jackh726/next-trait-solver-next3Shoyu Vanilla (Flint)-528/+461
Convert more things from chalk to next solver
2025-09-23Auto merge of #146931 - RalfJung:miri, r=RalfJungbors-444/+370
miri subtree update Subtree update of `miri` to https://github.com/rust-lang/miri/commit/f6466ce655ff6b203de81ba6f4cbfe8d8dd6756f. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
2025-09-23Be sure to instantiate and pass up trait refs in ↵Jack Huey-12/+15
named_associated_type_shorthand_candidates
2025-09-23Remove all non-ns diagnostics queries, naming consistenlyJack Huey-154/+90
2025-09-23Use lower_nextsolver::callable_item_signature instead of ↵Jack Huey-141/+188
lower::callable_item_signature
2025-09-23Rollup merge of #146784 - dpaoliello:findmsvc, r=wesleywiserMatthias Krüger-0/+1
[win] Use find-msvc-tools instead of cc to find the linker and rc on Windows `find-msvc-tools` was factored out from `cc` to allow updating the use in `rustc_codegen_ssa` (finding the linker when running the Rust compiler) and `rustc_windows_rc` (finding the Windows Resource Compiler when running the Rust compiler) to be separate from the use in `rustc_llvm` (building LLVM as part of building the Rust compiler).
2025-09-23Rollup merge of #146731 - Muscraft:svg-test-terminal-url, r=jdonszelmannMatthias Krüger-1/+1
test: Use SVG for terminal url test I came across the test for `-Zterminal-urls` and found its output a bit hard to read. So, I decided to switch it to an SVG test, as I found it easier to differentiate the link and link text. Note: `anstyle-svg` needed to be upgraded to at least `0.1.8` to support links in SVGs, so I went ahead and upgraded it to the latest version (`0.1.11`).
2025-09-23Merge pull request #20543 from sgasho/fix/19443_replace_match_with_if_letShoyu Vanilla (Flint)-1/+23
Fix "Replace match with if let" not to trigger when invalid transformations occur
2025-09-23Expose iterators over an inference result's typesVincent Esche-0/+20
(This re-introduces a reduced access to a couple of previously public fields on `InferenceResult`)
2025-09-23Remove lower::value_ty in favor of lower_nextsolver::value_tyJack Huey-134/+61
2025-09-23Remove lower::ty in favor of lower_nextsolver::tyJack Huey-92/+112
2025-09-23Merge ref 'f6092f224d2b' from rust-lang/rustRalf Jung-9836/+39450
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: f6092f224d2b1774b31033f12d0bee626943b02f Filtered ref: f843cd4f29bdcd8d474dbb9e5e4365eb7f263ec6 This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-23Prepare for merging from rust-lang/rustRalf Jung-1/+1
This updates the rust-version file to f6092f224d2b1774b31033f12d0bee626943b02f.
2025-09-23Merge pull request #20730 from A4-Tacks/migrate-expand-rest-patShoyu Vanilla (Flint)-12/+11
Migrate `expand_record_rest_pattern` assist to use `SyntaxEditor`
2025-09-23Auto merge of #146317 - saethlin:panic=immediate-abort, r=nnethercotebors-7/+35
Add panic=immediate-abort MCP: https://github.com/rust-lang/compiler-team/issues/909 This adds a new panic strategy, `-Cpanic=immediate-abort`. This panic strategy essentially just codifies use of `-Zbuild-std-features=panic_immediate_abort`. This PR is intended to just set up infrastructure, and while it will change how the compiler is invoked for users of the feature, there should be no other impacts. In many parts of the compiler, `PanicStrategy::ImmediateAbort` behaves just like `PanicStrategy::Abort`, because actually most parts of the compiler just mean to ask "can this unwind?" so I've added a helper function so we can say `sess.panic_strategy().unwinds()`. The panic and unwind strategies have some level of compatibility, which mostly means that we can pre-compile the sysroot with unwinding panics then the sysroot can be linked with aborting panics later. The immediate-abort strategy is all-or-nothing, enforced by `compiler/rustc_metadata/src/dependency_format.rs` and this is tested for in `tests/ui/panic-runtime/`. We could _technically_ be more compatible with the other panic strategies, but immediately-aborting panics primarily exist for users who want to eliminate all the code size responsible for the panic runtime. I'm open to other use cases if people want to present them, but not right now. This PR is already large. `-Cpanic=immediate-abort` sets both `cfg(panic = "immediate-abort")` _and_ `cfg(panic = "abort")`. bjorn3 pointed out that people may be checking for the abort cfg to ask if panics will unwind, and also the sysroot feature this is replacing used to require `-Cpanic=abort` so this seems like a good back-compat step. At least for the moment. Unclear if this is a good idea indefinitely. I can imagine this being confusing. The changes to the standard library attributes are purely mechanical. Apart from that, I removed an `unsafe` we haven't needed for a while since the `abort` intrinsic became safe, and I've added a helpful diagnostic for people trying to use the old feature. To test that `-Cpanic=immediate-abort` conflicts with other panic strategies, I've beefed up the core-stubs infrastructure a bit. There is now a separate attribute to set flags on it. I've added a test that this produces the desired codegen, called `tests/run-make-cargo/panic-immediate-abort-codegen/` and also a separate run-make-cargo test that checks that we can build a binary.
2025-09-23Migrate `expand_record_rest_pattern` assist to use `SyntaxEditor`A4-Tacks-12/+11
Because `add_field` uses `ted`