Commit Graph

282516 Commits

Author SHA1 Message Date
Jakub Beránek
9d6ca5f286 Ignore a-b-a-linker-guard during cross-compilation 2025-03-01 22:11:14 +01:00
Jakub Beránek
0034d6c928 Compile run-make recipes using the stage0 compiler 2025-03-01 22:11:02 +01:00
Jakub Beránek
4af94f842d Implement RunMake test suite using the test! macro 2025-02-28 16:44:04 +01:00
Jakub Beránek
807f6ffa91 Implement RunMakeSupport tool using the bootstrap_tool! macro 2025-02-28 16:44:03 +01:00
Jakub Beránek
96a91975f1 Allow specifying that tools build a library, not a binary 2025-02-28 16:44:03 +01:00
Jakub Beránek
6563437773 Create the OptimizedDist tool with a macro 2025-02-28 16:44:03 +01:00
bors
2f581937e1 Auto merge of - ChrisDenton:remove-sdk, r=Kobzol
Remove latest Windows SDK from 32-bit CI

This is an alternative to , in case that doesn't work. It is in some ways simpler but is less principled and may be more flaky (as it involves deleting stuff).

try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: dist-i686-msvc
2025-02-28 10:12:31 +00:00
Chris Denton
25617c7e69
Remove Win SDK 10.0.26100.0 from CI 2025-02-28 09:13:00 +00:00
bors
cb08599451 Auto merge of - matthiaskrgr:rollup-3vmxxu9, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 -  ([`compiletest`-related cleanups 4/7] Make the distinction between root build directory vs test suite specific build directory in compiletest less confusing)
 -  (Fix UB in ThinVec::flat_map_in_place)
 -  (require trait impls to have matching const stabilities as the traits)
 -  (Make `AssocOp` more like `ExprKind`)
 -  (add `IntoBounds::intersect` and `RangeBounds::is_empty`)
 -  (Reuse machinery from `tail_expr_drop_order` for `if_let_rescope`)
 -  (Return unexpected termination error instead of panicing in `Thread::join`)
 -  (Spruce up `AttributeKind` docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-28 03:52:52 +00:00
Chris Denton
f3399516fa
Revert "Fix 32-bit MSVC CI"
This reverts commit 6ea4823733.
2025-02-28 00:47:45 +00:00
bors
e6059f5222 Auto merge of - DianQK:fn-atts-virtual, r=saethlin
Don't infer attributes of virtual calls based on the function body

Fixes (after backport) .
Since we don't know the exact implementation of the virtual call, it might write to parameters, we can't infer the readonly attribute.
2025-02-28 00:31:26 +00:00
bors
f45d4acf1b Auto merge of - Kobzol:fix-ci-2, r=Kobzol
Fix 32-bit MSVC CI

By throwing more hardware at it. The large runners should still use the old image. This could buy us a couple of... hours? Days? Who knows.

See https://github.com/rust-lang/rust/issues/137733 for context.

r? `@ghost`

try-job: i686-msvc-1
try-job: i686-msvc-2
try-job: dist-i686-msvc
2025-02-27 20:40:04 +00:00
Jakub Beránek
6ea4823733 Fix 32-bit MSVC CI
By throwing more hardware at it.
2025-02-27 21:36:28 +01:00
Matthias Krüger
89a202d179
Rollup merge of - aDotInTheVoid:aDotInTheVoid-patch-1, r=jdonszelmann
Spruce up `AttributeKind` docs

- Remove dead link to `rustc_attr` crate.
- Add link to `rustc_attr_parsing` crate.
- Split up first paragraph so it looks better at crate-level summary

r? `@jdonszelmann`
2025-02-27 08:56:40 +01:00
Matthias Krüger
f19d4b5f97
Rollup merge of - fuzzypixelz:fix/124466, r=workingjubilee
Return unexpected termination error instead of panicing in `Thread::join`

There is a time window during which the OS can terminate a thread before stdlib can retreive its `Packet`. Currently the `Thread::join` panics with no message in such an event, which makes debugging difficult; fixes .
2025-02-27 08:56:39 +01:00
Matthias Krüger
25db95ec4a
Rollup merge of - compiler-errors:drop-lint-dtor, r=oli-obk
Reuse machinery from `tail_expr_drop_order` for `if_let_rescope`

Namely, it defines its own `extract_component_with_significant_dtor` which is a bit more accurate than `Ty::has_significant_drop`, since it has a hard-coded list of types from the ecosystem which are opted out of the lint.[^a]

Also, since we extract the dtors themselves, adopt the same *label* we use in `tail_expr_drop_order` to point out the destructor impl. This makes it much clear what's actually being dropped, so it should be clearer to know when it's a false positive.

This conflicts with , but I will rebase whichever lands first.

[^a]: Side-note, it's kinda a shame that now there are two functions that presumably do the same thing. But this isn't my circus, nor are these my monkeys.
2025-02-27 08:56:39 +01:00
Matthias Krüger
3499846073
Rollup merge of - pitaj:rangebounds-is_empty-intersect, r=ibraheemdev
add `IntoBounds::intersect` and `RangeBounds::is_empty`

- ACP: https://github.com/rust-lang/libs-team/issues/539
- Tracking issue for `is_empty`: 
- Tracking issue for `IntoBounds`: 
2025-02-27 08:56:38 +01:00
Matthias Krüger
4ecca4c09c
Rollup merge of - nnethercote:make-AssocOp-more-like-ExprKind, r=spastorino
Make `AssocOp` more like `ExprKind`

This is step 1 of [MCP 831](https://github.com/rust-lang/compiler-team/issues/831).

r? ``@estebank``
2025-02-27 08:56:37 +01:00
Matthias Krüger
88dcab75b0
Rollup merge of - fee1-dead-contrib:push-nppsusmpokqo, r=compiler-errors
require trait impls to have matching const stabilities as the traits

This resolves https://github.com/rust-lang/project-const-traits/issues/5 by implementing the suggested solution in the given thread

r? ``@RalfJung``
cc ``@rust-lang/project-const-traits``
2025-02-27 08:56:36 +01:00
Matthias Krüger
18c47ad639
Rollup merge of - bjorn3:fix_thinvec_ext_ub, r=BoxyUwU
Fix UB in ThinVec::flat_map_in_place

`thin_vec.as_ptr()` goes through the `Deref` impl of `ThinVec`, which will not allow access to any memory as we did call `set_len(0)` first.

Found in the process of investigating https://github.com/rust-lang/rust/issues/135870.
2025-02-27 08:56:36 +01:00
Matthias Krüger
f435138da9
Rollup merge of - jieyouxu:build-base, r=onur-ozkan
[`compiletest`-related cleanups 4/7] Make the distinction between root build directory vs test suite specific build directory in compiletest less confusing

Reference for overall changes: https://github.com/rust-lang/rust/pull/136437
Part **4** of **7** of the *`compiletest`-related cleanups* PR series.

### Summary

- Remove `--build-base` compiletest flag, and introduce `--build-{root,test-suite-root}` flags instead. `--build-base` previously actually is test suite specific build directory, not the root `build/` directory.
- Feed the root build directory directly from bootstrap to compiletest via `--build-root` instead of doing multiple layers of parent unwrapping[^parent] based on the test suite specific build directory.
- Remove a redundant `to_path_buf()`.

[^parent]: Please do not unwrap the parents.

r? bootstrap
2025-02-27 08:56:35 +01:00
DianQK
fbe0075a86
Don't infer unwinding of virtual calls based on the function attributes 2025-02-27 12:58:18 +08:00
DianQK
8089fce101
Don't infer attributes of virtual calls based on the function body 2025-02-27 12:57:26 +08:00
Deadbeef
ef66cbb27b require trait impls to have matching const stabilities as the traits 2025-02-27 04:56:27 +00:00
bors
96cfc75584 Auto merge of - the8472:remove-randomize-exclusion1, r=onur-ozkan
fixed wast version was released, remove randomization exemption
2025-02-27 01:37:30 +00:00
Nicholas Nethercote
2ac46f6517 Rename AssocOp::As as AssocOp::Cast.
To match `ExprKind::Cast`, and because a semantic name makes more sense
here than a syntactic name.
2025-02-27 09:53:18 +11:00
Nicholas Nethercote
fc8e87b274 Replace AssocOp::DotDot{,Eq} with AssocOp::Range.
It makes `AssocOp` more similar to `ExprKind` and makes things a little
simpler. And the semantic names make more sense here than the syntactic
names.
2025-02-27 09:53:18 +11:00
Nicholas Nethercote
ceafbad81f Introduce AssocOp::Binary.
It mirrors `ExprKind::Binary`, and contains a `BinOpKind`. This makes
`AssocOp` more like `ExprKind`. Note that the variants removed from
`AssocOp` are all named differently to `BinOpToken`, e.g. `Multiply`
instead of `Mul`, so that's an inconsistency removed.

The commit adds `precedence` and `fixity` methods to `BinOpKind`, and
calls them from the corresponding methods in `AssocOp`. This avoids the
need to create an `AssocOp` from a `BinOpKind` in a bunch of places, and
`AssocOp::from_ast_binop` is removed.

`AssocOp::to_ast_binop` is also no longer needed.

Overall things are shorter and nicer.
2025-02-27 09:53:17 +11:00
Nicholas Nethercote
a8364f3b2a In AssocOp::AssignOp, use BinOpKind instead of BinOpToken
`AssocOp::AssignOp` contains a `BinOpToken`. `ExprKind::AssignOp`
contains a `BinOpKind`. Given that `AssocOp` is basically a cut-down
version of `ExprKind`, it makes sense to make `AssocOp` more like
`ExprKind`. Especially given that `AssocOp` and `BinOpKind` use semantic
operation names (e.g. `Mul`, `Div`), but `BinOpToken` uses syntactic
names (e.g. `Star`, `Slash`).

This results in more concise code, and removes the need for various
conversions. (Note that the removed functions `hirbinop2assignop` and
`astbinop2assignop` are semantically identical, because `hir::BinOp` is
just a synonum for `ast::BinOp`!)

The only downside to this is that it allows the possibility of some
nonsensical combinations, such as `AssocOp::AssignOp(BinOpKind::Lt)`.
But `ExprKind::AssignOp` already has that problem. The problem can be
fixed for both types in the future with some effort, by introducing an
`AssignOpKind` type.
2025-02-27 09:47:22 +11:00
Alona Enraght-Moony
df845c97f3 Spruce up AttributeKind docs
- Remove dead link to `rustc_attr` crate.
- Add link to `rustc_attr_parsing` crate.
- Split up first paragraph so it looks better at crate-level summary
2025-02-26 22:21:36 +00:00
bors
00f245915b Auto merge of - fmease:rollup-gbeuj9j, r=fmease
Rollup of 10 pull requests

Successful merges:

 -  (remove `MaybeUninit::uninit_array`)
 -  (Use less CString in the examples of CStr.)
 -  (Teach structured errors to display short `Ty<'_>`)
 -  (Fix `attr` cast for espidf)
 -  (Avoid collecting associated types for undefined trait)
 -  (Don't suggest constraining unstable associated types)
 -  (Rustc dev guide subtree update)
 -  (Update gcc submodule)
 -  (revert accidental change in get_closest_merge_commit)
 -  (Make -Z unpretty=mir suggest -Z dump-mir as well for discoverability)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-26 20:21:40 +00:00
Michael Goulet
864cca80b0 Print out destructor 2025-02-26 19:03:29 +00:00
León Orell Valerian Liehr
46eb43e71b
Rollup merge of - meithecatte:discoverable-dump-mir, r=Nadrieril
Make -Z unpretty=mir suggest -Z dump-mir as well for discoverability

While debugging something else, I got quite annoyed with `-Z unpretty=mir` showing me post-processed MIR instead of the one just after it is built. I ended up asking on Zulip and got pointed to `-Z dump-mir`. While this feature is documented in the rustc dev guide, I think it'd be good if the possibility of making use of it was staring you in the face while you need it.
2025-02-26 19:03:59 +01:00
León Orell Valerian Liehr
526dd27b4d
Rollup merge of - RalfJung:llvm-commit-logic-revert, r=Kobzol
revert accidental change in get_closest_merge_commit

This was accidentally merged as part of https://github.com/rust-lang/rust/pull/137594. I need this local diff to be able to debug miri syncs, and then typed `git commit -a` too fast and didn't realize it includes this change... sorry for that.

r? ``@Kobzol``
2025-02-26 19:03:58 +01:00
León Orell Valerian Liehr
bd9e38df98
Rollup merge of - Kobzol:gcc-update, r=GuillaumeGomez
Update gcc submodule

To add support for the x87 feature (see https://github.com/rust-lang/rust/pull/137612#issuecomment-2683303111).

r? `@antoyo`
2025-02-26 19:03:58 +01:00
León Orell Valerian Liehr
0ae0110083
Rollup merge of - BoxyUwU:rdg-push, r=Kobzol
Rustc dev guide subtree update

r? ``@Kobzol`` ``@jieyouxu``
2025-02-26 19:03:57 +01:00
León Orell Valerian Liehr
875e390589
Rollup merge of - compiler-errors:constrain-unstable, r=SparrowLii
Don't suggest constraining unstable associated types

Fixes 

This could be made a bit more specific, considering the local crate's stability or nightly status or something, but I think in general we should not be suggesting associated type bounds on unstable associated items.
2025-02-26 19:03:57 +01:00
León Orell Valerian Liehr
2fc88233cd
Rollup merge of - TaKO8Ki:issue-137508, r=compiler-errors
Avoid collecting associated types for undefined trait

Fixes 
Fixes 
2025-02-26 19:03:56 +01:00
León Orell Valerian Liehr
c5d57274c0
Rollup merge of - SergioGasquez:fix/espidf-maybeunit, r=ChrisDenton
Fix `attr` cast for espidf

https://github.com/rust-lang/rust/pull/136826 broke ESP-IDF builds with: https://github.com/esp-rs/esp-idf-template/actions/runs/13516221587/job/37765336588.

This PR fixes it.

cc: ``@ivmarkov`` ``@xizheyin``
2025-02-26 19:03:55 +01:00
León Orell Valerian Liehr
5da5c37387
Rollup merge of - estebank:structured-errors-long-ty, r=oli-obk
Teach structured errors to display short `Ty<'_>`

Make it so that in every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to.

```
error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)``
 --> long.rs:7:5
  |
6 | fn foo(x: D) { //~ `x` has type `(...
  |        - `x` has type `((..., ..., ..., ...), ..., ..., ...)`
7 |     x(); //~ ERROR expected function, found `(...
  |     ^--
  |     |
  |     call expression requires function
  |
  = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt'
  = note: consider using `--verbose` to print the full type name to the console
```

Follow up to and response to the comments on .

r? ``@oli-obk``
2025-02-26 19:03:55 +01:00
León Orell Valerian Liehr
f3a445bf75
Rollup merge of - hkBst:patch-27, r=workingjubilee
Use less CString in the examples of CStr.

Fixes 
2025-02-26 19:03:54 +01:00
León Orell Valerian Liehr
bcfff3d40a
Rollup merge of - cyrgani:uninit_array, r=Amanieu
remove `MaybeUninit::uninit_array`

Closes .
Closes .
The future of this unstable method was described in https://github.com/rust-lang/rust/pull/125082#issuecomment-2161242816. Since `inline_const` was stabilized in 1.79 (4 stable releases away) and no one expressed interest for keeping it in https://github.com/rust-lang/rust/issues/96097, I think it can be removed now as it is not a stable method.
2025-02-26 19:03:53 +01:00
bjorn3
3477297c37 Fix UB in ThinVec::flat_map_in_place
thin_vec.as_ptr() goes through the Deref impl of ThinVec, which will
not allow access to any memory as we did call set_len(0) first.
2025-02-26 15:49:19 +00:00
bors
ac91805f31 Auto merge of - FractalFir:intern_with_cap, r=FractalFir
Change interners to start preallocated with an increased capacity

Inspired by https://github.com/rust-lang/rust/issues/137005.

Added a `with_capacity` function to `InternedSet`. Changed the `CtxtInterners` to start with `InternedSets` preallocated with a capacity.

This *does* increase memory usage at very slightly(by ~1 MB at the start), altough that increase quickly disaperars for larger crates(since they require such capacity anyway).

A local perf run indicates this improves compiletimes for small crates(like `ripgrep`), without a negative effect on larger ones.
2025-02-26 13:01:45 +00:00
Ralf Jung
bab71fc8d6 revert accidental change in get_closest_merge_commit 2025-02-26 13:35:51 +01:00
Maja Kądziołka
b8c7e8aa72
Make -Z unpretty=mir suggest -Z dump-mir as well 2025-02-26 13:07:12 +01:00
DianQK
28d3fef399
Add a test case for 2025-02-26 19:54:34 +08:00
bors
2af87eab3b Auto merge of - jieyouxu:drivers-license, r=Kobzol
Include version number of libs being built in cargo lib metadata (esp. `librustc_driver*.so`)

Previously, on a non-stable channel, it's possible for two builds from different versioned sources (e.g. 1.84.0 vs 1.84.1) to produce a `librustc_driver*.so` with the same filename hashes. This causes problems with side-by-side installs wrt. linker search paths because 1.84.1 rustc bin and 1.84.0 rustc bin may try to link to the "same" `librustc_driver*.so` (same filename hash) but fail because the contents of the so is actually different.

We try to mitigate this by including the version number of artifacts being built via `__CARGO_DEFAULT_LIB_METADATA` (kind of an ugly hack, but I don't think cargo has a way for us to tell cargo to use a package version override).

Fixes  (mitigates, really).

### Testing

Tested manually[^host] by:

```bash
$ cat src/version
1.86.0
$ ./x build library # w/ compiler profile, (non-stable) dev channel
$ lddtree build/host/stage1/bin/rustc
rustc => build/host/stage1/bin/rustc (interpreter => /lib64/ld-linux-x86-64.so.2)
    librustc_driver-ea1b1b2291881cc4.so => build/host/stage1/bin/../lib/librustc_driver-ea1b1b2291881cc4.so
[...]
```

and observing that changing `src/version` to bump a point release causes `librustc_driver*.so` to have a different hash while sources are unmodified otherwise.

```bash
$ cat src/version
1.86.1
$ ./x build library # w/ compiler profile, (non-stable) dev channel
$ lddtree build/host/stage1/bin/rustc
rustc => build/host/stage1/bin/rustc (interpreter => /lib64/ld-linux-x86-64.so.2)
    librustc_driver-746badadbcb74721.so => build/host/stage1/bin/../lib/librustc_driver-746badadbcb74721.so
[...]
```

cc `@clan` `@demize` could you check that if you backport this change against 1.84.{0,1} as reported in , that the produced `rustc` binary works, under the context of the Gentoo build system setup?

[^host]: on a `x86_64-unknown-linux-gnu` host, no cross
2025-02-26 09:42:41 +00:00
Jakub Beránek
ee8ed8c207
Update gcc submodule
To add support for the x87 feature.
2025-02-26 09:23:52 +01:00
bors
2b3cef882a Auto merge of - fmease:rollup-s3s7m6f, r=fmease
Rollup of 14 pull requests

Successful merges:

 -  (pass optimization level to llvm-bitcode-linker)
 -  (Add UTF-8 validation fast paths in `Wtf8Buf`)
 -  (Enable `f16` for MIPS)
 -  (fix(rustdoc): Fixed stability version in rustdoc)
 -  (remove few unused args)
 -  (tests: Add regression test for derive token invalidation ())
 -  (run some tests on emscripten again)
 -  (ssa/mono: deduplicate `type_has_metadata`)
 -  (codegen_llvm: avoid `Deref` impls w/ extern type)
 -  (trait_sel: resolve vars in host effects)
 -  (Complete the list of resources used in rustdoc output)
 -  (hir_analysis: skip self type of host effect preds in variances_of)
 -  (fix doc in library/core/src/pin.rs)
 -  (fix attribute-related ICE when parsing macro on the rhs of a name-value attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-26 06:21:59 +00:00