Commit graph

298901 commits

Author SHA1 Message Date
Michael Goulet
24ea06cbe8 Apply impl_super_outlives optimization to new trait solver 2025-06-19 21:03:50 +00:00
llogiq
62fd159a5d
Fix non_copy_const ICE (#15083)
fixes rust-lang/rust-clippy#15069

----

changelog: none
2025-06-19 20:46:45 +00:00
Samuel Tardieu
59291a75df
Fix clippy::question_mark on let-else with cfg (#15082)
Fixes rust-lang/rust-clippy#13642

changelog: Fix false positive in [`question_mark`] when else branch of
let-else contains `#[cfg]`
2025-06-19 20:34:05 +00:00
Tshepang Mbambo
6ad42bf4e7
Merge pull request #2477 from rust-lang/rustc-pull
Rustc pull update
2025-06-19 22:14:30 +02:00
Jason Newcomb
ac8f50473c Fix non_copy_const ICE 2025-06-19 16:03:21 -04:00
bors
255aa22082 Auto merge of #140748 - m-ou-se:super-format-args3, r=jdonszelmann
Allow storing `format_args!()` in variable

Fixes https://github.com/rust-lang/rust/issues/92698

Tracking issue for super let: https://github.com/rust-lang/rust/issues/139076

Tracking issue for format_args: https://github.com/rust-lang/rust/issues/99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging https://github.com/rust-lang/rust/pull/139114.)

(This is a second version of https://github.com/rust-lang/rust/pull/139135)
2025-06-19 19:13:32 +00:00
bors
73273f2571 Auto merge of #140748 - m-ou-se:super-format-args3, r=jdonszelmann
Allow storing `format_args!()` in variable

Fixes https://github.com/rust-lang/rust/issues/92698

Tracking issue for super let: https://github.com/rust-lang/rust/issues/139076

Tracking issue for format_args: https://github.com/rust-lang/rust/issues/99012

This change allows:

```rust
let name = "world";
let f = format_args!("hello {name}!"); // New: Store format_args!() for later!

println!("{f}");
```

This will need an FCP.

This implementation makes use of `super let`, which is unstable and might not exist in the future in its current form. However, it is entirely reasonable to assume future Rust will always have _a_ way of expressing temporary lifetimes like this, since the (stable) `pin!()` macro needs this too. (This was also the motivation for merging https://github.com/rust-lang/rust/pull/139114.)

(This is a second version of https://github.com/rust-lang/rust/pull/139135)
2025-06-19 19:13:32 +00:00
David Tolnay
1ed0cbf698
Preserve Paren expression's attributes during Unparenthesize 2025-06-19 12:05:46 -07:00
Samuel Tardieu
db32d3980b
Fix typo (#15081)
Add missing word (attribute) after the `#[expect]` attribute.

changelog: [`allow_attributes`]: Fix typo in documentation
2025-06-19 19:05:12 +00:00
Max Siling
4aa93a1129
Fix clippy::question_mark on let-else with cfg 2025-06-19 21:55:35 +03:00
Jason Newcomb
498562df52
Check MSRV before suggesting applying const to a function (#15080)
If a function environment contains trait bounds other than `Sized`,
`const` cannot be used before Rust 1.61.

changelog: [`missing_const_for_fn`]: check MSRV before emitting lint on
function containing non-`Sized` trait bounds

Fixes rust-lang/rust-clippy#15079

r? Jarcho
2025-06-19 18:34:13 +00:00
Cameron Steffen
3388d83785 Extract SilentEmitter 2025-06-19 13:05:01 -05:00
Cameron Steffen
316f63bc48 Rename SilentEmitter -> FatalOnlyEmitter 2025-06-19 13:03:17 -05:00
Cameron Steffen
ade2682b62 Extract Translator struct 2025-06-19 13:02:04 -05:00
Cameron Steffen
07b9bb1855 Extract Translator struct 2025-06-19 13:02:04 -05:00
Trevor Gross
67a9fb2fb7 mbe: Refactor transcription
Introduce `MacroTcbCtx` that holds everything relevant to transcription.
This allows for the following changes:

* Split `transcribe_sequence` and `transcribe_metavar` out of the
  heavily nested `transcribe`
* Split `metavar_expr_concat` out of `transcribe_metavar_expr`

This is a nonfunctional change.
2025-06-19 16:28:52 +00:00
Trevor Gross
496cbe1aa9 mbe: Move transcribe_metavar_expr directly after transcribe
Be more consistent with the otherwise top-down organization of this
file.
2025-06-19 16:27:33 +00:00
Trevor Gross
044c99df78 Improve diagnostics for concat_bytes! with C string literals
Use the same error as other invalid types for `concat_bytes!`, rather
than using `ConcatCStrLit` from `concat!`. Also add more information
with a note about why this doesn't work, and a suggestion to use a
null-terminated byte string instead.
2025-06-19 16:13:20 +00:00
Vincent Esche
77858696ac Add fn parent(self, db) -> GenericDef to hir::TypeParam 2025-06-19 18:04:46 +02:00
Kornel
c109b28ac4 Add #[track_caller] to String methods that assert inputs 2025-06-19 16:55:40 +01:00
Kornel
b26dfa175c Let String pass #[track_caller] to its Vec calls 2025-06-19 16:55:09 +01:00
Folkert de Vries
359f986ddd s390x: add feature detection for the z17 target features 2025-06-19 15:31:16 +00:00
Folkert de Vries
26b7dd4304 the generic_arg_infer feature is now stable on nightly 2025-06-19 15:31:16 +00:00
Everett Pompeii
9c8f3e9b11
Fix typo
Add missing word (attribute) after the `#[expect]` attribute.
2025-06-19 10:26:08 -05:00
Yotam Ofek
aca0688a1d De-dup common code from ExternalCrate methods 2025-06-19 14:22:28 +00:00
bors
8de4c7234d Auto merge of #141864 - Berrysoft:cygwin-path, r=ChrisDenton
Handle win32 separator for cygwin paths

This PR handles a issue that cygwin actually supports Win32 path, so we need to handle the Win32 prefix and separaters.

r? `@mati865`

cc `@jeremyd2019`

~~Not sure if I should handle the prefix like the windows target... Cygwin *does* support win32 paths directly going through the APIs, but I think it's not the recommended way.~~

Here I just use `cygwin_conv_path` because it handles both cygwin and win32 paths correctly and convert them into absolute POSIX paths.

UPDATE: Windows path prefix is handled.
2025-06-19 13:38:37 +00:00
Catherine Flores
d8e99530c8
Fix exhaustive_structs FP on structs with default valued field (#15022)
Closes rust-lang/rust-clippy#14992

changelog: [`exhaustive_structs`] fix FP on structs with default valued
field
2025-06-19 13:38:28 +00:00
Samuel Tardieu
6524bf78b6
Check MSRV before suggesting applying const to a function
If a function environment contains trait bounds other than `Sized`,
`const` cannot be used before Rust 1.61.
2025-06-19 15:26:36 +02:00
Nia Espera
a9cc316954
isolated_alloc: directly use mmap for allocations
Update src/alloc/isolated_alloc.rs

Co-authored-by: Ralf Jung <post@ralfj.de>

Update src/alloc/isolated_alloc.rs

Co-authored-by: Ralf Jung <post@ralfj.de>

Update src/alloc/isolated_alloc.rs

Co-authored-by: Ralf Jung <post@ralfj.de>

Update src/alloc/isolated_alloc.rs

Co-authored-by: Ralf Jung <post@ralfj.de>

Update src/alloc/isolated_alloc.rs

Co-authored-by: Ralf Jung <post@ralfj.de>

address review

Apply suggestions from code review

Co-authored-by: Ralf Jung <post@ralfj.de>

fix comment

fix position thing

dumb mistake

Apply suggestions from code review

Co-authored-by: Ralf Jung <post@ralfj.de>
2025-06-19 14:20:01 +02:00
Mara Bos
b4f2cac097 Remove old format_args diagnostic. 2025-06-19 14:08:29 +02:00
Marijn Schouten
9c22768183 atomic tests: remove static mut 2025-06-19 12:08:24 +00:00
Mara Bos
2da3a66c55 Use expr_ref. 2025-06-19 14:08:20 +02:00
Folkert de Vries
eefd598725
correct template for #[align]
it should not suggest just `#[align]`
2025-06-19 13:58:23 +02:00
Marijn Schouten
456c9da45a vec_deque alloctests: remove static mut 2025-06-19 11:51:47 +00:00
Marijn Schouten
ecdf220dbc vec tests: remove static mut 2025-06-19 11:39:21 +00:00
Alex Macleod
10780e9122
Prepare to split clippy_lints (#14684)
Based on rust-lang/rust-clippy#14633

The end goal here is to split `clippy_lints` into several independent
crates and have the driver call out to each of them to register lints.
`clippy_lints` takes way too long to compile right now.

r? @flip1995

changelog: none
2025-06-19 11:30:32 +00:00
Camille Gillot
ede48910fd
Update compiler/rustc_interface/src/passes.rs
Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2025-06-19 13:18:33 +02:00
Nicholas Nethercote
41ca0cb020 Adjust with_generic_param_rib.
Currently all of its call sites construct a `LifetimeRibKind::Generics`
value, which `with_generic_param_rib` then deconstructs (and panics if
it's a different `LifetimeRibKind` variant).

This commit makes the code simpler and shorter: the call sites just pass
in the three values and `with_generic_param_rib` constructs the
`LifetimeRibKind::Generics` value from them.
2025-06-19 20:44:06 +10:00
bors
2fcf1776b9 Auto merge of #142245 - marcoieni:split-gnu-tools, r=Kobzol
ci: split x86_64-gnu-tools job

try-job: x86_64-gnu-tools
try-job: x86_64-gnu-miri
try-job: aarch64-gnu
2025-06-19 10:39:00 +00:00
Deadbeef
7760f8ec42 add comment to src/bootstrap/build.rs 2025-06-19 18:31:56 +08:00
Yotam Ofek
2bf66e3887 Options are Iterators 2025-06-19 10:26:13 +00:00
Yotam Ofek
569aa26e7b avoid intermediately collecting into vectors 2025-06-19 10:26:13 +00:00
Yotam Ofek
867c1d5ebf one less pathbuf allocation 2025-06-19 10:26:13 +00:00
Deadbeef
3da58e673a completely deduplicate Visitor and MutVisitor 2025-06-19 17:50:44 +08:00
bjorn3
8dea73acfd Rustup to rustc 1.89.0-nightly (c68340350 2025-06-18) 2025-06-19 09:28:38 +00:00
bjorn3
856ffb63c8 Sync from rust c68340350c 2025-06-19 09:20:04 +00:00
Ralf Jung
487feb923f
Merge pull request #4396 from Stypox/build-with-features
Allow building Miri with --features from miri-script
2025-06-19 08:39:32 +00:00
Hamidreza Sanaee
2760b246fb Doc: clarify priority of lint level sources
This updates the rustc book to clearly document how conflicting lint configurations are resolved across different sources, including command-line flags, crate-level attributes, in-line attributes, and `--cap-lints`.

It also explains the special behavior of `forbid` and `force_warn`.
2025-06-19 09:26:38 +01:00
Stypox
a009612691
Allow building Miri with --features from miri-script
Otherwise there was no way to pass e.g. `--features tracing` just to the `cargo` commands issued on the root repository:
CARGO_EXTRA_FLAGS applies the flags to the "cargo-miri" crate, too, which does not make sense for crate-specific features.

Fix install_to_sysroot doing path concatenation twice. Since the second concatenation was against an absolute path, it didn't do anything. This also makes the interface of install_to_sysroot() similar to that of cargo_cmd().

Implement --features for clippy, also fix not passing features to one of the cargo invocations for test
2025-06-19 10:07:55 +02:00
Alice Ryhl
f3383e4942 Do not include NUL-terminator in computed length 2025-06-19 07:47:49 +00:00