Rollup of 4 pull requests#158555
Closed
jhpratt wants to merge 12 commits into
Closed
Conversation
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.
Member
Author
|
@bors r+ rollup=never p=5 |
Contributor
Contributor
|
PR #158327, which is a member of this rollup, was unapproved. This rollup was thus unapproved. |
Contributor
|
PR #158327, which is a member of this rollup, changed its commit SHA. This rollup was closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
stdtocore#158327 (Move attribute and keyword docs fromstdtocore)r? @ghost
Create a similar rollup