Commit Graph

271547 Commits

Author SHA1 Message Date
Michael Goulet
f010e2dc57
Rollup merge of #133155 - nnethercote:yet-more-rustc_mir_dataflow-cleanups, r=cjgillot
Yet more `rustc_mir_dataflow` cleanups

A few more cleanups.

r? `@cjgillot`
2024-11-26 12:03:41 -05:00
Michael Goulet
6e5bac19d0
Rollup merge of #133140 - dtolnay:precedence, r=fmease
Inline ExprPrecedence::order into Expr::precedence

The representation of expression precedence in rustc_ast has been an obstacle to further improvements in the pretty-printer (continuing from #119105 and #119427).

Previously the operation of *"does this expression have lower precedence than that one"* (relevant for parenthesis insertion in macro-generated syntax trees) consisted of 3 steps:

1. Convert `Expr` to `ExprPrecedence` using `.precedence()`
2. Convert `ExprPrecedence` to `i8` using `.order()`
3. Compare using `<`

As far as I can guess, the reason for the separation between `precedence()` and `order()` was so that both `rustc_ast::Expr` and `rustc_hir::Expr` could convert as straightforwardly as possible to the same `ExprPrecedence` enum, and then the more finicky logic performed by `order` could be present just once.

The mapping between `Expr` and `ExprPrecedence` was intended to be as straightforward as possible:

```rust
match self.kind {
    ExprKind::Closure(..) => ExprPrecedence::Closure,
    ...
}
```

although there were exceptions of both many-to-one, and one-to-many:

```rust
    ExprKind::Underscore => ExprPrecedence::Path,
    ExprKind::Path(..) => ExprPrecedence::Path,
    ...
    ExprKind::Match(_, _, MatchKind::Prefix) => ExprPrecedence::Match,
    ExprKind::Match(_, _, MatchKind::Postfix) => ExprPrecedence::PostfixMatch,
```

Where the nature of `ExprPrecedence` becomes problematic is when a single expression kind might be associated with multiple different precedence levels depending on context (outside the expression) and contents (inside the expression). For example consider what is the precedence of an ExprKind::Closure `$closure`. Well, on the left-hand side of a binary operator it would need parentheses in order to avoid the trailing binary operator being absorbed into the closure body: `($closure) + Rhs`, so the precedence is something lower than that of `+`. But on the right-hand side of a binary operator, a closure is just a straightforward prefix expression like a unary op, which is a relatively high precedence level, higher than binops but lower than method calls: `Lhs + $closure` is fine without parens but `($closure).method()` needs them. But as a third case, if the closure contains an explicit return type, then the precedence is an even higher level than that, never needing parenthesization even in a binop left-hand side or method call: `|| -> bool { false } + Rhs` or `|| -> bool { false }.method()`.

You can see that trying to capture all of this resolution about expressions into `ExprPrecedence` violates the intention of `ExprPrecedence` being a straightforward one-to-one correspondence from each AST and HIR `ExprKind` variant. It would be possible to attempt that by doing stuff like `ExprPrecedence::Closure(Side::Leading, ReturnType::No)`, but I don't foresee the original envisioned benefit of the `precedence()`/`order()` distinction being retained in this approach. Instead I want to move toward a model that Syn has been using successfully. In Syn, there is a Precedence enum but it differs from rustc in the following ways:

- There are [relatively few variants](https://github.com/dtolnay/syn/blob/2.0.87/src/precedence.rs#L11-L47) compared to rustc's `ExprPrecedence`. For example there is no distinction at the precedence level between returns and closures, or between loops and method calls.

- We distinguish between [leading](https://github.com/dtolnay/syn/blob/2.0.87/src/fixup.rs#L293) and [trailing](https://github.com/dtolnay/syn/blob/2.0.87/src/fixup.rs#L309) precedence, taking into account an expression's context such as what token follows it (for various syntactic bail-outs in Rust's grammar, like ambiguities around break-with-value) and how it relates to operators from the surrounding syntax tree.

- There are no hardcoded mysterious integer quantities like rustc's `PREC_CLOSURE = -40`. All precedence comparisons are performed via PartialOrd on a C-like enum.

This PR is just a first step in these changes. As you can tell from Syn, I definitely think there is value in having a dedicated type to represent precedence, instead of what `order()` is doing with `i8`. But that is a whole separate adventure because rustc_ast doesn't even agree consistently on `i8` being the type for precedence order; `AssocOp::precedence` instead uses `usize` and there are casts in both directions. It is likely that a type called `ExprPrecedence` will re-appear, but it will look substantially different from the one that existed before this PR.
2024-11-26 12:03:41 -05:00
Michael Goulet
42459a7971
Rollup merge of #133136 - ChayimFriedman2:get-many-mut, r=Amanieu
Support ranges in `<[T]>::get_many_mut()`

As per T-libs-api decision in #104642.

I implemented that with a separate trait and not within `SliceIndex`, because doing that via `SliceIndex` requires adding support for range types that are (almost) always overlapping e.g. `RangeFrom`, and also adding fake support code for `impl SliceIndex<str>`.

An inconvenience that I ran into was that slice indexing takes the index by value, but I only have it by reference. I could change slice indexing to take by ref, but this is pretty much the hottest code ever so I'm afraid to touch it. Instead I added a requirement for `Clone` (which all index types implement anyway) and cloned. This is an internal requirement the user won't see and the clone should always be optimized away.

I also implemented `Clone`, `PartialEq` and `Eq` for the error type, since I noticed it does not do that when writing the tests and other errors in std seem to implement them. I didn't implement `Copy` because maybe we will want to put something non-`Copy` there.
2024-11-26 12:03:40 -05:00
Michael Goulet
9d6a11a435
Rollup merge of #133070 - nnethercote:lexer-tweaks, r=chenyukang
Lexer tweaks

Some cleanups and small performance improvements.

r? ```@chenyukang```
2024-11-26 12:03:39 -05:00
Michael Goulet
5915190fed
Rollup merge of #133042 - cuviper:btreemap-insert_entry, r=Amanieu
btree: add `{Entry,VacantEntry}::insert_entry`

This matches the recently-stabilized methods on `HashMap` entries. I've
reused tracking issue #65225 for now, but we may want to split it.
2024-11-26 12:03:39 -05:00
bors
f2abf827c1 Auto merge of #132894 - frank-king:feature/where-refactor, r=cjgillot
Refactor `where` predicates, and reserve for attributes support

Refactor `WherePredicate` to `WherePredicateKind`, and reserve for attributes support in `where` predicates.

This is a part of #115590 and is split from #132388.

r? petrochenkov
2024-11-26 04:12:33 +00:00
bors
6d22ff1215 Auto merge of #133465 - ehuss:update-cargo, r=ehuss
Update cargo and books

10 commits in 66221abdeca2002d318fde6efff516aab091df0e..4c39aaff66862cc0da52fe529aa1990bb8bb9a22
2024-11-19 21:30:02 +0000 to 2024-11-25 16:36:17 +0000
- feat: Stabilize Edition 2024 (rust-lang/cargo#14828)
- Improve error handling when PathSource is relative (rust-lang/cargo#14854)
- test: address test output nondeterminism  (rust-lang/cargo#14855)
- chore: move supports-unicode to workspace deps (rust-lang/cargo#14853)
- Check build target supports std when building with -Zbuild-std=std (rust-lang/cargo#14183)
- fix(publish): Allow dry-run of a non-bumped workspace  (rust-lang/cargo#14847)
- test: Switch from 'exec_with_output' to 'run' (rust-lang/cargo#14848)
- test(rustflags): Verify -Cmetadata directly, not through -Cextra-filename (rust-lang/cargo#14846)
- chore: remove bors mentions (rust-lang/cargo#14845)
- Clarify how `cargo::metadata` env var is selected (rust-lang/cargo#14842)

## nomicon

1 commits in eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42..0674321898cd454764ab69702819d39a919afd68
2024-11-16 14:05:28 +0000 to 2024-11-19 12:35:48 +0000
- races: Clarify a “mostly” that might be misread (rust-lang-nursery/nomicon#468)

## reference

12 commits in 41ccb0e6478305401dad92e8fd3d04a4304edb4c..5c86c739ec71b8bc839310ff47fa94e94635bba9
2024-11-15 21:45:16 +0000 to 2024-11-25 17:23:35 +0000
- Document `gen` keyword as reserved in Rust 2024 (rust-lang-nursery/reference#1501)
- 2024: Update `expr` macro fragment specifier (rust-lang-nursery/reference#1639)
- Add rust_2024 prelude (rust-lang-nursery/reference#1552)
- 2024: Add reserved syntax (rust-lang-nursery/reference#1652)
- Add Lifetime Capture Rules 2024 (rust-lang-nursery/reference#1601)
- Add a section dedicated to Edition 2024 changes to temporary scopes (rust-lang-nursery/reference#1592)
- 2024: Add unsafe attribute differences (rust-lang-nursery/reference#1579)
- 2024: Add updates for unsafe extern blocks (rust-lang-nursery/reference#1565)
- Fix rule for lazy boolean temporary drop scope (rust-lang-nursery/reference#1681)
- Raw lifetimes (rust-lang-nursery/reference#1603)
- Fix some missing emdashes (rust-lang-nursery/reference#1676)
- Added an additional example of lifetime elision (rust-lang-nursery/reference#1678)

## rustc-dev-guide

6 commits in b679e71c2d66c6fe13e06b99ac61773b866213f0..787b4166ccc67bd8f72a6e3ef6685ce9ce82909a
2024-11-18 16:18:15 +0800 to 2024-11-22 11:17:57 +0000
- Remove constants section as it is outdated
- Flatten generic parameter defs section
- Add instructions to test error code docs (rust-lang/rustc-dev-guide#2145)
- Reorganize the "Source Code Representation" chapters (rust-lang/rustc-dev-guide#2142)
- Make `Diag` a clickable link in Suggestion section (rust-lang/rustc-dev-guide#2140)
- update for rustc_intrinsic_const_stable_indirect (rust-lang/rustc-dev-guide#2138)

## edition-guide

6 commits in 915f9b319c2823f310430ecdecd86264a7870d7e..f48b0e842a3911c63240e955d042089e9e0894c7
2024-11-06 07:23:07 +0000 to 2024-11-25 16:20:27 +0000
- Update for 2024 stabilization (rust-lang-nursery/edition-guide#338)
- Enable triagebot merge-conflicts and shortcuts (rust-lang-nursery/edition-guide#336)
- Organize the 2024 chapters into sub-chapters by category (rust-lang-nursery/edition-guide#334)
- Fix broken Cargo Book link in cargo-resolver.md (rust-lang-nursery/edition-guide#335)
- Edition 2024 guide for temporary lifetime changes (rust-lang-nursery/edition-guide#318)
- 2024: rustfmt sorting (rust-lang-nursery/edition-guide#332)
2024-11-26 01:15:45 +00:00
Nicholas Nethercote
be7c6a3b43 Make it possible for ResultsCursor to borrow a Results.
`ResultsCursor` currently owns its `Results`. But sometimes the
`Results` is needed again afterwards. So there is
`ResultsCursor::into_results` for extracting the `Results`, which leads
to some awkwardness.

This commit adds `ResultsHandle`, a `Cow`-like type that can either
borrow or own a a `Results`. `ResultsCursor` now uses it. This is good
because some `ResultsCursor`s really want to own their `Results`, while
others just want to borrow it.

We end with with a few more lines of code, but get some nice cleanups.
- `ResultsCursor::into_results` and `Formatter::into_results` are
  removed.
- `write_graphviz_results` now just borrows a `Results`, instead of the
  awkward "take ownership of a `Results` and then return it unchanged"
  pattern.

This reinstates the cursor flexibility that was lost in #118230 -- which
removed the old `ResultsRefCursor` and `ResultsCloneCursor` types -- but
in a much simpler way. Hooray!
2024-11-26 11:23:40 +11:00
Nicholas Nethercote
1914dbe694 Tweak MaybeBorrowedLocals::transfer_function usage.
In `MaybeRequiresStorage::apply_before_statement_effect`, call
`transfer_function` directly, as is already done in
`MaybeRequiresStorage::apply_before_terminator_effect`. This makes it clear
that the operation doesn't rely on the `MaybeBorrowedLocals` results.
2024-11-26 11:23:40 +11:00
Nicholas Nethercote
dae019dc9d Remove self param for MaybeBorrowedLocals::transfer_function.
It is unnecessary.
2024-11-26 11:23:40 +11:00
Nicholas Nethercote
7e704afc2d Add some useful comments.
Describing some things that took me a long time to understand.
2024-11-26 11:23:36 +11:00
Nicholas Nethercote
0066acf753 Merge apply_effects_in_block and join_state_into_successors_of.
They are always called in succession, so it's simpler if they are merged
into a single function.
2024-11-26 11:19:59 +11:00
Eric Huss
addb040d2c Update books 2024-11-25 09:57:36 -08:00
Eric Huss
47ddcb9fff Update cargo 2024-11-25 09:31:37 -08:00
bors
7db7489f9b Auto merge of #133247 - GuillaumeGomez:reduce-integer-display-impl, r=workingjubilee
Reduce integer `Display` implementation size

I was thinking about #128204 and how we could reduce the size of the code and just realized that we didn't need the `_fmt` method to be implemented on signed integers, which in turns allow to simplify greatly the macro call.

r? `@workingjubilee`
2024-11-25 11:03:41 +00:00
Frank King
161221da9e Refactor where predicates, and reserve for attributes support 2024-11-25 16:38:35 +08:00
bors
1278dad1e9 Auto merge of #133433 - matthiaskrgr:rollup-lfa3wp1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #131523 (Fix asm goto with outputs and move it to a separate feature gate)
 - #131664 (Support input/output in vector registers of s390x inline assembly (under asm_experimental_reg feature))
 - #132432 (Add a test to verify that libstd doesn't use protected symbols)
 - #132502 (Document possibility to set core features in example config.toml)
 - #132529 (ci(triagebot): add more top-level files to A-meta)
 - #132533 (Add BorrowedBuf::into_filled{,_mut} methods to allow returning buffer with original lifetime)
 - #132803 (Fix broken url)
 - #132982 (alloc: fix `Allocator` method names in `alloc` free function docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-25 08:13:44 +00:00
Chayim Refael Friedman
4a230bba74 Support ranges in <[T]>::get_many_mut()
I implemented that with a separate trait and not within `SliceIndex`, because doing that via `SliceIndex` requires adding support for range types that are (almost) always overlapping e.g. `RangeFrom`, and also adding fake support code for `impl SliceIndex<str>`.

An inconvenience that I ran into was that slice indexing takes the index by value, but I only have it by reference. I could change slice indexing to take by ref, but this is pretty much the hottest code ever so I'm afraid to touch it. Instead I added a requirement for `Clone` (which all index types implement anyway) and cloned. This is an internal requirement the user won't see and the clone should always be optimized away.

I also implemented `Clone`, `PartialEq` and `Eq` for the error type, since I noticed it does not do that when writing the tests and other errors in std seem to implement them. I didn't implement `Copy` because maybe we will want to put something non-`Copy` there.
2024-11-25 10:04:06 +02:00
Matthias Krüger
d2590e0ca3
Rollup merge of #132982 - suaviloquence:2-doc-changed-alloc-methods, r=Mark-Simulacrum
alloc: fix `Allocator` method names in `alloc` free function docs

It looks like these got renamed in 9274b37d99 but the docs never updated.

I couldn't find any history for `Allocator::realloc`.  The `grow` API is not 1:1 (e.g., it returns a result), so this may not be the correct change - let me know and I can change the method or even remove this entirely.
2024-11-25 07:01:41 +01:00
Matthias Krüger
0b0fda9c96
Rollup merge of #132803 - wangjingcun:master, r=Mark-Simulacrum
Fix broken url
2024-11-25 07:01:40 +01:00
Matthias Krüger
813d3e7781
Rollup merge of #132533 - SUPERCILEX:patch-4, r=Mark-Simulacrum
Add BorrowedBuf::into_filled{,_mut} methods to allow returning buffer with original lifetime

See https://github.com/rust-lang/libs-team/issues/473 and tracking issue https://github.com/rust-lang/rust/issues/117693.
2024-11-25 07:01:40 +01:00
Matthias Krüger
4c534de677
Rollup merge of #132529 - ismailarilik:ci/triagebot/fix-name-of-trigger-file-LICENSES, r=Mark-Simulacrum
ci(triagebot): add more top-level files to A-meta

It didn't exist so I changed it with its new versions: `COPYRIGHT`, `LICENSE-APACHE` and `LICENSE-MIT`

I also added some other files I found appropriate under the related label.
2024-11-25 07:01:39 +01:00
Matthias Krüger
4ed94c149f
Rollup merge of #132502 - Voultapher:document-core-features-in-config-toml-example, r=Mark-Simulacrum
Document possibility to set core features in example config.toml
2024-11-25 07:01:38 +01:00
Matthias Krüger
4c40119dc4
Rollup merge of #132432 - davidlattimore:std-interposable, r=Mark-Simulacrum
Add a test to verify that libstd doesn't use protected symbols
2024-11-25 07:01:38 +01:00
Matthias Krüger
3f86eddf83
Rollup merge of #131664 - taiki-e:s390x-asm-vreg-inout, r=Amanieu
Support input/output in vector registers of s390x inline assembly (under asm_experimental_reg feature)

This extends currently clobber-only vector registers (`vreg`) support to allow passing `#[repr(simd)]` types, floats (f32/f64/f128), and integers (i32/i64/i128) as input/output.

This is unstable and gated under new `#![feature(asm_experimental_reg)]` (tracking issue: https://github.com/rust-lang/rust/issues/133416). If the feature is not enabled, only clober is supported as before.

| Architecture | Register class | Target feature | Allowed types |
| ------------ | -------------- | -------------- | -------------- |
| s390x | `vreg` | `vector` | `i32`, `f32`, `i64`, `f64`, `i128`, `f128`, `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |

This matches the list of types that are supported by the vector registers in LLVM:
https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZRegisterInfo.td#L301-L313

In addition to `core::simd` types and floats listed above, custom `#[repr(simd)]` types of the same size and type are also allowed. All allowed types other than i32/f32/i64/f64/i128, and relevant target features are currently unstable.

Currently there is no SIMD type for s390x in `core::arch`, but this is tracked in https://github.com/rust-lang/rust/issues/130869.

cc https://github.com/rust-lang/rust/issues/130869 about vector facility support in s390x
cc https://github.com/rust-lang/rust/issues/125398 & https://github.com/rust-lang/rust/issues/116909 about f128 support in asm

`@rustbot` label +O-SystemZ +A-inline-assembly
2024-11-25 07:01:37 +01:00
Matthias Krüger
c5230d1148
Rollup merge of #131523 - nbdd0121:asm, r=compiler-errors
Fix asm goto with outputs and move it to a separate feature gate

Tracking issue: #119364

This PR addresses 3 aspects of asm goto with outputs:
* Codegen is fixed. My initial implementation has an oversight which cause the output to be only stored in fallthrough path, but not in label blocks.
* Outputs can now be used with `options(noreturn)` if a label block is given.
* All of this is moved to a new feature gate, because we likely want to stabilise `asm_goto` before asm goto with outputs.

`@rustbot` labels: +A-inline-assembly +F-asm
2024-11-25 07:01:37 +01:00
bors
67a8c64259 Auto merge of #133236 - dtolnay:unicodelicense, r=Mark-Simulacrum
Synchronize Unicode license text from unicode.org

The text of <https://unicode.org/license.txt> was swapped out from "UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE" to "UNICODE LICENSE V3" between the dates of [2023.06.03](https://web.archive.org/web/20230603182532/https://www.unicode.org/license.txt) and [2023.09.11](https://web.archive.org/web/20230911222703/https://www.unicode.org/license.txt), which means between Unicode 15.0.0 ([2022.09.13](https://unicode.org/versions/Unicode15.0.0/)) and Unicode 15.1.0 ([2023.09.12](https://unicode.org/versions/Unicode15.1.0/)). A license wording change is not mentioned in the 15.1.0 [release summary](https://www.unicode.org/versions/Unicode15.1.0/) or [announcement post](http://blog.unicode.org/2023/09/announcing-unicode-standard-version-151.html). But I guess we are intended to infer that data files from Unicode 15.1.0 should be specified as licensed [Unicode-3.0](https://spdx.org/licenses/Unicode-3.0.html) as opposed to [Unicode-DFS-2016](https://spdx.org/licenses/Unicode-DFS-2016.html).

The Rust standard library has been using Unicode 15.1.0+ since https://github.com/rust-lang/rust/pull/120777.
2024-11-25 05:31:12 +00:00
Nicholas Nethercote
16a39bb7ca Streamline lex_token_trees error handling.
- Use iterators instead of `for` loops.
- Use `if`/`else` instead of `match`.
2024-11-25 16:10:55 +11:00
Nicholas Nethercote
4cd2840f00 Clean up c_or_byte_string.
- Rename a misleading local `mk_kind` as `single_quoted`.
- Use `fn` for all three arguments, for consistency.
2024-11-25 16:10:55 +11:00
Nicholas Nethercote
11c96cfd94 Improve strip_shebang testing.
It's currently a bit ad hoc. This commit makes it more methodical, with
pairs of match/no-match tests for all the relevant cases.
2024-11-25 16:10:55 +11:00
Nicholas Nethercote
ba1a1ddc3f Fix some formatting.
Must be one of those cases where the function is too long and rustfmt
bails out.
2024-11-25 16:10:55 +11:00
Nicholas Nethercote
593cf680aa Split Lexer::bump.
It has two different ways of being called.
2024-11-25 16:10:55 +11:00
Nicholas Nethercote
98777b4c49 Merge TokenTreesReader into StringReader.
There is a not-very-useful layering in the lexer, where
`TokenTreesReader` contains a `StringReader`. This commit combines them
and names the result `Lexer`, which is a more obvious name for it.

The methods of `Lexer` are now split across `mod.rs` and `tokentrees.rs`
which isn't ideal, but it doesn't seem worth moving a bunch of code to
avoid it.
2024-11-25 16:10:55 +11:00
m
8542175b6f
fix Allocator method names in alloc free function docs 2024-11-24 16:38:29 -08:00
bors
28fc2ba714 Auto merge of #133423 - jieyouxu:rollup-m3gyoz6, r=jieyouxu
Rollup of 6 pull requests

Successful merges:

 - #132730 (std: allow after-main use of synchronization primitives)
 - #133105 (only store valid proc macro item for doc link)
 - #133260 (Constify the `Deref`/`DerefMut` traits, too)
 - #133297 (Remove legacy bitcode for iOS)
 - #133298 (Mention that std::fs::remove_dir_all fails on files)
 - #133384 (add a test for target-feature-ABI warnings in closures and when calling extern fn)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-24 23:17:56 +00:00
许杰友 Jieyou Xu (Joe)
c50e19b69c
Rollup merge of #133384 - RalfJung:vector-abi-check-tests, r=jieyouxu
add a test for target-feature-ABI warnings in closures and when calling extern fn

Also update the comment regarding the inheritance of target features into closures, to make it more clear that we really shouldn't do this right now.
2024-11-25 00:39:06 +08:00
许杰友 Jieyou Xu (Joe)
1741b394da
Rollup merge of #133298 - n0toose:remove-dir-all-but-not-paths, r=Noratrieb
Mention that std::fs::remove_dir_all fails on files

This is explicitly mentioned for std::fs::remove_file.

It is more likely for a slightly lazy programmer to believe that removing a file would work and that they do not have to distinguish between directories (with contents) and files themself, because of the function's recursive nature and how it distinguishes between files and directories when removing them.

Follow-up for #133183.
2024-11-25 00:39:05 +08:00
许杰友 Jieyou Xu (Joe)
8d20d71256
Rollup merge of #133297 - DianQK:embed-bitcode-ios, r=nikic
Remove legacy bitcode for iOS

Follow #117364.
2024-11-25 00:39:05 +08:00
许杰友 Jieyou Xu (Joe)
6bf9a2363d
Rollup merge of #133260 - compiler-errors:deref, r=fee1-dead
Constify the `Deref`/`DerefMut` traits, too

One more constification. Rebased on that one commit that makes it so we don't need to provide stability on const impls.

r? fee1-dead
2024-11-25 00:39:04 +08:00
许杰友 Jieyou Xu (Joe)
6b07382b59
Rollup merge of #133105 - bvanjoi:issue-132743, r=petrochenkov
only store valid proc macro item for doc link

Fixes #132743

The definition item can be detected if it is exported in the doc, so store these items rather than skipping.

r? `@petrochenkov`
2024-11-25 00:39:04 +08:00
许杰友 Jieyou Xu (Joe)
31b4023e24
Rollup merge of #132730 - joboet:after_main_sync, r=Noratrieb
std: allow after-main use of synchronization primitives

By creating an unnamed thread handle when the actual one has already been destroyed, synchronization primitives using thread parking can be used even outside the Rust runtime.

This also fixes an inefficiency in the queue-based `RwLock`: if `thread::current` was not initialized yet, it will create a new handle on every parking attempt without initializing `thread::current`. The private `current_or_unnamed` function introduced here fixes this.
2024-11-25 00:39:03 +08:00
bors
481b5fadd7 Auto merge of #133068 - jieyouxu:download-rustc-default-only-for-tools, r=clubby789
Use `download-rustc=false` global default, `if-unchanged` for tools and library profiles, and make `rust.debug-assertions=true` inhibit downloading CI rustc

- Use `download-rustc = false` as global default.
    - Use `download-rustc = 'if-unchanged'` for tools and library profiles.
- Make `rust.debug-assertions = true` inhibit downloading CI rustc because alt rustc builds do not yet have rustc debug assertions enabled.

Fixes #133132.

cc discussions: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Bootstrap.20breakage
compiler contributors poll: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/.60download-rustc.20.3D.20'if-unchanged'.60.20for.20.60compiler.60.20profile.3F/near/481877253
library contributors poll: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/.60download-rustc.20.3D.20.22if-unchanged.22.60.20default.20for.20libs.20profile.3F/near/482607011
cc https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/When.20is.20rustc.20built.20with.20debug.20assertions.3F

cc `@MarcoIeni` since you're working on improving CI job times, sorry, this will definitely regress some CI job times because we're probably lying to ourselves that CI rustc had debug assertions for some time 😅

cc `@onur-ozkan` for FYI, but since you're on vacation (sorry for the ping),

r? `@Kobzol` (I *think* you have a bit more context than other bootstrap reviewers?)
2024-11-24 16:28:55 +00:00
Gary Guo
0178ba2c25 Make asm_goto_with_outputs a separate feature gate 2024-11-24 15:24:01 +00:00
Gary Guo
73f8309300 Support use of asm goto with outputs and options(noreturn)
When labels are present, the `noreturn` option really means that asm block
won't fallthrough -- if labels are present, then outputs can still be
meaningfully used.
2024-11-24 14:18:10 +00:00
Gary Guo
b8df869ebb Fix asm goto with outputs
When outputs are used together with labels, they are considered
to be written for all destinations, not only when falling through.
2024-11-24 14:18:10 +00:00
Taiki Endo
c024d8ccdf Make s390x non-clobber-only vector register support unstable 2024-11-24 21:42:22 +09:00
bors
f5d1857685 Auto merge of #133415 - matthiaskrgr:rollup-n1ivyd5, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #133300 (inject_panic_runtime(): Avoid double negation for 'any non rlib')
 - #133301 (Add code example for `wrapping_neg` method for signed integers)
 - #133371 (remove is_trivially_const_drop)
 - #133389 (Stabilize `const_float_methods`)
 - #133398 (rustdoc: do not call to_string, it's already impl Display)
 - #133405 (tidy: Distinguish between two different meanings of "style file")

r? `@ghost`
`@rustbot` modify labels: rollup
2024-11-24 10:21:07 +00:00
Matthias Krüger
3ccaceff73
Rollup merge of #133405 - Zalathar:style-file, r=jieyouxu
tidy: Distinguish between two different meanings of "style file"

This file contains code that uses “style file” to mean “CSS file”, and other code that uses “style file” to mean “this file, which implements the style checker”.

That's very confusing, so it's easier to just say *CSS file* or *this file* as appropriate.

No functional change.
2024-11-24 11:08:21 +01:00
Matthias Krüger
e87e205010
Rollup merge of #133398 - klensy:rd-to-string, r=aDotInTheVoid
rustdoc: do not call to_string, it's already impl Display

`anchor` returns impl Display, so no need to call to_string().
2024-11-24 11:08:20 +01:00
Matthias Krüger
220251e181
Rollup merge of #133389 - eduardosm:stabilize-const_float_methods, r=RalfJung
Stabilize `const_float_methods`

Tracking issue: https://github.com/rust-lang/rust/issues/130843
Relnotes: #133383

Stabilized const API:

```rust
// in `core`
impl f32/f64 {
    pub const fn recip(self) -> Self;
    pub const fn to_degrees(self) -> Self;
    pub const fn to_radians(self) -> Self;
    pub const fn max(self, other: Self) -> Self;
    pub const fn min(self, other: Self) -> Self;
    pub const fn clamp(self, min: Self, max: Self) -> Self;
    pub const fn abs(self) -> Self;
    pub const fn signum(self) -> Self;
    pub const fn copysign(self, sign: Self) -> Self;
}
```

Closes https://github.com/rust-lang/rust/issues/130843

r? libs-api

cc `@RalfJung` -- I think the way const-stability attributes work have change a bit since the last time a wrote a const-stabilization PR, please make sure I got them right.
2024-11-24 11:08:20 +01:00