Commit Graph

278631 Commits

Author SHA1 Message Date
Matthias Krüger
c8c5fa4893
Rollup merge of #135330 - bjorn3:respect_sysroot_in_version_printing, r=lqd
Respect --sysroot for rustc -vV and -Cpasses=list

This is necessary when the specified codegen backend is in a custom sysroot.

Fixes https://github.com/rust-lang/rust/issues/135165
2025-01-20 20:58:35 +01:00
Matthias Krüger
bbec1510bb
Rollup merge of #133695 - x17jiri:hint_likely, r=Amanieu
Reexport likely/unlikely in std::hint

Since `likely`/`unlikely` should be working now, we could reexport them in `std::hint`. I'm not sure if this is already approved or if it requires approval

Tracking issue: #26179
2025-01-20 20:58:34 +01:00
bors
9f4d9dc102 Auto merge of #135769 - jieyouxu:rollup-3h384pz, r=jieyouxu
Rollup of 5 pull requests

Successful merges:

 - #135433 (Add Profile Override for Non-Git Sources)
 - #135626 (doc: Point to methods on `Command` as alternatives to `set/remove_var`)
 - #135658 (Do not include GCC source code in source tarballs)
 - #135676 (rustc_resolve: use structured fields in traces)
 - #135762 (Correct counting to four in cell module docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-20 17:07:30 +00:00
bjorn3
056a9cebe9 Respect --target in get_backend_from_raw_matches 2025-01-20 15:47:26 +00:00
Jiri Bobek
cb2efaf5bc 1. Removed 'rustc_nounwind' 2. Rewording of comments 2025-01-20 16:16:46 +01:00
bors
6a64e3b897 Auto merge of #135643 - khuey:135332, r=jieyouxu
When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely

Dropping them fails `-Zverify-llvm-ir`.

Fixes #135332.

r? `@jieyouxu`
2025-01-20 14:16:22 +00:00
许杰友 Jieyou Xu (Joe)
ecfb55762c
Rollup merge of #135762 - TomFryersMidsummer:patch-1, r=joboet
Correct counting to four in cell module docs

It could also be argued that `OnceCell<T>` and `LazyCell<T>` don't really provide safe interior mutability in different ways. But it's a vague enough claim that I'm not sure it's worth being pedantic about.
2025-01-20 21:45:06 +08:00
许杰友 Jieyou Xu (Joe)
3e26673b29
Rollup merge of #135676 - yotamofek:resolve-cleanups, r=BoxyUwU
rustc_resolve: use structured fields in traces

I think this crate was written before `tracing` was adopted, and was manually writing fields into trace logs instead of using structured fields.

I kept function names in the trace messages even though I added `#[instrument]` invocations so that the events will be in named spans, wasn't sure if spans are always printed.
2025-01-20 21:45:06 +08:00
许杰友 Jieyou Xu (Joe)
a41d652d10
Rollup merge of #135658 - Kobzol:src-tarball-remove-gcc, r=jieyouxu
Do not include GCC source code in source tarballs

The licensing story is unclear, it makes the archive much larger, and we should not need it for building anything in the tarballs (yet).

```
Before:
121s building the archive
1.3 GiB gzipped size
5.7 GiB extracted size
402519 extracted files

After:
64s building the archive
961 MiB gzipped size
4.5 GiB extracted size
257719 extracfed files
```

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

r? `@ehuss`
2025-01-20 21:45:05 +08:00
许杰友 Jieyou Xu (Joe)
e7f53663de
Rollup merge of #135626 - clubby789:env-note, r=ibraheemdev
doc: Point to methods on `Command` as alternatives to `set/remove_var`

Make these methods more discoverable, as configuring a child process is a common reason for manipulating the environment.
2025-01-20 21:45:04 +08:00
许杰友 Jieyou Xu (Joe)
bdd88ddd30
Rollup merge of #135433 - tanvincible:patch-1, r=onur-ozkan
Add Profile Override for Non-Git Sources

## PR description

- Fixes #135358

This PR introduces the following updates to

1. `bootstrap.py`:
    - If the `profile` is `None` and the source is non-git, the `profile` is automatically overridden to `"dist"`.
    - Ensures that options like `download-ci-llvm` and `download-rustc` are not used with non-git sources. An exception is raised if these options are present in the configuration when the source is non-git.

2. `bootstrap_test.py`
   - Added unit tests to verify both the profile override mechanism and the assertion for restricted options.
These tests ensure the correct behavior for non-git sources and the handling of `if-unchanged` options.

r? `@onur-ozkan`
`@rustbot` T-bootstrap
2025-01-20 21:45:04 +08:00
bors
b5741a36a8 Auto merge of #135754 - jieyouxu:rollup-j4q1hpr, r=jieyouxu
Rollup of 7 pull requests

Successful merges:

 - #135542 (Add the concrete syntax for precise capturing to 1.82 release notes.)
 - #135700 (Emit single privacy error for struct literal with multiple private fields and add test for `default_field_values` privacy)
 - #135722 (make it possible to use ci-rustc on tarball sources)
 - #135729 (Add debug assertions to compiler profile)
 - #135736 (rustdoc: Fix flaky doctest test)
 - #135738 (Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`)
 - #135747 (Rename FileName::QuoteExpansion to CfgSpec)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-20 10:35:43 +00:00
Tom Fryers
8ba0d2db18
Correct counting to four in cell module docs 2025-01-20 10:16:27 +00:00
bors
ecda83b30f Auto merge of #135755 - jieyouxu:rollup-rdwbhod, r=jieyouxu
Rollup of 5 pull requests

Successful merges:

 - #134276 (fully de-stabilize all custom inner attributes)
 - #135237 (Match Ergonomics 2024: document and reorganize the currently-implemented feature gates)
 - #135310 (Always force non-trimming of path in `unreachable_patterns` lint)
 - #135446 (further improve panic_immediate_abort by removing rtprintpanic! messages)
 - #135491 (Remove dead rustc_allowed_through_unstable_modules for std::os::fd contents)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-20 07:51:13 +00:00
Yotam Ofek
539b4d8555 rustc_resolve: use structured fields in traces 2025-01-20 07:20:02 +00:00
Tanvi Pooranmal Meena
7d806171d0 Add logic to override profile for non git sources 2025-01-20 11:07:32 +05:30
许杰友 Jieyou Xu (Joe)
e1e26f339d
Rollup merge of #135491 - RalfJung:remove-dead-rustc_allowed_through_unstable_modules, r=Mark-Simulacrum
Remove dead rustc_allowed_through_unstable_modules for std::os::fd contents

As far as I was able to reconstruct, the history here is roughly as follows:
- https://github.com/rust-lang/rust/pull/99723 added some `rustc_allowed_through_unstable_modules` to the types in `std::os::fd::raw` since they were accessible on stable via the unstable `std::os::wasi::io::AsRawFd` path. (This was needed to fix https://github.com/rust-lang/rust/issues/99502.)
- Shortly thereafter, https://github.com/rust-lang/rust/pull/98368 re-organized things so that instead of re-exporting from an internal  `std::os::wasi::io::raw`,   `std::os::wasi::io::AsRawFd` is now directly re-exported from `std::os::fd`. This also made `library/std/src/os/wasi/io/raw.rs` entirely dead code as far as I can tell, it's not imported by anything any more.
- Shortly thereafter, https://github.com/rust-lang/rust/pull/103308 stabilizes `std::os::wasi::io`, so `rustc_allowed_through_unstable_modules` is not needed any more to access `std::os::wasi::io::AsRawFd`. There is even a comment in `library/std/src/os/wasi/io/raw.rs` saying the attribute can be removed now, but that file is dead code so it is not touched as part of the stabilization.

I did a grep for `pub use crate::os::fd` and all the re-exports I could find are in stable modules. So given all that, we can remove the  `rustc_allowed_through_unstable_modules` (hoping they are not also re-exported somewhere else, it's really hard to be sure about this).

I have checked that std still builds after this PR on the wasm32-wasip2 target.
2025-01-20 12:38:32 +08:00
许杰友 Jieyou Xu (Joe)
e5b85035fe
Rollup merge of #135446 - klensy:panic_immediate_abort_ext, r=Mark-Simulacrum
further improve panic_immediate_abort by removing rtprintpanic! messages

Reduces binary size using `panic_immediate_abort` by removing strings used by `rtprintpanic!`.

for `main.rs`
```rust
fn main() {
    println!("Hello, world!");
}
```
with `Cargo.toml`
```toml
[package]
name = "tst"
version = "0.1.0"
edition = "2024"

[dependencies]

[profile.release]
lto = true
codegen-units = 1
panic = "abort"

```

and build with `RUSTFLAGS="-Zlocation-detail=none -Zfmt-debug=none" cargo +stage-1 b -r -Z build-std=std,panic_abort -Z build-std-features=optimize_for_size,panic_immediate_abort` for `x86_64-unknown-linux-gnu`

This reduces size:
| before |  after | type |
| - | - | - |
| 25256 | 21880 | unstripped |
| 18072 | 15288 | stripped |
2025-01-20 12:38:32 +08:00
许杰友 Jieyou Xu (Joe)
3f2f695d68
Rollup merge of #135310 - estebank:issue-135289, r=Nadrieril
Always force non-trimming of path in `unreachable_patterns` lint

Creating a "trimmed DefID path" when no error is being emitted is an ICE (on purpose). If we create a trimmed path for a lint that is then silenced before being emitted causes a known ICE. This side-steps the issue by always using `with_no_trimmed_path!`.

This was verified to fix https://github.com/quinn-rs/quinn/, but couldn't write a repro case for the test suite.

Fix #135289.
2025-01-20 12:38:31 +08:00
许杰友 Jieyou Xu (Joe)
1419f79acf
Rollup merge of #135237 - dianne:match-2024-cleanup, r=Nadrieril
Match Ergonomics 2024: document and reorganize the currently-implemented feature gates

The hope here is to make it easier to adjust, understand, and test the experimental pattern typing rules implemented in the compiler. This PR doesn't (or at isn't intended to) change any behavior or add any new tests; I'll be handling that later. I've also included some reasoning/commentary on the more involved changes in the commit messages.

Relevant tracking issue: #123076

r? `@Nadrieril`
2025-01-20 12:38:31 +08:00
许杰友 Jieyou Xu (Joe)
be8f1f9949
Rollup merge of #134276 - RalfJung:destabilize-custom-inner-attr, r=SparrowLii
fully de-stabilize all custom inner attributes

`#![test]` and `#![rustfmt::skip]` were accidentally accepted in more places than they should. These have been marked as soft-unstable since forever (https://github.com/rust-lang/rust/pull/82399) and shown in future-compat reports since Rust 1.77 (https://github.com/rust-lang/rust/pull/116274).

Cc `@rust-lang/lang` `@petrochenkov`
2025-01-20 12:38:30 +08:00
许杰友 Jieyou Xu (Joe)
82a239c798
Rollup merge of #135747 - ehuss:filename-quote, r=SparrowLii
Rename FileName::QuoteExpansion to CfgSpec

I believe this variant name was used incorrectly. The timeline is roughly:

* `FileName::cfg_spec_source_code` was added in https://github.com/rust-lang/rust/pull/54517. However, it used `FileName::Quote` instead of `FileName::CfgSpec` which I believe was a mistake.
* Quote stuff was removed in https://github.com/rust-lang/rust/pull/51285, but did not remove `FileName::Quote`.
* `FileName::CfgSpec` was removed in https://github.com/rust-lang/rust/pull/116474 because it was unused.

This restores it so that the `--cfg` variant uses a name that makes more sense with how it is used, and restores what I think is the original intent.
2025-01-20 12:37:56 +08:00
许杰友 Jieyou Xu (Joe)
f3f21ae6a4
Rollup merge of #135738 - yotamofek:map_or_true-compiler, r=compiler-errors
Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`

Split out from #135732 according to https://github.com/rust-lang/rust/pull/135732?pullrequestreview-2561072330 ,
same thing but just for the compiler:

> The usage of `map_or(bool, ...)` is really hard to understand IMHO.
> This PR simply uses clippy (with `--fix`) to replace that with `is_{some_and|none_or|ok_and}`.
> (no manual modifications were made, just machine applicable clippy fixes and then fmt)

r? ``@compiler-errors``
2025-01-20 12:37:56 +08:00
许杰友 Jieyou Xu (Joe)
64768c5630
Rollup merge of #135736 - fmease:rustdoc-fix-flaky-test, r=GuillaumeGomez
rustdoc: Fix flaky doctest test

Fixes #135660.
2025-01-20 12:37:55 +08:00
许杰友 Jieyou Xu (Joe)
9cd0e8efdc
Rollup merge of #135729 - Noratrieb:compiler-profile-debug-assert, r=lqd
Add debug assertions to compiler profile

Working on the compiler without debug assertions is not a very productive way to work on the compiler.
2025-01-20 12:37:55 +08:00
许杰友 Jieyou Xu (Joe)
afdf3aa457
Rollup merge of #135722 - onur-ozkan:handle-tarball-ci-commit, r=jieyouxu
make it possible to use ci-rustc on tarball sources

Previously, bootstrap was using `Config::last_modified_commit` unconditionally to figure the commit to download precompiled rustc artifact from CI, which was leading builds to fail on tarball sources as `Config::last_modified_commit` requires `git` to be present in the project source. This change makes bootstrap to call `Config::last_modified_commit` only when it's running on git-managed source and read `git-commit-hash` file otherwise.
2025-01-20 12:37:54 +08:00
许杰友 Jieyou Xu (Joe)
6db2d1aae5
Rollup merge of #135700 - estebank:priv-field-dfv, r=wesleywiser
Emit single privacy error for struct literal with multiple private fields and add test for `default_field_values` privacy

Add test ensuring that struct with default field values is not constructable if the fields are not accessible.

Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field.

```
error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private
  --> $DIR/visibility.rs:18:13
   |
LL |     let _x = Alpha {
   |              ----- in this type
LL |         beta: 0,
   |         ^^^^^^^ private field
LL |         ..
   |         ^^ field `gamma` is private
```
2025-01-20 12:37:54 +08:00
许杰友 Jieyou Xu (Joe)
5740a552e3
Rollup merge of #135542 - kpreid:use-note, r=Mark-Simulacrum
Add the concrete syntax for precise capturing to 1.82 release notes.

This will make the note findable by searching for the “use” keyword, and skimming. Many other language additions mention their syntax in the release notes, but this one only used the name of the feature.

Inspired by https://users.rust-lang.org/t/what-is-use/124079/4
2025-01-20 12:37:53 +08:00
dianne
0263772bac elaborate/clarify the comments on InheritedRefMatchRule's variants 2025-01-19 16:03:15 -08:00
dianne
bfa0e1e0ad Add debug-assertions for assumptions about enabled typing rules 2025-01-19 15:32:37 -08:00
dianne
48e023a56f
Add comments explaining inherited references
This adds explanation of inherited references and how they relate to the default binding mode.

Co-authored-by: Nadrieril <Nadrieril@users.noreply.github.com>
2025-01-19 15:26:14 -08:00
Eric Huss
cee45632e8 Rename FileName::QuoteExpansion to CfgSpec
I believe this variant name was used incorrectly. The timeline is roughly:

* `FileName::cfg_spec_source_code` was added in
  https://github.com/rust-lang/rust/pull/54517. However, it used
  `FileName::Quote` instead of `FileName::CfgSpec` which I believe was a
  mistake.
* Quote stuff was removed in
  https://github.com/rust-lang/rust/pull/51285, but did not remove
  `FileName::Quote`.
* `FileName::CfgSpec` was removed in
  https://github.com/rust-lang/rust/pull/116474 because it was unused.

This restores it so that the `--cfg` variant uses a name that makes more
sense with how it is used, and restores what I think is the original
intent.
2025-01-19 14:18:46 -08:00
Yotam Ofek
1951d86a35 Manual cleanup of some is_{or_none|some_and} usages 2025-01-19 20:50:43 +00:00
bors
9a1d156f38 Auto merge of #135742 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-01-19 20:46:10 +00:00
Yotam Ofek
264fa0fc54 Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
León Orell Valerian Liehr
64d667ae78
rustdoc: Fix flaky doctest test 2025-01-19 18:41:11 +01:00
Ralf Jung
49375c48f7
Merge pull request #4141 from rust-lang/rustup-2025-01-19
Automatic Rustup
2025-01-19 17:32:20 +00:00
Ralf Jung
544695506c fix location of pipe module 2025-01-19 10:05:51 -07:00
Ralf Jung
5bd20b0608 fully de-stabilize all custom inner attributes 2025-01-19 08:53:02 -07:00
Kyle Huey
45ef92731b When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely
Revert most of #133194 (except the test and the comment fixes). Then refix
not emitting locations at all when the correct location discriminator value
exceeds LLVM's capacity.
2025-01-19 07:17:33 -08:00
Noratrieb
2e69bd2ce9 Add debug assertions to compiler profile
Working on the compiler without debug assertions is not a very
productive way to work on the compiler.
2025-01-19 16:01:54 +01:00
bors
39dc268459 Auto merge of #135714 - rust-lang:cargo_update, r=clubby789
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt

compiler & tools dependencies:
     Locking 13 packages to latest compatible versions
    Updating anstyle-wincon v3.0.6 -> v3.0.7
    Updating bitflags v2.7.0 -> v2.8.0
    Updating chrono-tz v0.10.0 -> v0.10.1
    Updating js-sys v0.3.76 -> v0.3.77
    Updating log v0.4.22 -> v0.4.25
    Updating miniz_oxide v0.8.2 -> v0.8.3
    Updating uuid v1.11.1 -> v1.12.0
    Updating valuable v0.1.0 -> v0.1.1
    Updating wasm-bindgen v0.2.99 -> v0.2.100
    Updating wasm-bindgen-backend v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro-support v0.2.99 -> v0.2.100
    Updating wasm-bindgen-shared v0.2.99 -> v0.2.100
note: pass `--verbose` to see 41 unchanged dependencies behind latest

library dependencies:
     Locking 1 package to latest compatible version
    Updating miniz_oxide v0.8.2 -> v0.8.3
note: pass `--verbose` to see 4 unchanged dependencies behind latest

rustbook dependencies:
     Locking 12 packages to latest compatible versions
    Updating anstyle-wincon v3.0.6 -> v3.0.7
    Updating bitflags v2.7.0 -> v2.8.0
    Updating cc v1.2.8 -> v1.2.10
    Updating js-sys v0.3.76 -> v0.3.77
    Updating log v0.4.22 -> v0.4.25
    Updating miniz_oxide v0.8.2 -> v0.8.3
      Adding rustversion v1.0.19
    Updating wasm-bindgen v0.2.99 -> v0.2.100
    Updating wasm-bindgen-backend v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro v0.2.99 -> v0.2.100
    Updating wasm-bindgen-macro-support v0.2.99 -> v0.2.100
    Updating wasm-bindgen-shared v0.2.99 -> v0.2.100
```
2025-01-19 14:19:27 +00:00
bors
af952c1abe Auto merge of #135725 - GuillaumeGomez:rollup-dxn3use, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #134858 (Provide structured suggestion for `#![feature(..)]` in more cases)
 - #135679 (create an issue template for bootstrap)
 - #135685 (Remove unused `item-row` CSS class)
 - #135716 (Don't skip argument parsing when running `rustc` with no arguments)
 - #135723 (Fix dev guide docs for error-pattern)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-19 11:38:05 +00:00
Guillaume Gomez
78d9a52a1d
Rollup merge of #135723 - Noratrieb:error-pattern-my-a-, r=jieyouxu
Fix dev guide docs for error-pattern

I know it would have made more sense to make this PR to the dev guide repo but I had already made the fix before I realized that.

r? `@jieyouxu`
2025-01-19 11:48:17 +01:00
Guillaume Gomez
dcc71c0637
Rollup merge of #135716 - Zalathar:usage-no-args, r=lqd
Don't skip argument parsing when running `rustc` with no arguments

Setting up the argument parser to parse no arguments is a tiny bit of wasted work, but avoids an otherwise-unnecessary special case, in a scenario (printing a help message and quitting) where perf at this scale really doesn't matter anyway.

In particular, this lets us avoid having to deal with multiple different APIs to determine whether the compiler is nightly or not.

---

This special-case handling for rustc with no arguments is very very old (long predating 1.0), and used to be much simpler, without any need to set up boolean values to handle various conditional cases. So I don't think it was ever explicitly decided that having this special case was worth the extra complexity; it just started out simple and accumulated complexity over time.
2025-01-19 11:48:17 +01:00
Guillaume Gomez
dde62f9be5
Rollup merge of #135685 - GuillaumeGomez:rm-unused-css-class, r=notriddle
Remove unused `item-row` CSS class

Seems like a CSS class we forgot to remove at some point.

r? `@notriddle`
2025-01-19 11:48:16 +01:00
Guillaume Gomez
857bc5be87
Rollup merge of #135679 - onur-ozkan:bootstrap-issue-template, r=jieyouxu
create an issue template for bootstrap

Resolves #135593

cc `@rust-lang/bootstrap`
2025-01-19 11:48:15 +01:00
Guillaume Gomez
4842ff4a85
Rollup merge of #134858 - estebank:issue-81370, r=Noratrieb
Provide structured suggestion for `#![feature(..)]` in more cases

Fix #81370.
2025-01-19 11:48:15 +01:00
Guillaume Gomez
20443dbe1b Remove unused item-row CSS class 2025-01-19 11:47:32 +01:00
Noratrieb
f1b83fe5d9 Fix dev guide docs for error-pattern
I know it would have made more sense to make this PR to the dev guide
repo but I had already made the fix before I realized that.
2025-01-19 11:36:41 +01:00