Rollup of 5 pull requests#155094
Closed
JonathanBrouwer wants to merge 19 commits intorust-lang:mainfrom
Closed
Conversation
Builtin attribute macros like #[eii] generate AST items programmatically without collected tokens. When another attribute macro was present on the same item, the compiler would panic in TokenStream::from_ast() trying to tokenize the generated items during subsequent attribute expansion. Generate fake token streams (via pretty-print and re-parse) for Item and ForeignItem nodes that lack collected tokens, following the existing pattern used for Crate and out-of-line modules.
…ass test When a function has `eii_impls` set (via `eii_shared_macro`), the `#[hello]` attribute is consumed from `node.attrs()`. A subsequent `AttrProcMacro` expander like `contracts::requires` calls `item.to_tokens()` which uses the current `node.attrs()` — so `#[hello]` is missing from the token stream. After the roundtrip and `parse_ast_fragment`, the new AST item has empty `eii_impls` and the EII link is broken. Fix this by using `fake_token_stream_for_item` when the item is a function with non-empty `eii_impls`. The pretty-printer re-emits `eii_impls` as `#[hello]` in `print_fn_full`, which survives the roundtrip and gets re-expanded by `eii_shared_macro` on the resulting item. Add a run-pass test to verify EII + contract annotation works correctly at runtime.
…erated_item test
The previous test used `fn implementation() {}` with a body, which caused
`generate_default_impl` to generate a `const _: () = { fn implementation() {} }`
item containing `self::implementation`. On Linux (aarch64-gnu-llvm-21), the
resolver's `suggest_ident_hidden_by_hygiene` emitted an extra help span on the
resulting E0425 error that did not appear on macOS, causing a stderr mismatch.
Switch the declaration to `fn implementation();` (no body) so that
`generate_default_impl` is not called and no `self::implementation` path is
emitted. The test still validates that `#[eii]` + `#[core::contracts::ensures]`
produces graceful errors instead of an ICE, via the two contract-annotation
errors on the generated foreign item.
It doesn't need to be in there, it can instead be at the single call site. Removing it eliminates one parameter, makes `define_queries!` smaller (which is always good), and also enables the next commit which tidies up profiling. This commit also changes how `value` and `verify` are initialized, because I don't like the current way of doing it after the declaration.
From `plumbing.rs` to `execution.rs`, which is where most of the other query profiling occurs. It also avoids eliminates some fn parameters. This means the `provided_to_erased` call in `try_from_load_disk_fn` is now included in the profiling when previously it wasn't. This is good because `provided_to_erased` is included in other profiling calls (e.g. calls to `invoke_provider_fn`).
Moreover, dereference `ty_layout.align` for `#[rustc_dump_layout(align)]`
to render `align: Align($N bytes)` instead of `align: AbiAlign { abi: Align($N bytes) }`
which contains the same amount of information but it more concise and legible.
Simplify `try_load_from_disk_fn`. `try_load_from_disk_fn` has a single call site. We can move some of the stuff within it to its single call site, which simplifies it, and also results in all of the query profiling code ending up in the same module. Details in individual commits. r? @Zalathar
…-eii-attr-expansion, r=jdonszelmann Fix ICE when combining #[eii] with #[core::contracts::ensures] Fixes rust-lang#153745 Builtin attribute macros like #[eii] generate AST items programmatically without collected tokens. When another attribute macro was present on the same item, the compiler would panic in TokenStream::from_ast() trying to tokenize the generated items during subsequent attribute expansion. Generate fake token streams (via pretty-print and re-parse) for Item and ForeignItem nodes that lack collected tokens, following the existing pattern used for Crate and out-of-line modules.
…=JonathanBrouwer Rename some more of our internal `#[rustc_*]` TEST attributes Follow-up to rust-lang#153300. r? JonathanBrouwer or jdonszelmann
…lowering-ice, r=petrochenkov delegation: fix unelided lifetime ICE, refactoring of GenericArgPosition This PR does two things: - First it restores `lower_generic_args_of_path` as it was before rust-lang#151864, as it turns out we should use `GenericArgPosition::Type` for generic args lowering for signature inheritance, as it will not cause lifetime inference and then ICEs during child args lowering, - Next it refactors `GenericArgPosition` enum replacing `Value` and `MethodCall` with `Call(IsMethodCall)`, as the only place where we created `Value` or `MethodCall` variants was in `check_generic_arg_count_for_call`, where it was a match over `is_method_call`. Not sure it is needed, but seems cleaner to me. Fixes rust-lang#154178, part of rust-lang#118212. r? @petrochenkov
… r=JohnTitor Fix code block whitespace handling in Markdown ### Fix Markdown code block closing whitespace handling Previously, the parser incorrectly accepted closing backticks followed by extra text and rejected lines where only spaces appeared after closing backticks. This did not match expected Markdown behavior. Now, the parser correctly ends a code block only when line after the code ends with spaces or nothing. Lines where extra text appears after the closing backticks are treated as part of the code block. Includes tests for both correct and incorrect cases. ### Related issue This PR addresses the Outreachy issue: [Markdown whitespace bug in Rust Compiler](rustfoundation/interop-initiative#53)
Contributor
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors bot
pushed a commit
that referenced
this pull request
Apr 10, 2026
Rollup of 5 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1
Contributor
|
This pull request was unapproved due to being closed. |
Contributor
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:
try_load_from_disk_fn. #155080 (Simplifytry_load_from_disk_fn.)#[rustc_*]TEST attributes #155027 ( Rename some more of our internal#[rustc_*]TEST attributes)r? @ghost
Create a similar rollup