33775 Commits

Author SHA1 Message Date
David Richey
18a678e693 Drop support for stitched sysroot 2025-02-26 14:18:52 -06:00
David Richey
ca5a35e97f Allow rust-project.json to specify sysroot workspace 2025-02-26 14:18:48 -06:00
Laurențiu Nicola
1795a85be3
Merge pull request #19220 from Shourya742/2025-02-24-nit-setup-doc
doc: remove nit from setup.md
2025-02-26 15:31:24 +00:00
bors
99f08466a7 Auto merge of #137354 - 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
Laurențiu Nicola
e039ae794d Use cargo zigbuild for releases 2025-02-26 14:16:09 +02:00
Lukas Wirth
95286193e0
Merge pull request #19225 from Giga-Bowser/remove-assists
internal: Migrate some low-hanging `remove_*` assists to `SyntaxEditor`
2025-02-26 11:54:31 +00:00
bors
513eac70b7 Auto merge of #137036 - 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 #136701 (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 #136701, 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
Chayim Refael Friedman
2f5e8d7879
Merge pull request #19204 from kazatsuyu/allow-package-specific-feature
Allow "package/feature" format feature flag
2025-02-26 06:01:12 +00:00
bors
7b46a77f2e Auto merge of #136921 - Kobzol:gcc-build, r=onur-ozkan
Build GCC on CI

Previously, we have downloaded a specific commit of GCC and prebuilt it inside Docker using the `build-gccjit.sh` script. This PR removes that scripts and uses the bootstrap GCC step. This allows us to use the `src/gcc` submodule for determining which GCC should be built, and it also moves the logic closer to LLVM, which is also built by bootstrap.

A few things to note:
- The `sccache` option is currently in the `llvm` block, so the GCC build uses `llvm.ccache`, which is a bit weird :) We could either add `gcc.ccache`, or (what I think would be better) to just move `ccache` to the `build` section, as I don't think that it will be necessary to use ccache for LLVM, but not for GCC.
- When the GCC codegen backend is built, it needs to depend on a step that first builds GCC. This is currently done in a hacky way. The proper solution is to create a separate step for the GCC codegen backend, but that is a larger change. Let me know what you think.

r? `@onur-ozkan`

try-job: i686-msvc-1
try-job: x86_64-mingw-1
2025-02-26 03:04:21 +00:00
Giga Bowser
f155aef64d internal: Migrate remove_unused_param assist to SyntaxEditor 2025-02-25 11:52:13 -05:00
Giga Bowser
93c9f06870 fix: Properly handle removals in SyntaxEditor 2025-02-25 11:52:13 -05:00
Giga Bowser
6dda2e81c6 internal: Migrate remove_parentheses assist to SyntaxEditor 2025-02-25 11:52:13 -05:00
Giga Bowser
daca6b88c4 internal: Migrate remove_mut assist to SyntaxEditor 2025-02-25 11:52:13 -05:00
Giga Bowser
b4f2d62952 internal: Improve reporting of intersecting changes 2025-02-25 11:46:45 -05:00
bors
b1878dcd01 Auto merge of #133832 - madsmtm:apple-symbols.o, r=DianQK
Make `#[used]` work when linking with `ld64`

To make `#[used]` work in static libraries, we use the `symbols.o` trick introduced in https://github.com/rust-lang/rust/pull/95604.

However, the linker shipped with Xcode, ld64, works a bit differently from other linkers; in particular, [it completely ignores undefined symbols by themselves](https://github.com/apple-oss-distributions/ld64/blob/ld64-954.16/src/ld/parsers/macho_relocatable_file.cpp#L2455-L2468), and only consider them if they have relocations (something something atoms something fixups, I don't know the details).

So to make the `symbols.o` file work on ld64, we need to actually insert a relocation. That's kinda cumbersome to do though, since the relocation must be valid, and hence must point to a valid piece of machine code, and is hence very architecture-specific.

Fixes https://github.com/rust-lang/rust/issues/133491, see that for investigation.

---

Another option would be to pass `-u _foo` to the final linker invocation. This has the problem that `-u` causes the linker to not be able to dead-strip the symbol, which is undesirable. (If we did this, we would possibly also want to do it by putting the arguments in a file by itself, and passing that file via ``@`,` e.g. ``@undefined_symbols.txt`,` similar to https://github.com/rust-lang/rust/issues/52699, though that [is only supported since Xcode 12](https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes#Linking), and I'm not sure we wanna bump that).

Various other options that are probably all undesirable as they affect link time performance:
- Pass `-all_load` to the linker.
- Pass `-ObjC` to the linker (the Objective-C support in the linker has different code paths that load more of the binary), and instrument the binaries that contain `#[used]` symbols.
- Pass `-force_load` to libraries that contain `#[used]` symbols.

Failed attempt: Embed `-u _foo` in the object file with `LC_LINKER_OPTION`, akin to https://github.com/rust-lang/rust/issues/121293. Doesn't work, both because `ld64` doesn't read that from archive members unless it already has a reason to load the member (which is what this PR is trying to make it do), and because `ld64` only support the `-l`, `-needed-l`, `-framework` and `-needed_framework` flags in there.

---

TODO:
- [x] Support all Apple architectures.
- [x] Ensure that this works regardless of the actual type of the symbol.
- [x] Write up more docs.
- [x] Wire up a few proper tests.

`@rustbot` label O-apple
2025-02-25 11:59:11 +00:00
Lukas Wirth
8925544998
Merge pull request #19223 from ChayimFriedman2/implied-target-feature
fix: Support target features implications in target_feature 1.1
2025-02-25 08:02:50 +00:00
Chayim Refael Friedman
7c5524c854 Disable typos checker for the target feature names 2025-02-25 05:02:17 +02:00
Chayim Refael Friedman
87ed04bac0 Support target features implications in target_feature 1.1
We vendor the list of implications, which isn't nice, but t-compiler doesn't want to make rustc_target available to us.
2025-02-25 04:50:26 +02:00
bit-aloo
9526d8bfe9
doc: remove nit from setup.md 2025-02-25 07:37:16 +05:30
bors
9e280ab91c Auto merge of #135726 - jdonszelmann:attr-parsing, r=oli-obk
New attribute parsing infrastructure

Another step in the plan outlined in https://github.com/rust-lang/rust/issues/131229

introduces infrastructure for structured parsers for attributes, as well as converting a couple of complex attributes to have such structured parsers.

This PR may prove too large to review. I left some of my own comments to guide it a little. Some general notes:

- The first commit is basically standalone. It just preps some mostly unrelated sources for the rest of the PR to work. It might not have enormous merit on its own, but not negative merit either. Could be merged alone, but also doesn't make the review a whole lot easier. (but it's only +274 -209)
- The second commit is the one that introduces new infrastructure. It's the important one to review.
- The 3rd commit uses the new infrastructure showing how some of the more complex attributes can be parsed using it. Theoretically can be split up, though the parsers in this commit are the ones that really test the new infrastructure and show that it all works.
- The 4th commit fixes up rustdoc and clippy. In the previous 2 they didn't compile yet while the compiler does. Separated them out to separate concerns and make the rest more palatable.
- The 5th commit blesses some test outputs. Sometimes that's just because a diagnostic happens slightly earlier than before, which I'd say is acceptable. Sometimes a diagnostic is now only emitted once where it would've been twice before (yay! fixed some bugs). One test I actually moved from crashes to fixed, because it simply doesn't crash anymore. That's why this PR  Closes #132391. I think most choices I made here are generally reasonable, but let me know if you disagree anywhere.
- The 6th commit adds a derive to pretty print attributes
- The 7th removes smir apis for attributes, for the time being. The api will at some point be replaced by one based on `rustc_ast_data_structures::AttributeKind`

In general, a lot of the additions here are comments. I've found it very important to document new things in the 2nd commit well so other people can start using it.

Closes #132391
Closes #136717
2025-02-24 23:07:24 +00:00
Laurențiu Nicola
3bb49be89a
Merge pull request #19221 from Giga-Bowser/generate-trait-impl-tabstop
minor: Add tabstop to impl body in `generate_trait_impl` assist
2025-02-24 19:15:53 +00:00
Giga Bowser
6739652af7 minor: Add tabstop to impl body in generate_trait_impl assist 2025-02-24 13:58:34 -05:00
Lukas Wirth
f6edb7178e
Merge pull request #19171 from ShoyuVanilla/migrate-de-morgan-assist
internal: Migrate `apply_demorgan` to `SyntaxEditor`
2025-02-24 13:57:56 +00:00
Lukas Wirth
93bd36dfb9
Merge pull request #18987 from ChayimFriedman2/drop-glue
feat: Calculate drop glue and show it on hover
2025-02-24 13:52:17 +00:00
bors
d6d6d19841 Auto merge of #137523 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-02-24 13:45:40 +00:00
Shoyu Vanilla
a0b9931832 Add take() method to SyntaxEditor 2025-02-24 22:42:57 +09:00
Shoyu Vanilla
bf0c3944f8 Migrate apply_demorgan to SyntaxEditor 2025-02-24 22:41:53 +09:00
Shoyu Vanilla
f06f1b81bb Migrate some leftovers in add_missing_match_arms 2025-02-24 22:41:52 +09:00
Lukas Wirth
e2c281aaae
Merge pull request #19219 from Veykril/push-rvosplwpwqqt
Vendor `always-assert` into `stdx`
2025-02-24 13:15:39 +00:00
Lukas Wirth
b0380dbfbc
Merge pull request #19211 from Timmmm/user/timh/import_private
Include private items in completions for local crates
2025-02-24 13:13:31 +00:00
Lukas Wirth
f63f845783
Merge pull request #19197 from andylokandy/insta
feat: update insta inline snapshot when clicking 'Update Test' runnable
2025-02-24 13:11:45 +00:00
Lukas Wirth
b7e7893bf6
Merge pull request #19218 from Veykril/push-vqsronpuvrnx
Disable incremental on release builds
2025-02-24 13:08:20 +00:00
Lukas Wirth
9a462b7c36 Vendor always-assert 2025-02-24 14:00:34 +01:00
Lukas Wirth
bd8a601ab3 Disable incremental on release builds 2025-02-24 13:52:46 +01:00
Laurențiu Nicola
b3ee3a96a2
Merge pull request #19217 from lnicola/event-name
Fix `event_name` check is workflows
2025-02-24 12:41:58 +00:00
Laurențiu Nicola
e41d21e221
Merge pull request #19216 from lnicola/ubuntu-22.04
internal: Downgrade to ubuntu-22.04 for aarch64 and arm builds
2025-02-24 12:27:45 +00:00
Laurențiu Nicola
604c4a989e Fix event_name check in workflows 2025-02-24 14:27:11 +02:00
Laurențiu Nicola
74e77188b6 Downgrade to ubuntu-22.04 for aarch64-unknown-linux-gnu and arm-unknown-linux-gnueabihf builds 2025-02-24 14:11:12 +02:00
Laurențiu Nicola
b7665066c9
Merge pull request #19212 from lnicola/sync-from-rust
minor: sync from downstream
2025-02-24 08:45:06 +00:00
Laurențiu Nicola
c96554a622 Update assist docs 2025-02-24 10:28:52 +02:00
Laurențiu Nicola
f641813e07 Format code 2025-02-24 10:28:46 +02:00
Laurențiu Nicola
a5bf2d5604 Add rustc_hashes and bump the others 2025-02-24 10:10:51 +02:00
Laurențiu Nicola
807aa45e0a Merge from rust-lang/rust 2025-02-24 09:42:57 +02:00
Laurențiu Nicola
6f2bd412e3 Preparing for merge from rust-lang/rust 2025-02-24 09:42:28 +02:00
bors
849a2bb8ff Auto merge of #137285 - yotamofek:pr/rustdoc/pulldown-escaping, r=GuillaumeGomez
librustdoc: Use `pulldown-cmark-escape` for HTML escaping

Implementation of `@notriddle` 's [suggestion](https://github.com/rust-lang/rust/pull/137274#issuecomment-2669001585).
Somewhat related to #137274 , but the two PRs should be complementary.

Local perf results look like a nice improvement! (so would love a perf run on the CI)
2025-02-24 07:11:04 +00:00
bors
f73bcd16a7 Auto merge of #137271 - nikic:gep-nuw-2, r=scottmcm
Emit getelementptr inbounds nuw for pointer::add()

Lower pointer::add (via intrinsic::offset with unsigned offset) to getelementptr inbounds nuw on LLVM versions that support it. This lets LLVM make use of the pre-condition that the offset addition does not wrap in an unsigned sense. Together with inbounds, this also implies that the offset is non-negative.

Fixes https://github.com/rust-lang/rust/issues/137217.
2025-02-24 03:06:16 +00:00
bors
b2be990003 Auto merge of #137476 - onur-ozkan:137469, r=jieyouxu
avoid `compiler_for` for dist tools and force the current compiler

Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler.

Fixes https://github.com/rust-lang/rust/issues/137469
2025-02-23 20:32:32 +00:00
Lukas Wirth
6d68c475c7
Merge pull request #19191 from Veykril/push-yzzlosskwrxs
Remove `limit` crate in favor `usize`
2025-02-24
2025-02-23 16:50:32 +00:00
Lukas Wirth
0b2e8166a1 Remove limit crate in favor usize 2025-02-23 17:35:09 +01:00
bors
264d948652 Auto merge of #137225 - RalfJung:vectorcall, r=nnethercote
vectorcall ABI: require SSE2

According to the official docs at https://learn.microsoft.com/en-us/cpp/cpp/vectorcall, SSE2 is required for this ABI. Add a check that enforces this.

I put this together with the other checks ensuring the target features required for a function are present... however, since the ABI is known pre-monomorphization, it would be possible to do this check earlier, which would have the advantage of checking even in `cargo check`. It would have the disadvantage of spreading this code in yet more places.

The first commit just does a little refactoring of the mono-time ABI check to make it easier to add the new check.

Cc `@workingjubilee`

try-job: dist-i586-gnu-i586-i686-musl
2025-02-23 14:12:38 +00:00