Skip to content

Rollup of 4 pull requests#158555

Closed
jhpratt wants to merge 12 commits into
rust-lang:mainfrom
jhpratt:rollup-y8Id1rS
Closed

Rollup of 4 pull requests#158555
jhpratt wants to merge 12 commits into
rust-lang:mainfrom
jhpratt:rollup-y8Id1rS

Conversation

@jhpratt

@jhpratt jhpratt commented Jun 29, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

Rohan-Singla and others added 12 commits June 18, 2026 15:23
Currently, rustc can emit a FatalError diagnostic during parsing of
literals and tokenstreams. These are handled under the hood as a panic,
which means that proc-macro code needed to catch_unwind if it wanted to
fallibly parse some code. These still emit diagnostics, so in practice
this isn't a full fix, but it at least makes the interface on the macro
side a bit more uniform.

This is primarily motivated by wasm proc macros which can't use
catch_unwind and so this lets the test's output be the same with and
without them.
* refactor: move attribute and keywords docs files to core
* fix references to `std`
* tidy fixes
* ignore doc tests w/ explicit_tail_calls
* revert `unsafe` example and ignore specifically WASM for `become` doc tests
* add explicit note about doube including the docs in `core` and `std`
* missed refactoring of doc test ignore
* conditionally exclude doc-test containing threading for `wasm-wasip1`
* Change exclusion to just `wasi` target_os

Co-authored-by: Justin Schilleman <97192655+jschillem@users.noreply.github.com>
… r=kobzol,mark-simulacrum,bjorn3

bootstrap: fix panic when repo path contains spaces by switching to CARGO_ENCODED_RUSTFLAGS

Fixes rust-lang#158052
Closes: rust-lang#156096

  ## Problem

  `./x build` panics with a cryptic assertion error when the repository is
  checked out under a directory path containing spaces (e.g.
  `/Users/foo/Open Source/rust`):

  thread 'main' panicked at src/bootstrap/src/core/builder/cargo.rs:54:9:
  assertion left == right failed
    left: 2
   right: 1

  The root cause: when building tools in `ToolRustcPrivate` or `Codegen`
  mode, bootstrap calls `llvm-config --libdir` and passes the result as a
  `-Clink-arg=-L<path>` rustflag. The `Rustflags::arg()` method asserted
  that arguments contain no spaces, but if the repo path has a space the
  libdir path inherits it and the assertion fires. The error gives no hint
  that the path is the problem.

  A secondary bug: `llvm-config --libdir` output has a trailing newline
  that was previously stripped accidentally by `RUSTFLAGS` whitespace
  splitting. Nothing was trimming it explicitly.

  ## Fix

  Two changes in `src/bootstrap/src/core/builder/cargo.rs`:

  1. **Switch `RUSTFLAGS` → `CARGO_ENCODED_RUSTFLAGS`**: Change
     `Rustflags` to store args as `Vec<String>` and join with `\x1f`
     (ASCII unit separator) when setting the env var. Cargo's
     `CARGO_ENCODED_RUSTFLAGS` (stable since Cargo 1.55) uses `\x1f` as
     delimiter, which never appears in filesystem paths, so paths with
     spaces are handled correctly. The space-based assertion in `arg()` is
     removed.

  2. **Trim `llvm-config --libdir` output**: Explicitly `.trim()` the
     captured stdout so the trailing newline is not included in the linker
     search path.

  `RUSTDOCFLAGS` is left as-is (space-joined) since no llvm paths are
  added to rustdocflags.

cc: @Kobzol
…g, r=bjorn3

Avoid parser panics bubbling out to proc macros

Currently, rustc can emit a FatalError diagnostic during parsing of literals and tokenstreams. These are handled under the hood as a panic, which means that proc-macro code needed to catch_unwind if it wanted to fallibly parse some code. These still emit diagnostics, so in practice this isn't a full fix, but it at least makes the interface on the macro side a bit more uniform. The long-term fix should be to get rid of those FatalErrors (and in general all diagnostics that actually get emitted out during parsing, not just returned), but this seems like a reasonable improvement in the meantime.

This is primarily motivated by wasm proc macros which can't use catch_unwind and so this lets the test's output be the same with and without them.

r? bjorn3
…-keywords-to-core, r=GuillaumeGomez

Move attribute and keyword docs from `std` to `core`

Move the documentation for attributes and keywords into the `core` crate. Apart from strictly moving the module, I had to make a few small changes to certain docs to avoid using `std` types when possible, as well as fixing a few suggestions related to linking to primitives.

Pre-requisite for work on rust-lang#157604.

r? @GuillaumeGomez

Verified documentation using:
`./x doc library/core` and `./x doc library/std`, as well as running doc-tests for both crates.
…ty, r=GuillaumeGomez

Include default-stability info in rustdoc JSON.

Add a `default_unstable` field on associated constants, associated types, and functions. The field is populated only when those items appear inside a trait, only when there's a default present, and when that default is not stable as designated by `#[rustc_default_body_unstable]`. In such a case, the field contains the name of the feature required to use the unstable default.

The purpose of this info is to allow `cargo-semver-checks` to lint the standard library for accidental breakage of stable APIs. Removing a stable default is an example of such breakage, while removing an _unstable_ default is not.

The field is boxed to minimize the size impact on its enclosing type, since for regular crates it will always be `None`.

I also updated `jsondoclint` to assert that it's an error to have a populated `default_unstable` when there's no function body, no default const value, or no default associated type. In the process, I noticed that `jsondoclint` and `jsondocck` are both on edition 2021 — I plan to upgrade them to 2024 in separate PRs.

r? @GuillaumeGomez

**AI disclosure:** This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 29, 2026
@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 29, 2026
@jhpratt

jhpratt commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit bc6f531 has been approved by jhpratt

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 29, 2026
@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

PR #158327, which is a member of this rollup, was unapproved.

This rollup was thus unapproved.

@rust-bors

rust-bors Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

PR #158327, which is a member of this rollup, changed its commit SHA.

This rollup was closed.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 29, 2026
@jhpratt jhpratt deleted the rollup-y8Id1rS branch June 29, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-json Area: Rustdoc JSON backend rollup A PR which is a rollup T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants