about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2025-04-28AsyncDrop implementation using shim codegen of ↵Andrew Zhogin-85/+104
async_drop_in_place::{closure}, scoped async drop added.
2025-04-28Add foldhash license exceptionLaurențiu Nicola-0/+1
2025-04-28Add expression fill mode variant for filling with underscore expressionsLukas Wirth-125/+172
2025-04-28Auto merge of #123239 - Urgau:dangerous_implicit_autorefs, ↵bors-0/+4
r=jdonszelmann,traviscross Implement a lint for implicit autoref of raw pointer dereference - take 2 *[t-lang nomination comment](https://github.com/rust-lang/rust/pull/123239#issuecomment-2727551097)* This PR aims at implementing a lint for implicit autoref of raw pointer dereference, it is based on #103735 with suggestion and improvements from https://github.com/rust-lang/rust/pull/103735#issuecomment-1370420305. The goal is to catch cases like this, where the user probably doesn't realise it just created a reference. ```rust pub struct Test { data: [u8], } pub fn test_len(t: *const Test) -> usize { unsafe { (*t).data.len() } // this calls <[T]>::len(&self) } ``` Since #103735 already went 2 times through T-lang, where they T-lang ended-up asking for a more restricted version (which is what this PR does), I would prefer this PR to be reviewed first before re-nominating it for T-lang. ---- Compared to the PR it is as based on, this PR adds 3 restrictions on the outer most expression, which must either be: 1. A deref followed by any non-deref place projection (that intermediate deref will typically be auto-inserted) 2. A method call annotated with `#[rustc_no_implicit_refs]`. 3. A deref followed by a `addr_of!` or `addr_of_mut!`. See bottom of post for details. There are several points that are not 100% clear to me when implementing the modifications: - ~~"4. Any number of automatically inserted deref/derefmut calls." I as never able to trigger this. Am I missing something?~~ Fixed - Are "index" and "field" enough? ---- cc `@JakobDegen` `@WaffleLapkin` r? `@RalfJung` try-job: dist-various-1 try-job: dist-various-2
2025-04-28Add bootstrap cfgLaurențiu Nicola-0/+1
2025-04-28Format codeLaurențiu Nicola-1/+3
2025-04-28Merge from rust-lang/rustLaurențiu Nicola-12135/+24365
2025-04-28Add or-patterns to pattern typesOli Scherer-0/+18
2025-04-28Preparing for merge from rust-lang/rustLaurențiu Nicola-1/+1
2025-04-27Auto merge of #140362 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 10 commits in d811228b14ae2707323f37346aee3f4147e247e6..7918c7eb59614c39f1c4e27e99d557720976bdd7 2025-04-15 15:18:42 +0000 to 2025-04-27 09:44:23 +0000 - overriding-dependencies.md: better readability (rust-lang/cargo#15459) - source-replacement.md: fix typo (rust-lang/cargo#15458) - Stabilize automatic garbage collection. (rust-lang/cargo#14287) - Update doctest xcompile flags (rust-lang/cargo#15455) - fix: Suggest similar looking feature names when feature is missing (rust-lang/cargo#15454) - fix(unit-graph): switch to Package ID Spec (rust-lang/cargo#15447) - chore(deps): update cargo-semver-checks to v0.41.0 (rust-lang/cargo#15446) - Implement RFC3695: Allow boolean literals as cfg predicates (rust-lang/cargo#14649) - chore: remove duplicate word in comment (rust-lang/cargo#15437) - Fix formatting of CliUnstable parsing (rust-lang/cargo#15434) r? ghost
2025-04-27Rollup merge of #140348 - ehuss:lint-docs-edition, r=compiler-errorsMatthias Krüger-14/+8
Update lint-docs to default to Rust 2024 This updates the lint-docs tool to default to the 2024 edition. The lint docs are supposed to illustrate the code with the latest edition, and I just forgot to update this in https://github.com/rust-lang/rust/pull/133349. Some docs needed to add the `edition` attribute since they were assuming a particular edition, but were missing the explicit annotation. This also includes a commit to simplify the edition handling in lint-docs.
2025-04-27Merge pull request #4293 from primoly/unsafe-attributesBen Kimock-4/+4
Mark unsafe attributes as such
2025-04-27`unsafe(no_mangle)` in `miri_start` examplesprimoly-4/+4
2025-04-27Update cargoWeihang Lo-0/+0
2025-04-26Auto merge of #140288 - Zalathar:new-executor, r=jieyouxubors-7/+11
compiletest: Re-land using the new non-libtest executor by default This PR re-lands #139998, which had the misfortune of triggering download-rustc in its CI jobs, so we didn't get proper test metrics for comparison with the old implementation. So that was PR was reverted in #140233, with the intention of re-landing it alongside a dummy compiler change to inhibit download-rustc. --- Original PR description for #139998: >The new executor was implemented in #139660, but required a manual opt-in. This PR activates the new executor by default, but leaves the old libtest-based executor in place (temporarily) to make reverting easier if something unexpectedly goes horribly wrong. > >Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency. The flag is mostly there to make manual comparative testing easier if something does go wrong. > >As before, there *should* be no user-visible difference between the old executor and the new executor. --- r? jieyouxu
2025-04-26Update lint-docs to default to Rust 2024Eric Huss-1/+1
This updates the lint-docs tool to default to the 2024 edition. The lint docs are supposed to illustrate the code with the latest edition, and I just forgot to update this in https://github.com/rust-lang/rust/pull/133349. Some docs needed to add the `edition` attribute since they were assuming a particular edition, but were missing the explicit annotation.
2025-04-26lint-docs: Don't hard-code the valid editionsEric Huss-14/+8
This removes the hard-coded list of edition support in the lint-docs tool, and instead just assumes the edition attribute is something valid. There isn't a real reason to have this, as rustc will error if given a wrong number. This should be easier to maintain going forward.
2025-04-26Merge pull request #19692 from vishruth-thimmaiah/remove_underscore_for_used_varChayim Refael Friedman-0/+212
feat: adds an assist to remove underscores from used variables
2025-04-27feat: adds an assist to remove underscores from used variablesVishruth-Thimmaiah-0/+212
adds an assist that suggests removing any underscore prefixes from used variables.
2025-04-26Don't escape `'static`Chayim Refael Friedman-2/+10
As it is a valid lifetime without escaping. It does need to be escaped as a label, but we have no way to distinguish that.
2025-04-26Escape raw names in labels properlyChayim Refael Friedman-5/+26
2025-04-26Rollup merge of #140226 - alexcrichton:update-wasm-component-ld, r=jieyouxuMatthias Krüger-1/+1
Update wasm-component-ld to 0.5.13 This commit updates the vendored `wasm-component-ld` binary to 0.5.13 which includes some various bug fixes and new feature updates for upcoming component model features coming down the pike. Not expected to break any existing workflows, just a normal update.
2025-04-26Fix error message for static references or mutable referencesyuk1ty-1/+1
2025-04-25Clarify text for add_braces assistWilfred Hughes-3/+3
"to arm expression" is hard to parse, because "arm" can be a verb. Not all Rust users may know that "arm" refers to a `match` expression either. Tweak the wording to make the sentence easier to parse, and clarify that this assist refers to `match`. Use the same wording style for the closure version too.
2025-04-26Merge from rustcThe Miri Cronjob Bot-17/+62
2025-04-26Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-04-26Auto merge of #140177 - tmandry:compiletest-par, r=jieyouxubors-38/+60
[compiletest] Parallelize test discovery Certain filesystems are slow to service individual read requests, but can service many in parallel. This change brings down the time to run a single cached test on one of those filesystems from 40s to about 8s.
2025-04-25Rollup merge of #137683 - Kobzol:tidy-gcc-submodule, r=GuillaumeGomezMatthias Krüger-0/+49
Add a tidy check for GCC submodule version To make sure that it stays in sync with the required GCC version of the GCC codegen backend. The check should succeed on CI, although it will fail after https://github.com/rust-lang/rust/pull/137660, until the next GCC sync. r? `@GuillaumeGomez`
2025-04-25Merge pull request #19690 from ChayimFriedman2/preallocate-inputChayim Refael Friedman-3/+10
minor: Preallocate `parser::Input`
2025-04-25Preallocate `parser::Input`Chayim Refael Friedman-3/+10
2025-04-25compiletest: Use the new non-libtest executor by default (2)Zalathar-7/+11
(Re-landing #139998, with a compiler change to inhibit download-rustc.) Currently the new executor can be explicitly disabled by passing the `-N` flag to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be removed, alongside the removal of the libtest dependency.
2025-04-25Merge pull request #19688 from ChayimFriedman2/less-unusedLukas Wirth-173/+164
internal: More `shrink_to_fit()` and upgrade dashmap and hashbrown
2025-04-25avoid an unnecessary transmuteRalf Jung-1/+1
2025-04-25Switch `AstIdMap` to `hashbrown::HashTable` from the raw APIChayim Refael Friedman-10/+10
It's the intended use.
2025-04-25Upgrade dashmap and hashbrownChayim Refael Friedman-136/+103
And adapt `intern` to the changes in the API.
2025-04-25Auto merge of #140273 - matthiaskrgr:rollup-rxmuvkg, r=matthiaskrgrbors-6/+6
Rollup of 8 pull requests Successful merges: - #137096 (Stabilize flags for doctest cross compilation) - #140148 (CI: use aws codebuild for job dist-arm-linux) - #140187 ([AIX] Handle AIX dynamic library extensions within c-link-to-rust-dylib run-make test) - #140196 (Improved diagnostics for non-primitive cast on non-primitive types (`Arc`, `Option`)) - #140210 (Work around cygwin issue on condvar timeout) - #140213 (mention about `x.py setup` in `INSTALL.md`) - #140229 (`DelimArgs` tweaks) - #140248 (Fix impl block items indent) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-25minor: formatgohome001-6/+4
2025-04-25test: add test case for highlight unsafe operationsgohome001-0/+28
2025-04-25feat: highlight unsafe operationsgohome001-0/+57
2025-04-25`shrink_to_fit()` in more placesChayim Refael Friedman-27/+51
This saves 18mb on `analysis-stats .`, without regressing speed.
2025-04-25Add a tidy check for GCC submodule versionJakub Beránek-0/+49
2025-04-25Auto merge of #140233 - Zalathar:revert-new-executor, r=jieyouxubors-11/+7
Revert compiletest new-executor, to re-land without download-rustc Revert <https://github.com/rust-lang/rust/pull/139998> because the original merge triggered download-rustc, which messes with test metrics and prevents us from properly comparing them before/after the change. The plan is to re-land this PR as-is, combined with a trivial compiler change to avoid download-rustc and get proper test metrics for comparison. This reverts commit be181dd75c83d72fcc95538e235768bc367b76b9, reversing changes made to 645d0ad2a4f145ae576e442ec5c73c0f8eed829b. r? ghost
2025-04-25Merge from rustcThe Miri Cronjob Bot-104/+93
2025-04-25Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-04-25Add PGO support to installFrançois Bernier-132/+175
Enable PGO optimizations when installing rust-analyzer with the --pgo flag. This mirrors functionality already available in dist command, allowing developers to create optimized local builds. Example: cargo xtask install --server --pgo clap-rs/clap PGO code has been extracted to a dedicated module for reuse.
2025-04-24Always error when failed to parse DiscoverProjectMessageDavid Richey-13/+13
2025-04-25Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmeaseMatthias Krüger-6/+6
Stabilize flags for doctest cross compilation This makes the following changes in preparation for supporting doctest cross-compiling in cargo: - Renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments. - Stabilizes the `--test-runtool` and `--test-runtool-arg`. These are needed in order to support cargo's `target.runner` option which specifies a runner to execute a cross-compiled doctest (for example, qemu). - Stabilizes the `--enable-per-target-ignores` flag by removing it and making it unconditionally enabled. This makes it possible to disable a doctest on a per-target basis, which I think will be helpful for rolling out this feature. These changes were suggested in https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile/near/409281127 The intent is to stabilize the doctest-xcompile feature in cargo. This will help ensure that for projects that do cross-compile testing that their doctests are also covered. Currently there is a somewhat surprising behavior that they are ignored. Closes https://github.com/rust-lang/rust/issues/64245 try-job: x86_64-msvc-1
2025-04-24Rollup merge of #140191 - Kobzol:remove-git-repository-from-git-config, ↵Matthias Krüger-8/+0
r=jieyouxu Remove git repository from git config It is no longer needed after https://github.com/rust-lang/rust/pull/138591. We could even remove the `nightly_branch` field, but it still has one usage. r? ``@jieyouxu``
2025-04-24Rollup merge of #140172 - bjoernager:const-float-algebraic, r=RalfJungMatthias Krüger-26/+0
Make algebraic functions into `const fn` items. Tracking issue: #136469 This PR makes the algebraic intrinsics and the unstable, algebraic functions of `f16`, `f32`, `f64`, and `f128` into `const fn` items: ```rust impl f16 { pub const fn algebraic_add(self, rhs: f16) -> f16; pub const fn algebraic_sub(self, rhs: f16) -> f16; pub const fn algebraic_mul(self, rhs: f16) -> f16; pub const fn algebraic_div(self, rhs: f16) -> f16; pub const fn algebraic_rem(self, rhs: f16) -> f16; } impl f32 { pub const fn algebraic_add(self, rhs: f32) -> f32; pub const fn algebraic_sub(self, rhs: f32) -> f32; pub const fn algebraic_mul(self, rhs: f32) -> f32; pub const fn algebraic_div(self, rhs: f32) -> f32; pub const fn algebraic_rem(self, rhs: f32) -> f32; } impl f64 { pub const fn algebraic_add(self, rhs: f64) -> f64; pub const fn algebraic_sub(self, rhs: f64) -> f64; pub const fn algebraic_mul(self, rhs: f64) -> f64; pub const fn algebraic_div(self, rhs: f64) -> f64; pub const fn algebraic_rem(self, rhs: f64) -> f64; } impl f128 { pub const fn algebraic_add(self, rhs: f128) -> f128; pub const fn algebraic_sub(self, rhs: f128) -> f128; pub const fn algebraic_mul(self, rhs: f128) -> f128; pub const fn algebraic_div(self, rhs: f128) -> f128; pub const fn algebraic_rem(self, rhs: f128) -> f128; } // core::intrinsics pub const fn fadd_algebraic<T: Copy>(a: T, b: T) -> T; pub const fn fsub_algebraic<T: Copy>(a: T, b: T) -> T; pub const fn fmul_algebraic<T: Copy>(a: T, b: T) -> T; pub const fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T; pub const fn frem_algebraic<T: Copy>(a: T, b: T) -> T; ``` This PR does not preserve the initial behaviour of these functions yielding non-deterministic output under Miri; it is most likely desired to reimplement this behaviour at some point.
2025-04-24Rollup merge of #136083 - bend-n:⃤⃤, r=lcnrMatthias Krüger-67/+87
Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc implements #136067 Rust has helper methods for many kinds of safe transmutes, for example integer<->bytes. This is a lint against using transmute for these cases. ```rs fn bytes_at_home(x: [u8; 4]) -> u32 { transmute(x) } // other examples transmute::<[u8; 2], u16>(); transmute::<[u8; 8], f64>(); transmute::<u32, [u8; 4]>(); transmute::<char, u32>(); transmute::<u32, char>(); ``` It would be handy to suggest `u32::from_ne_bytes(x)`. This is implemented for `[u8; _]` -> `{float int}` This also implements the cases: `fXX` <-> `uXX` = `{from_bits, to_bits}` `uXX` -> `iXX` via `cast_unsigned` and `cast_signed` {`char` -> `u32`, `bool` -> `n8`} via `from` `u32` -> `char` via `from_u32_unchecked` (note: notes `from_u32().unwrap()`) (contested) `u8` -> `bool` via `==` (debatable) --- try-job: aarch64-gnu try-job: test-various