Commit Graph

285822 Commits

Author SHA1 Message Date
Gary Guo
f482460f92 Handle asm const similar to inline const 2025-02-26 19:27:19 +00:00
Michael Goulet
864cca80b0 Print out destructor 2025-02-26 19:03:29 +00:00
Noratrieb
a954c51280 Support raw-dylib link kind on ELF
raw-dylib is a link kind that allows rustc to link against a library
without having any library files present.
This currently only exists on Windows. rustc will take all the symbols
from raw-dylib link blocks and put them in an import library, where they
can then be resolved by the linker.

While import libraries don't exist on ELF, it would still be convenient
to have this same functionality. Not having the libraries present at
build-time can be convenient for several reasons, especially
cross-compilation. With raw-dylib, code linking against a library can be
cross-compiled without needing to have these libraries available on the
build machine. If the libc crate makes use of this, it would allow
cross-compilation without having any libc available on the build
machine. This is not yet possible with this implementation, at least
against libc's like glibc that use symbol versioning.
The raw-dylib kind could be extended with support for symbol versioning
in the future.

This implementation is very experimental and I have not tested it very
well. I have tested it for a toy example and the lz4-sys crate, where it
was able to successfully link a binary despite not having a
corresponding library at build-time.
2025-02-26 19:09:51 +01:00
León Orell Valerian Liehr
46eb43e71b Rollup merge of #137671 - 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 #137670 - 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 #137660 - 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 #137642 - 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 #137635 - compiler-errors:constrain-unstable, r=SparrowLii
Don't suggest constraining unstable associated types

Fixes #137624

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 #137631 - TaKO8Ki:issue-137508, r=compiler-errors
Avoid collecting associated types for undefined trait

Fixes #137508
Fixes #137554
2025-02-26 19:03:56 +01:00
León Orell Valerian Liehr
c5d57274c0 Rollup merge of #137620 - 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 #137201 - 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 #136898.

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

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

Closes #134584.
Closes #66845.
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
Michael Goulet
ad74788670 Use bound_coroutine_witnesses in old solver 2025-02-26 17:32:53 +00:00
Michael Goulet
8282181e42 Use Binder<Vec<T>> instead of Vec<Binder<T>> in new solver 2025-02-26 17:32:26 +00:00
Gary Guo
6e4adbed76 Remove visit_const_block in typeck writeback
There is a `visit_inline_const` visitor method and it is used instead.
2025-02-26 17:13:32 +00:00
Guillaume Gomez
46a39f0b27 Add new Rustdoc::emit method in run-make-support 2025-02-26 17:13:48 +01:00
Guillaume Gomez
98eb2e3e5a Add rustdoc support for --emit=dep-info[=path] 2025-02-26 17:13:30 +01:00
Guillaume Gomez
745297e7aa Use helper function instead of reimplementing the logic to check if rustdoc should emit crate 2025-02-26 17:08:35 +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
Laurențiu Nicola
444ce09d53 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
bjorn3
169e731f53 Fix unused import in coretests on wasm32 2025-02-26 15:11:05 +00:00
bjorn3
b491494a20 Also test coretests when running ./x.py test core
It is reasonable to expect that ./x.py test core is enough to run tests
when you are working on core. In addition it seems like CI for wasm32 at
least doesn't run coretests currently, which this commit fixes.
2025-02-26 15:11:05 +00:00
Alejandra González
b583568e72 Add unnecessary_debug_formatting lint (#13893)
Fixes #12674, i.e., adds a lint to flag `Path`s printed with `{:?}`.

Nits are welcome.

changelog: Add `unnecessary_debug_formatting` lint
2025-02-26 15:03:57 +00:00
bjorn3
b60aeb05dd Stop passing --lib to cargo test
This overrides the test=false flag in Cargo.toml and it shouldn't be
necessary as --tests is already passed.
2025-02-26 14:52:56 +00:00
Vadim Petrochenkov
9a2362a76e linker: Fix escaping style for response files on Windows
If we use a С/С++ compiler as linker, then Posix-style escaping should be used.
2025-02-26 17:45:08 +03:00
Alex Macleod
b821f972b6 manual_strip: use existing identifier instead of placeholder (#14188)
When the manually stripped entity receives a name as the first use
through a simple `let` statement, this name can be used in the generated
`if let Some(…)` expression instead of a placeholder.

Fix #14183

changelog: [`manual_strip`]: reuse existing identifier in suggestion
when possible
2025-02-26 14:41:41 +00:00
Samuel Moelius
6af901c51e Add unnecessary_debug_formatting lint
Address review comments

Fix adjacent code

Required now that the lint is pedantic

Add inline formatting tests

Add note re formatting changes

Address `unnecessary_map_or` warnings

Address additional review comments

Typo

Update Clippy version
2025-02-26 14:25:58 +00:00
Ralf Jung
ef2d53973f Merge pull request #4213 from oli-obk/push-oqrnvmlnzsnw
Update ui test
2025-02-26 14:22:08 +00:00
Chris Denton
4fcebee60a Fix Windows Command search path bug 2025-02-26 13:56:47 +00:00
bjorn3
9f190d764f Restore usage of io::Error 2025-02-26 13:45:35 +00:00
WANG Rui
30703af6f3 Enable f16 for LoongArch 2025-02-26 21:40:14 +08:00
bjorn3
30ece8da06 Make tiny-skia work on arm64 2025-02-26 13:06:01 +00:00
bors
ac91805f31 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
Ralf Jung
bab71fc8d6 revert accidental change in get_closest_merge_commit 2025-02-26 13:35:51 +01:00
Laurențiu Nicola
fae88f2ab5 Use cargo zigbuild for releases 2025-02-26 14:16:09 +02: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 #137646 2025-02-26 19:54:34 +08:00
Lukas Wirth
aa32933982 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
bjorn3
d27c67c941 Fix FIXME about unversioned macOS target names 2025-02-26 11:24:41 +00:00
Oli Scherer
410b09f288 Update ui test 2025-02-26 11:22:42 +00:00
bjorn3
994c8cfaf6 Skip downloading test crates in CI jobs that don't need them 2025-02-26 11:11:44 +00:00
bjorn3
e173b714aa You don't need y.sh prepare to build, only to test
Also improve the error message when trying to test without having run
y.sh prepare first.
2025-02-26 11:06:15 +00:00
bjorn3
4698eb6276 Rustup to rustc 1.87.0-nightly (85abb2763 2025-02-25) 2025-02-26 10:52:47 +00:00
bjorn3
7874766497 Sync from rust 85abb27636 2025-02-26 10:47:43 +00:00
bjorn3
2695a19fb0 Use native x86_64 runners for macOS abi-cafe tests too 2025-02-26 10:35:27 +00:00
bjorn3
bdcd07466b Use native x86_64 macOS runners for x86_64 builds
Rather than running in Rosetta 2. This should make testing on CI faster.
2025-02-26 10:10:43 +00:00
bjorn3
a26a938dac Merge pull request #1557 from rust-lang/arm64_linux_ci
Test and dist for arm64 linux on CI
2025-02-26 11:08:04 +01:00
bors
2af87eab3b 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
bjorn3
439062052e Test and dist for arm64 linux on CI 2025-02-26 09:32:53 +00:00