Commit Graph

300570 Commits

Author SHA1 Message Date
ognevnydemon
6fd83ea5e5 opt-dist: change build_dir field to be an actual build dir
make it configurable so users can set build.build-dir option in bootstrap.toml
2025-07-20 20:19:11 +03:00
bors
1079c5edb2 Auto merge of #144145 - matthiaskrgr:rollup-swc74s4, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
 - rust-lang/rust#142673 (Show the offset, length and memory of uninit read errors)
 - rust-lang/rust#142693 (More robustly deal with relaxed bounds and improve their diagnostics)
 - rust-lang/rust#143382 (stabilize `const_slice_reverse`)
 - rust-lang/rust#143928 (opt-dist: make llvm builds optional)
 - rust-lang/rust#143961 (Correct which exploit mitigations are enabled by default)
 - rust-lang/rust#144050 (Fix encoding of link_section and no_mangle cross crate)
 - rust-lang/rust#144059 (Refactor `CrateLoader` into the `CStore`)
 - rust-lang/rust#144123 (Generalize `unsize` and `unsize_into` destinations)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-19 05:02:40 +00:00
bors
ebd8557637 Auto merge of #144140 - GuillaumeGomez:subtree-update_cg_gcc_2025-07-18, r=GuillaumeGomez
Subtree update cg gcc 2025 07 18

cc `@antoyo`

r? ghost
2025-07-18 21:53:28 +00:00
Guillaume Gomez
f16474f7bf Remove forgotten git annotations 2025-07-18 22:35:58 +02:00
Matthias Krüger
a59efc61f9 Rollup merge of #144123 - oli-obk:ctfe-unsize, r=RalfJung
Generalize `unsize` and `unsize_into` destinations

Just something that I noticed during other work. We do this for most such functions, so let's do it here, too.

r? ``@RalfJung``
2025-07-18 19:14:47 +02:00
Matthias Krüger
3a3a411980 Rollup merge of #144059 - LorrensP-2158466:remove-crate-loader, r=petrochenkov
Refactor `CrateLoader` into the `CStore`

Removes the `CrateLoader` and moves the code to `CStore`. Now, if you want to use the `CrateLoader`, you can just use `CStore`.

Should we rename `creader.rs` to `cstore.rs`?

r? ``@petrochenkov``
2025-07-18 19:14:46 +02:00
Matthias Krüger
1b437d78e3 Rollup merge of #144050 - JonathanBrouwer:cross-crate-reexport, r=jdonszelmann
Fix encoding of link_section and no_mangle cross crate

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

``@bjorn3`` suggested using the `codegen_fn_attrs` query but given that these attributes are not that common it's probably fine to just always encode them. I can also go for that solution if it is preferred but that would require more changes.

r? ``@jdonszelmann`` ``@fmease`` (whoever feels like it)
2025-07-18 19:14:46 +02:00
Matthias Krüger
79024700f1 Rollup merge of #143961 - 1c3t3a:correct-exploit-mitigations, r=rcvalle
Correct which exploit mitigations are enabled by default

This was brought up by ``@Noratrieb`` in [#project-exploit-mitigations > Incorrect table in the rustc book](https://rust-lang.zulipchat.com/#narrow/channel/343119-project-exploit-mitigations/topic/Incorrect.20table.20in.20the.20rustc.20book/with/523684203). Thanks! :)

[Rendered](132a47e723/src/doc/rustc/src/exploit-mitigations.md)

r? ``@rcvalle``
2025-07-18 19:14:45 +02:00
Matthias Krüger
232bef3f6f Rollup merge of #143928 - ognevny:opt-dist-build-llvm, r=Kobzol
opt-dist: make llvm builds optional

adds command line option for disabling llvm builds. it's useful in case of user having their own optimized LLVM, so they won't waste time for (at least) 3 LLVM builds. in this case PGO optimized rustc will be already built in Stage 1, so rust-lang/rust#143898 should be addressed for this change

couldn't test locally on Linux laptop due to small SSD storage, will try now with windows-msvc host

r? ``@Kobzol``

try-job: dist-x86_64-linux
try-job: dist-x86_64-msvc
2025-07-18 19:14:44 +02:00
Matthias Krüger
401aaf4ac1 Rollup merge of #143382 - fee1-dead-contrib:push-trrymlzqmmoz, r=jhpratt
stabilize `const_slice_reverse`

cc rust-lang/rust#135120, needs FCP.
2025-07-18 19:14:44 +02:00
Matthias Krüger
f38891e697 Rollup merge of #142693 - fmease:unbound-bettering, r=compiler-errors
More robustly deal with relaxed bounds and improve their diagnostics

Scaffolding for https://github.com/rust-lang/rust/issues/135229 (CC https://github.com/rust-lang/rust/pull/135331)

Fixes https://github.com/rust-lang/rust/issues/136944 (6th commit).
Fixes https://github.com/rust-lang/rust/issues/142718 (8th commit).
2025-07-18 19:14:43 +02:00
Matthias Krüger
b3827e4f37 Rollup merge of #142673 - oli-obk:uninit-read-mem, r=RalfJung
Show the offset, length and memory of uninit read errors

r? ``@RalfJung``

I want to improve memory dumps in general. Not sure yet how to do so best within rust diagnostics, but in a perfect world I could generate a dummy in-memory file (that contains the rendered memory dump) that we then can then provide regular rustc `Span`s to. So we'd basically report normal diagnostics for them with squiggly lines and everything.
2025-07-18 19:14:43 +02:00
Matthias Krüger
61285e211b Rollup merge of #138554 - xizheyin:issue-138401, r=chenyukang
Distinguish delim kind to decide whether to emit unexpected closing delimiter

Fixes #138401
2025-07-18 19:14:42 +02:00
Guillaume Gomez
66017df336 Merge commit 'f682d09eefc6700b9e5851ef193847959acf4fac' into subtree-update_cg_gcc_2025-07-18 2025-07-18 18:31:20 +02:00
bors
8f08b3a324 Auto merge of #143845 - cjgillot:stability-query, r=jieyouxu
Split-up stability_index query

This PR aims to move deprecation and stability processing away from the monolithic `stability_index` query, and directly implement `lookup_{deprecation,stability,body_stability,const_stability}` queries.

The basic idea is to:
- move per-attribute sanity checks into `check_attr.rs`;
- move attribute compatibility checks into the `MissingStabilityAnnotations` visitor;
- progressively dismantle the `Annotator` visitor and the `stability_index` query.

The first commit contains functional change, and now warns when `#[automatically_derived]` is applied on a non-trait impl block. The other commits should not change visible behaviour.

Perf in https://github.com/rust-lang/rust/pull/143845#issuecomment-3066308630 shows small but consistent improvement, except for unused-warnings case. That case being a stress test, I'm leaning towards accepting the regression.

This PR changes `check_attr`, so has a high conflict rate on that file. This should not cause issues for review.
2025-07-18 16:27:59 +00:00
antoyo
f682d09eef Merge pull request #735 from rust-lang/sync_from_rust_2025_07_04
Sync from rust 2025/07/04
2025-07-18 12:03:42 -04:00
Antoni Boucher
4d1695103f Comment some tests in the m68k CI because we cannot run programs on architectures not supported by the object crate anymore 2025-07-18 11:39:51 -04:00
bors
82310651b9 Auto merge of #144130 - matthiaskrgr:rollup-t75stad, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime)
 - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`)
 - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT)
 - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] )
 - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string)
 - rust-lang/rust#143925 (Make slice comparisons const)
 - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir))
 - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local)
 - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits)
 - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels)
 - rust-lang/rust#144069 (ci: use windows 22 for all free runners)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-18 13:26:31 +00:00
Oli Scherer
c65d3ce365 Generalize unsize and unsize_into destinations 2025-07-18 13:09:34 +00:00
Matthias Krüger
fd18175e79 Rollup merge of #144069 - marcoieni:windows-22-free, r=jieyouxu
ci: use windows 22 for all free runners

try-job: `x86_64-msvc-*`
2025-07-18 14:49:22 +02:00
Matthias Krüger
c0d848dbc9 Rollup merge of #144063 - jieyouxu:label-ci, r=Kobzol
Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels

- Commit 1 is a drive-by adjustment. Auto-label `src/ci` and `.github/workflows` with https://github.com/rust-lang/rust/labels/A-CI, and include `.github/workflows` for https://github.com/rust-lang/rust/labels/T-infra trigger files.
- Commit 2 adds myself to the `infra-ci` reviewer adhoc group.

r? ``````@Kobzol``````
2025-07-18 14:49:21 +02:00
Matthias Krüger
5368845df3 Rollup merge of #144029 - lichuang:fix_issue_143740, r=compiler-errors
Fix wrong messages from methods with the same name from different traits

fix issue https://github.com/rust-lang/rust/issues/143740
2025-07-18 14:49:21 +02:00
Matthias Krüger
d3bc06ecb4 Rollup merge of #144013 - petrochenkov:disambunder, r=oli-obk
resolve: Make disambiguators for underscore bindings module-local

Disambiguators attached to underscore name bindings (like `const _: u8 = something;`) do not need to be globally unique, they just need to be unique inside the module in which they live, because the bindings in a module are basically kept as `Map<BindingKey, SomeData>`.

Also, the specific values of the disambiguators are not important, so a glob import of `const _` may have a different disambiguator than the original `const _` itself.

So in this PR the disambiguator is just set to the current number of bindings in the module.
This removes one more piece of global mutable state from resolver and unblocks https://github.com/rust-lang/rust/pull/143884.
2025-07-18 14:49:20 +02:00
Matthias Krüger
35b1f759e7 Rollup merge of #143997 - Coder-256:stable-mir-macro-hygiene, r=oli-obk
Use $crate in macros for rustc_public (aka stable_mir)

This makes `#[macro_use] extern crate rustc_public` unnecessary (which brings all of `rustc_public`'s macros into scope for the entire crate); instead, now you can simply use `rustc_public::run!()`.
2025-07-18 14:49:20 +02:00
Matthias Krüger
82fbbddf63 Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-dead
Make slice comparisons const

This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable.

r? ```@fee1-dead```

cc rust-lang/rust#143800
2025-07-18 14:49:19 +02:00
Matthias Krüger
744ca5959a Rollup merge of #143909 - nik-rev:patch-1, r=jhpratt
docs(alloc::fmt): Make type optional, instead of matching empty string

Think this is clearer.

Noticed as I was implementing [`tree-sitter-rust-format-args`](https://github.com/nik-rev/tree-sitter-rust-format-args), and attempting to match the empty string results in an error.
2025-07-18 14:49:19 +02:00
Matthias Krüger
0820cf8c6e Rollup merge of #143908 - Kivooeo:tf0, r=jieyouxu
`tests/ui`: A New Order [0/28]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

These are the some last tests that didn’t make it into the main twenty-eightology of PRs. Part of rust-lang/rust#133895.

r? ```@jieyouxu```
2025-07-18 14:49:18 +02:00
Matthias Krüger
3acbb4d421 Rollup merge of #143699 - compiler-errors:async-drop-fund, r=oli-obk
Make `AsyncDrop` check that it's being implemented on a local ADT

Fixes https://github.com/rust-lang/rust/issues/143691
2025-07-18 14:49:17 +02:00
Matthias Krüger
7b6e2f9725 Rollup merge of #143649 - estebank:const-trait-default-field-value, r=oli-obk
Add test for `default_field_values` and `const_default`

Add a test showing `#![feature(default_field_values)]` using `#[const_trait] trait Default` (`#![feature(const_default)]` + `#![feature(const_trait_impl)]`).

CC https://github.com/rust-lang/rust/issues/132162
2025-07-18 14:49:17 +02:00
Matthias Krüger
499ccba8c1 Rollup merge of #143280 - xizheyin:143152-1, r=compiler-errors
Remove duplicate error about raw underscore lifetime

Fixes rust-lang/rust#143152

r? ```@fee1-dead```
2025-07-18 14:49:16 +02:00
xizheyin
181c1bda0e Deduplicate unmatched_delims in rustc_parse to reduce confusion
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-18 20:34:58 +08:00
LorrensP-2158466
466d33cb5c inline CrateLoader inside of CStore 2025-07-18 13:16:09 +02:00
León Orell Valerian Liehr
82a02aefe0 HIR ty lowering: Validate PointeeSized bounds 2025-07-18 12:25:24 +02:00
León Orell Valerian Liehr
cdc3d701cb Don't reject *multiple* relaxed bounds, reject *duplicate* ones.
Having multiple relaxed bounds like `?Sized + ?Iterator` is actually *fine*.
We actually want to reject *duplicate* relaxed bounds like `?Sized + ?Sized`
because these most certainly represent a user error.

Note that this doesn't mean that we accept more code because a bound like
`?Iterator` is still invalid as it's not relaxing a *default* trait and
the only way to define / use more default bounds is under the experimental
and internal feature `more_maybe_bounds` plus `lang_items` plus unstable
flag `-Zexperimental-default-bounds` (historical context: for the longest
time, bounds like `?Iterator` were actually allowed and lead to a hard
warning).

Ultimately, this simply *reframes* the diagnostic. The scope of
`more_maybe_bounds` / `-Zexperimental-default-bounds` remains unchanged
as well.
2025-07-18 12:24:56 +02:00
León Orell Valerian Liehr
879f62bb3c Reword diagnostic about relaxing non-Sized bound
* The phrasing "only does something for" made sense back when this
  diagnostic was a (hard) warning. Now however, it's simply a hard
  error and thus completely rules out "doing something".
* The primary message was way too long
* The new wording more closely mirrors the wording we use for applying
  other bound modifiers (like `const` and `async`) to incompatible
  traits.
* "all other traits are not bound by default" is no longer accurate
  under Sized Hierarchy. E.g., traits and assoc tys are (currently)
  bounded by `MetaSized` by default but can't be relaxed using
  `?MetaSized` (instead, you relax it by adding `PointeeSized`).
* I've decided against adding any diagnositic notes or suggestions
  for now like "trait `Trait` can't be relaxed as it's not bound by
  default" which would be incorrect for `MetaSized` and assoc tys
  as mentioned above) or "consider changing `?MetaSized` to
  `PointeeSized`" as the Sized Hierarchy impl is still WIP)
2025-07-18 12:13:30 +02:00
León Orell Valerian Liehr
84ed70b69d Reword diagnostics about relaxed bounds in invalid contexts 2025-07-18 12:13:19 +02:00
bors
6caa224a24 Auto merge of #144114 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-07-18 08:44:14 +00:00
Maksim Bondarenkov
8e840f726d opt-dist: make llvm builds optional
adds command line option for disabling llvm builds. it's useful in case of user having their own
optimized LLVM, so they won't waste time for (at least) 3 LLVM builds. in this case PGO optimized
will be already built in Stage 1, so my previous PR should be addressed for this change
2025-07-18 11:20:03 +03:00
Oli Scherer
652ba279ec Show the memory of uninit reads 2025-07-18 07:47:08 +00:00
Laurențiu Nicola
1308726888 Merge pull request #20251 from lnicola/update-lockfile
minor: Update lockfile
2025-07-18 05:50:55 +00:00
bors
6c0a912e5a Auto merge of #144109 - matthiaskrgr:rollup-mz0mrww, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - rust-lang/rust#143271 (Store the type of each GVN value)
 - rust-lang/rust#143293 (fix `-Zsanitizer=kcfi` on `#[naked]` functions)
 - rust-lang/rust#143719 (Emit warning when there is no space between `-o` and arg)
 - rust-lang/rust#143846 (pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests)
 - rust-lang/rust#143891 (Port `#[coverage]` to the new attribute system)
 - rust-lang/rust#143967 (constify `Option` methods)
 - rust-lang/rust#144008 (Fix false positive double negations with macro invocation)
 - rust-lang/rust#144010 (Boostrap: add warning on `optimize = false`)
 - rust-lang/rust#144049 (rustc-dev-guide subtree update)
 - rust-lang/rust#144056 (Copy GCC sources into the build directory even outside CI)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-18 05:43:22 +00:00
Laurențiu Nicola
482b34952d Update lockfile 2025-07-18 08:39:13 +03:00
Matthias Krüger
c22e2ead96 Rollup merge of #144056 - Kobzol:gcc-build-src, r=nikic
Copy GCC sources into the build directory even outside CI

It takes ~3.5s on my Linux notebook to perform the copy, but it should only be executed when we actually go build GCC, and that will almost certainly take much longer :) So I think it should be fine. At least we won't be polluting the source directory for local builds.

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

r? `````@nikic`````
2025-07-18 04:27:55 +02:00
Matthias Krüger
37e7bc1296 Rollup merge of #144049 - tshepang:rust-push, r=jieyouxu
rustc-dev-guide subtree update

r? ghost
2025-07-18 04:27:54 +02:00
Matthias Krüger
3023a287fa Rollup merge of #144010 - xdoardo:bootstrap-warning-optimize-false, r=clubby789
Boostrap: add warning on `optimize = false`

I recently came across a bug that can be traced back to the use of `optimize = false` in `bootstrap.toml` in combination with other settings. Following [this](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Missing.20box-related.20symbols.20with.20panic.20.3D.20'abort'/with/528992909) conversation, this PR adds a warning from `bootstrap` when `optimize = false` is used.

I notice that in the same file I edited there are two different styles for warnings (`WARN`, `Warning`). I used `WARNING` because, by happenstance, when testing I got a `WARNING` that I didn't set a change id: let me know if I can unify the styles in the file I edited.
2025-07-18 04:27:54 +02:00
Matthias Krüger
19ed2f10be Rollup merge of #144008 - anatawa12:fix-double-negations, r=compiler-errors
Fix false positive double negations with macro invocation

This PR fixes false positive double_negations lint when macro expansion has negation and macro caller also has negations.

Fix rust-lang/rust#143980
2025-07-18 04:27:53 +02:00
Matthias Krüger
a7009e93e6 Rollup merge of #143967 - oli-obk:const-option-methods, r=fee1-dead
constify `Option` methods

r? ```````@fee1-dead```````

tracking issue: rust-lang/rust#143956

these unblock making `PartialOrd` and `Ord` const without resorting to inlining some of these at call sites.
2025-07-18 04:27:53 +02:00
Matthias Krüger
03734ae794 Rollup merge of #143891 - scrabsha:push-xxtttopqoprr, r=jdonszelmann
Port `#[coverage]` to the new attribute system

r? ``````@jdonszelmann``````
2025-07-18 04:27:52 +02:00
Matthias Krüger
79c8f90460 Rollup merge of #143846 - usamoi:gc, r=bjorn3
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests

Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`.

Fixes the run-make test to work on Linux. Enable the ui test on more targets.

cc rust-lang/rust#84161
2025-07-18 04:27:52 +02:00
Matthias Krüger
26f5936cf9 Rollup merge of #143719 - xizheyin:142812-1, r=jieyouxu
Emit warning when there is no space between `-o` and arg

Closes rust-lang/rust#142812

`getopt` doesn't seem to have an API to check this, so we have to check the args manually.

r? compiler
2025-07-18 04:27:51 +02:00