Commit Graph

262708 Commits

Author SHA1 Message Date
Matthias Krüger
f6c8b7a60a
Rollup merge of #127974 - onur-ozkan:force-std-builds, r=Mark-Simulacrum
force compiling std from source if modified

This allows the standard library to be compiled even with `download-rustc` enabled. Which means it's no longer a requirement to compile `rustc` in order to compile `std`.

Ref. https://github.com/rust-lang/rust/pull/127322#discussion_r1666418280.
Blocker for https://github.com/rust-lang/rust/pull/122709.
2024-08-05 05:40:20 +02:00
Matthias Krüger
d10f2b32f0
Rollup merge of #127907 - RalfJung:byte_slice_in_packed_struct_with_derive, r=nnethercote
built-in derive: remove BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE hack and lint

Fixes https://github.com/rust-lang/rust/issues/107457 by turning the lint into a hard error. The lint has been shown in future breakage reports since Rust 1.69 (released in April 2023).

Let's see (via crater) if enough time has passed since https://github.com/rust-lang/rust/pull/104429, and https://github.com/unicode-org/icu4x/pull/2834 has propagated far enough to let us make this a hard error.

Cc ``@nnethercote`` ``@Manishearth``
2024-08-05 05:40:19 +02:00
Matthias Krüger
cc61dc8b2d
Rollup merge of #127655 - RalfJung:invalid_type_param_default, r=compiler-errors
turn `invalid_type_param_default` into a `FutureReleaseErrorReportInDeps`

`````@rust-lang/types````` I assume the plan is still to disallow this? It has been a future-compat lint for a long time, seems ripe to go for hard error.

However, turns out that outright removing it right now would lead to [tons of crater regressions](https://github.com/rust-lang/rust/pull/127655#issuecomment-2228285460), so for now this PR just makes this future-compat lint show up in cargo's reports, so people are warned when they use a dependency that is affected by this.

Fixes https://github.com/rust-lang/rust/issues/27336 by removing the feature gate (so there's no way to silence the lint even on nightly)
CC https://github.com/rust-lang/rust/issues/36887
2024-08-05 05:40:19 +02:00
Mike Hommey
70ab51f988 Correct the const stabilization of <[T]>::last_chunk
`<[T]>::first_chunk` became const stable in 1.77, but `<[T]>::last_chunk` was
left out. This was fixed in 3488679768, which reached stable in 1.80,
making `<[T]>::last_chunk` const stable as of that version, but it is
documented as being const stable as 1.77. While this is what should have
happened, the documentation should reflect what actually did happen.
2024-08-05 05:01:39 +09:00
Mahmoud Mazouz
41ec376edd
Add Debug impls to API types in rustc_codegen_ssa 2024-08-04 21:59:03 +02:00
Noah Lev
dac7f20e13 Add test for Self not being a generic in search index 2024-08-04 12:49:28 -07:00
Noah Lev
b4f77df9f8 rustdoc: Delete ReceiverTy (formerly known as SelfTy)
It was barely used, and the places that used it are actually clearer
without it since they were often undoing some of its work. This also
avoids an unnecessary clone of the receiver type and removes a layer of
logical indirection in the code.
2024-08-04 12:49:28 -07:00
Noah Lev
e452e3def6 Use match instead of sequence of if lets
This is much more readable and idiomatic, and also may help performance
since `match`es usually use switches while `if`s may not.

I also fixed an incorrect comment.
2024-08-04 12:49:28 -07:00
Noah Lev
4e348fa803 rustdoc: Stop treating Self as a generic in search index
We already have special-cased code to handle inlining `Self` as the type
or trait it refers to, and this was just causing glitches like the
search `A -> B` yielding blanket `Into` impls.
2024-08-04 12:49:28 -07:00
Noah Lev
664b3ffbe9 rustdoc: Create SelfTy to replace Generic(kw::SelfUpper)
Rustdoc often has to special-case `Self` because it is, well, a special
type of generic parameter (although it also behaves as an alias in
concrete impls). Instead of spreading this special-casing throughout the
code base, create a new variant of the `clean::Type` enum that is for
`Self` types.

This is a refactoring that has almost no impact on rustdoc's behavior,
except that `&Self`, `(Self,)`, `&[Self]`, and other similar occurrences
of `Self` no longer link to the wrapping type (reference primitive,
tuple primitive, etc.) as regular generics do. I felt this made more
sense since users would expect `Self` to link to the containing trait or
aliased type (though those are usually expanded), not the primitive that
is wrapping it. For an example of the change, see the docs for
`std::alloc::Allocator::by_ref`.
2024-08-04 12:49:27 -07:00
Noah Lev
249d686c70 rustdoc: Rename SelfTy to ReceiverTy
`SelfTy` makes it sound like it is literally the `Self` type, whereas in
fact it may be `&Self` or other types. Plus, I want to use the name
`SelfTy` for a new variant of `clean::Type`. Having both causes
resolution conflicts or at least confusion.
2024-08-04 12:48:49 -07:00
Matthias Krüger
69de294c31 tests: more crashes 2024-08-04 21:25:49 +02:00
bors
176e545209 Auto merge of #128534 - bjorn3:split_stdlib_workspace, r=Mark-Simulacrum
Move the standard library to a separate workspace

This ensures that the Cargo.lock packaged for it in the rust-src component is up-to-date, allowing rust-analyzer to run cargo metadata on the standard library even when the rust-src component is stored in a read-only location as is necessary for loading crates.io dependencies of the standard library.

This also simplifies tidy's license check for runtime dependencies as it can now look at all entries in library/Cargo.lock without having to filter for just the dependencies of runtime crates. In addition this allows removing an exception in check_runtime_license_exceptions that was necessary due to the compiler enabling a feature on the object crate which pulls in a dependency not allowed for the standard library.

While cargo workspaces normally enable dependencies of multiple targets to be reused, for the standard library we do not want this reusing to prevent conflicts between dependencies of the sysroot and of tools that are built using this sysroot. For this reason we already use an unstable cargo feature to ensure that any dependencies which would otherwise be shared get a different -Cmetadata argument as well as using separate build dirs.

This doesn't change the situation around vendoring. We already have several cargo workspaces that need to be vendored. Adding another one doesn't change much.

There are also no cargo profiles that are shared between the root workspace and the library workspace anyway, so it doesn't add any extra work when changing cargo profiles.
2024-08-04 18:40:03 +00:00
bjorn3
178886e923 Update incorrect comment 2024-08-04 15:25:59 +00:00
bors
ab1527f1d6 Auto merge of #128544 - compiler-errors:perf-warn_if_unreachable, r=fmease
Check divergence value first before doing span operations in `warn_if_unreachable`

It's more expensive to extract the span's desugaring first rather than check the value of the divergence enum. For some reason I inverted these checks, probably for readability, but as a consequence I regressed perf:

https://github.com/rust-lang/rust/pull/128443#issuecomment-2265425016

r? fmease
2024-08-04 14:36:24 +00:00
bors
ebd08d8ed5 Auto merge of #128634 - matthiaskrgr:rollup-l5a2v5k, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #128305 (improve error message when `global_asm!` uses `asm!` operands)
 - #128526 (time.rs: remove "Basic usage text")
 - #128531 (Miri: add a flag to do recursive validity checking)
 - #128578 (rustdoc: Cleanup `CacheBuilder` code for building search index)
 - #128589 (allow setting `link-shared` and `static-libstdcpp` with CI LLVM)
 - #128615 (rustdoc: make the hover trail for doc anchors a bit bigger)
 - #128620 (Update rinja version to 0.3.0)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-04 11:57:59 +00:00
Matthias Krüger
f1c4c0f548
Rollup merge of #128620 - GuillaumeGomez:update-rinja, r=notriddle
Update rinja version to 0.3.0

r? ```@notriddle```
2024-08-04 11:32:36 +02:00
Matthias Krüger
badf983c96
Rollup merge of #128615 - notriddle:notriddle/anchor-a11y, r=GuillaumeGomez
rustdoc: make the hover trail for doc anchors a bit bigger

https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Weird.20markdown.20heading.20rendering.3F

r? ```@GuillaumeGomez```

### Screenshots (the purple part is the padding, which the mouse can pass through to hover over it)

| Before | After |
|--|--|
| ![image](https://github.com/user-attachments/assets/5070eebe-84ac-4f5d-8950-58664370191c) | ![image](https://github.com/user-attachments/assets/55340161-ad8a-41bd-a120-8cdab11f4af0)
2024-08-04 11:32:36 +02:00
Matthias Krüger
ad5b9c24c0
Rollup merge of #128589 - onur-ozkan:llvm-configs, r=cuviper
allow setting `link-shared` and `static-libstdcpp` with CI LLVM

These options also affect `compiler/rustc_llvm` builds. They should be configurable even when using CI LLVM.

r? ```@cuviper```
2024-08-04 11:32:35 +02:00
Matthias Krüger
8c826923ae
Rollup merge of #128578 - camelid:cache-index-cleanup, r=notriddle
rustdoc: Cleanup `CacheBuilder` code for building search index

This code was very convoluted and hard to reason about. It is now (I hope) much
clearer and more suitable for both future enhancements and future cleanups.

I'm doing this as a precursor, with no UI changes, to changing rustdoc to
[ignore blanket impls][1] in type-based search.

[1]: https://github.com/rust-lang/rust/pull/128471#discussion_r1699475342

r? ``@notriddle``
2024-08-04 11:32:35 +02:00
Matthias Krüger
19bceedd78
Rollup merge of #128531 - RalfJung:miri-recursive-validity, r=saethlin
Miri: add a flag to do recursive validity checking

The point of this flag is to allow gathering experimental data for https://github.com/rust-lang/unsafe-code-guidelines/issues/412.
2024-08-04 11:32:34 +02:00
Matthias Krüger
c8a33f7e34
Rollup merge of #128526 - tshepang:patch-1, r=Amanieu
time.rs: remove "Basic usage text"

Only one example is given (for each method)
2024-08-04 11:32:34 +02:00
Matthias Krüger
b6b8330b9d
Rollup merge of #128305 - folkertdev:asm-parser-unsupported-operand, r=Amanieu
improve error message when `global_asm!` uses `asm!` operands

follow-up to https://github.com/rust-lang/rust/pull/128207

what was

```
error: expected expression, found keyword `in`
 --> src/lib.rs:1:31
  |
1 | core::arch::global_asm!("{}", in(reg));
  |                               ^^ expected expression
```

becomes

```
error: the `in` operand cannot be used with `global_asm!`
  --> $DIR/parse-error.rs:150:19
   |
LL | global_asm!("{}", in(reg));
   |                   ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it
```

the span of the error is just the keyword, which means that we can't create a machine-applicable suggestion here. The alternative would be to attempt to parse the full operand, but then if there are syntax errors in the operand those would  be presented to the user, even though the parser already knows that the output won't be valid. Also that would require more complexity in the parser.

So I think this is a nice improvement at very low cost.
2024-08-04 11:32:33 +02:00
bors
58fb508fe3 Auto merge of #127877 - Rejyr:migrate-print-rmake, r=jieyouxu
Migrate `print-target-list` to `rmake` and  `print-calling-convention` to ui-test

Part of #121876.

r? `@jieyouxu`

try-job: x86_64-gnu-llvm-18
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
try-job: i686-mingw
try-job: x86_64-msvc
2024-08-04 09:31:24 +00:00
onur-ozkan
2ac09692e7 handle crates when they are not specified for std docs
This fixes a regression from https://github.com/rust-lang/rust/pull/128182.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-04 12:15:52 +03:00
bohan
249afea2ff docs(resolve): more explain about target 2024-08-04 15:38:11 +08:00
daxpedda
80b74d397f
Implement a implicit target feature mechanism 2024-08-04 08:44:23 +02:00
daxpedda
90521399b4
Stabilize Wasm relaxed SIMD 2024-08-04 08:44:13 +02:00
Noah Lev
007d9e1c26 rustdoc: Re-add missing stripped_mod check; explain orphan impls
Co-authored-by: Michael Howell <michael@notriddle.com>
2024-08-03 20:51:28 -07:00
Jerry Wang
36cf385e88
Ensure Rustc::print use in rmake tests 2024-08-03 22:36:08 -04:00
Jerry Wang
1ca959e3f0
Migrate print-target-list to rmake 2024-08-03 22:36:08 -04:00
bors
b389b0ab72 Auto merge of #128466 - sayantn:stdarch-update, r=tgross35
Update the stdarch submodule

cc `@tgross35` `@Amanieu`
r? `@tgross35`

try-job: dist-various-2
2024-08-04 02:11:27 +00:00
许杰友 Jieyou Xu (Joe)
9d0eaa2ad7 check_attr: cover multi-segment attributes on specific check arms
PR #128581 introduced an assertion that all builtin attributes are
actually checked via `CheckAttrVisitor` and aren't accidentally usable
on completely unrelated HIR nodes. Unfortunately, the check had
correctness problems.

The match on attribute path segments looked like

```rust,ignore
[sym::should_panic] => /* check is implemented */
match BUILTIN_ATTRIBUTE_MAP.get(name) {
    // checked below
    Some(BuiltinAttribute { type_: AttributeType::CrateLevel, .. }) => {}
    Some(_) => {
        if !name.as_str().starts_with("rustc_") {
            span_bug!(
                attr.span,
                "builtin attribute {name:?} not handled by `CheckAttrVisitor`"
            )
        }
    }
    None => (),
}
```

However, it failed to account for edge cases such as an attribute whose:

1. path segments *starts* with a builtin attribute such as
   `should_panic`
2. which does not start with `rustc_`, and
3. is also an `AttributeType::Normal` attribute upon registration with
   the builtin attribute map

These conditions when all satisfied cause the span bug to be issued for e.g.
`#[should_panic::skip]` because the `[sym::should_panic]` arm is not matched (since it's
`[sym::should_panic, sym::skip]`).

See <https://github.com/rust-lang/rust/issues/128622>.
2024-08-04 01:50:55 +00:00
许杰友 Jieyou Xu (Joe)
9e5c9c14c7 tests: add regression test for incorrect "builtin attribute is checked" assertion ICE
See <https://github.com/rust-lang/rust/issues/128622>.
2024-08-04 01:50:55 +00:00
Chris Denton
f9d7e4c0a9
Remove cygpath from run-make-support 2024-08-04 00:40:51 +00:00
Jerry Wang
3a41a11a8f
Migrate run-make/print-calling-conventions to ui-test 2024-08-03 20:09:42 -04:00
bors
8f63e9f873 Auto merge of #128441 - Bryanskiy:delegation-perf, r=petrochenkov
Delegation: second attempt to improve perf

Possible perf fix for https://github.com/rust-lang/rust/pull/125929

r? `@petrochenkov`
2024-08-03 23:45:22 +00:00
Guillaume Gomez
cb7c596681 Update rinja version to 0.3.0 2024-08-04 01:08:10 +02:00
Amanieu d'Antras
9963a6c400 Add platform support document for riscv64gc-unknown-linux-musl 2024-08-03 23:26:10 +01:00
Amanieu d'Antras
a937a3b5a1 Make riscv64gc-unknown-linux-musl dynamically linked by default 2024-08-03 23:26:10 +01:00
Amanieu d'Antras
de26ad1a2a Promote riscv64gc-unknown-linux-musl to tier 2 2024-08-03 23:26:10 +01:00
sayantn
01bda01e33 Update stdarch 2024-08-04 03:40:21 +05:30
Chris Denton
b94a9c1b12
Remove skipping symbols with the __imp_ prefix 2024-08-03 22:08:39 +00:00
sayantn
2cde11f2d1 Chore: add x86_amx_intrinsics feature flag to core/lib.rs and remove issue-120720-reduce-nan.rs 2024-08-04 03:08:18 +05:30
bors
64ebd39da5 Auto merge of #128614 - matthiaskrgr:rollup-d2fextz, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #127921 (Stabilize unsafe extern blocks (RFC 3484))
 - #128283 (bootstrap: fix bug preventing the use of custom targets)
 - #128530 (Implement `UncheckedIterator` directly for `RepeatN`)
 - #128551 (chore: refactor backtrace style in panic)
 - #128573 (Simplify `body` usage in rustdoc)
 - #128581 (Assert that all attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes)
 - #128603 (Update run-make/used to use `any_symbol_contains`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-03 21:19:42 +00:00
Michael Howell
eb2de64aa1 rustdoc: make the hover trail for doc anchors a bit bigger
https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Weird.20markdown.20heading.20rendering.3F
2024-08-03 12:39:36 -07:00
Matthias Krüger
0655ed234f
Rollup merge of #128603 - ChrisDenton:used, r=jieyouxu
Update run-make/used to use `any_symbol_contains`

This makes it so we don't need `nm` or `llvm-nm`.

I also tested that `BAR` is removed. I'm not sure if this is wanted though.
2024-08-03 20:51:54 +02:00
Matthias Krüger
3a9d432589
Rollup merge of #128581 - jieyouxu:checked-attr, r=nnethercote
Assert that all attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes

``@oli-obk's`` #128444 with unreachable case removed to avoid that PR bitrotting away.
Based on #128402.

This PR will make adding a new attribute ICE on any use of that attribute unless it gets a handler added in `rustc_passes::CheckAttrVisitor`.

r? ``@nnethercote`` (since you were the reviewer of the original PR)
2024-08-03 20:51:54 +02:00
Matthias Krüger
e488ee7efd
Rollup merge of #128573 - GuillaumeGomez:simplify-body, r=notriddle
Simplify `body` usage in rustdoc

No changes, just a little less code.

r? `@notriddle`
2024-08-03 20:51:53 +02:00
Matthias Krüger
06133811a6
Rollup merge of #128551 - Konippi:refactor-backtrace-style-in-panic, r=tgross35
chore: refactor backtrace style in panic

# Refactor get_backtrace_style for better readability and potential performance improvements

This PR aims to improve the readability and maintainability of the `set_backtrace_style` and `get_backtrace_style` function.
2024-08-03 20:51:53 +02:00