Skip to content

some Attribute/AttributeExt cleanups - #164744

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
mejrs:attr_cleanup
Oct 23, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
mejrs:attr_cleanup

Conversation

@mejrs

@mejrs mejrs commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

@rustbot

rustbot commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler 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 Oct 22, 2026
@rustbot

rustbot commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

JonathanBrouwer is currently at their maximum review capacity.
They may take a while to respond.

@JonathanBrouwer JonathanBrouwer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit cb9333a has been tentatively approved by JonathanBrouwer

It will be put into the queue for this repository once PR CI succeeds.

@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. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 22, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot added 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 22, 2026
@rust-bors

rust-bors Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

❌ Commit cb9333a has been unapproved due to PR CI failure. Reapprove it with @bors r+ force if you want to ignore the failure.

@mejrs

mejrs commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

oh right, miri

@rustbot

rustbot commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

Comment thread src/tools/miri/src/intrinsics/mod.rs Outdated
.next()
.is_none()
{
#[allow(deprecated)]

@RalfJung RalfJung Oct 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining why we use a deprecated API here.

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also an expect would be nice)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The api isn't really deprecrated, it's more "don't use this for parsed attributes".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there's a better way to communicate that than deprecation then, e.g. via naming?

Comment thread src/tools/miri/src/intrinsics/mod.rs Resolved
Comment thread compiler/rustc_ast/src/attr/mod.rs Resolved
Comment thread src/tools/miri/src/intrinsics/mod.rs Resolved
into_iter,
into_try_type,
intra_doc_pointers,
intrinsic_fallback_is_spec,

@RalfJung RalfJung Oct 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we could use this functionality the interner as to add Miri-specific symbols in Miri rather than having to add them here. I am fine either way.

View changes since the review

Comment thread src/tools/miri/src/intrinsics/mod.rs Resolved
@mejrs

mejrs commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

I think that's all feedback addressed.

FWIW, I am exploring ideas on how to handle tool attributes better, so hopefully at some point it'll feel better than having to allow deprecated methods and such ;)

@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 5638439 has been approved by JonathanBrouwer

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. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #162395 (Make more float intrinsics generic)
 - #164636 (Remove `record_*` macros from the metadata encoder)
 - #164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - #164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - #164744 (some `Attribute`/`AttributeExt` cleanups)
@rust-bors
rust-bors Bot merged commit aac203f into rust-lang:main Oct 23, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Rollup merge of #164744 - mejrs:attr_cleanup, r=JonathanBrouwer

some `Attribute`/`AttributeExt` cleanups

r? @JonathanBrouwer
programskillforverification pushed a commit to programskillforverification/miri that referenced this pull request Oct 24, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#162395 (Make more float intrinsics generic)
 - rust-lang/rust#164636 (Remove `record_*` macros from the metadata encoder)
 - rust-lang/rust#164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - rust-lang/rust#164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - rust-lang/rust#164744 (some `Attribute`/`AttributeExt` cleanups)
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Oct 26, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#162395 (Make more float intrinsics generic)
 - rust-lang/rust#164636 (Remove `record_*` macros from the metadata encoder)
 - rust-lang/rust#164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - rust-lang/rust#164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - rust-lang/rust#164744 (some `Attribute`/`AttributeExt` cleanups)
renovate-bot pushed a commit to renovate-bot/rust-lang-_-compiler-builtins that referenced this pull request Oct 26, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#162395 (Make more float intrinsics generic)
 - rust-lang/rust#164636 (Remove `record_*` macros from the metadata encoder)
 - rust-lang/rust#164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - rust-lang/rust#164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - rust-lang/rust#164744 (some `Attribute`/`AttributeExt` cleanups)
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Oct 26, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#162395 (Make more float intrinsics generic)
 - rust-lang/rust#164636 (Remove `record_*` macros from the metadata encoder)
 - rust-lang/rust#164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - rust-lang/rust#164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - rust-lang/rust#164744 (some `Attribute`/`AttributeExt` cleanups)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 27, 2026
…r,ada4a

make tool_attrs method to retrieve tool attributes.

Some followup work on rust-lang#164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 27, 2026
…r,ada4a

make tool_attrs method to retrieve tool attributes.

Some followup work on rust-lang#164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 27, 2026
…r,ada4a

make tool_attrs method to retrieve tool attributes.

Some followup work on rust-lang#164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
rust-bors Bot pushed a commit that referenced this pull request Oct 28, 2026
Rollup merge of #164900 - mejrs:tool_attrs, r=JonathanBrouwer,ada4a

make tool_attrs method to retrieve tool attributes.

Some followup work on #164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
darkraider01 pushed a commit to darkraider01/miri that referenced this pull request Oct 29, 2026
make tool_attrs method to retrieve tool attributes.

Some followup work on rust-lang/rust#164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Oct 30, 2026
make tool_attrs method to retrieve tool attributes.

Some followup work on rust-lang/rust#164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Oct 30, 2026
make tool_attrs method to retrieve tool attributes.

Some followup work on rust-lang/rust#164744 (comment)

Short of some kind of parsing/checking framework for tool attributes (which will be a lot of work), I think this is the best solution.

cc @ada4a maybe you're interested in reviewing this as well, there are some clippy changes here too.
rust-bors Bot pushed a commit that referenced this pull request Oct 31, 2026
hashcatHitman pushed a commit to hashcatHitman/rustc_codegen_gcc that referenced this pull request Oct 31, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#162395 (Make more float intrinsics generic)
 - rust-lang/rust#164636 (Remove `record_*` macros from the metadata encoder)
 - rust-lang/rust#164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - rust-lang/rust#164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - rust-lang/rust#164744 (some `Attribute`/`AttributeExt` cleanups)
acearyanarun pushed a commit to acearyanarun/kani that referenced this pull request Nov 17, 2026
The automatic toolchain upgrade has been stuck since nightly-2026-10-24
(model-checking#5061). This brings the toolchain to nightly-2026-11-11, in four
commits:

1. **nightly-2026-10-24.** rust-lang/rust#164744 removed
`Attribute::span`, `get_normal_item` and `TyCtxt::get_attrs_by_path`;
Kani's `kanitool::*` attributes are unparsed tool attributes, so
`attrs_by_path` and `attr_span` read them directly.
rust-lang/rust#162395 made `ceil`, `floor`, `trunc`, `round`,
`round_ties_even`, `sqrt`, `powf`, `powi` and `fma` generic, with
fallback bodies; the one for `powi` calls `__powisf2`/`__powidf2`, which
CBMC does not model, so Kani keeps its CBMC models for f32 and f64
(`uses_kani_model`, shared by codegen and reachability).
2. **nightly-2026-11-11.** Tool attributes are now `Attribute::Tool` and
lost `meta_item_list`/`is_word`; `AbiAlign` and `GenericArgsRef` were
removed; `rustc_abi::Float::X87F80` is reported as unsupported, like
`f16b`; and a new clippy lint. Two less obvious ones:
- Cargo now reports only the hashed rlib of each Kani library
(`libstd-<hash>.rlib`), while the driver links `libstd.rlib` by name, so
every test failed to find `std`. `build-kani` renames Kani's rlibs to
`lib<crate>.rlib` in the sysroot (renamed, not copied, so rustc never
sees two candidates).
- Calling a closure through a function pointer argument can now take a
pointer to a capture-free closure, which the uninit checker rejected as
unsupported (`uninit/delayed-ub` lost its expected failure). Zero-sized
closures and function items have no bytes to track.
3. **A model of the `derive(Debug)` helpers.** rust-lang/rust#164726
made `derive(Debug)` pass all names as one space-separated string, which
`Formatter::debug_struct_fields_finish` and
`Formatter::debug_c_like_enum_write_str` split with `memchr`. Its
word-at-a-time loop depends on pointer alignment, and verifying any
derived `Debug` became orders of magnitude slower:

   | Nightly | rust-lang/rust#164726 | `cargo-kani/iss2857` |
   |---|---|---|
   | 2026-10-24 | no | 46s |
   | 2026-10-29 | no | 44s |
   | 2026-10-30 | yes | > 15 min (stopped) |
   | 2026-11-11 | yes | > 58 min, 9 GB (stopped) |
   | 2026-11-11, this PR | yes | 53s |

Kani now replaces those two helpers (the
`debug_struct_field{1..5}_finish` helpers forward to the first) with
models that split the same string with a byte loop and format through
the same public builders. `docs/src/soundness.md` lists them as
assumptions.

4. **LLBC: zero-sized constants.** MIR now assigns `()` to the return
place after the last call of a unit function (`_0 = ()`) as a zero-sized
constant, which the LLBC backend did not translate (`todo!()`). It now
builds zero-sized tuples and structs field by field, as in model-checking#5045; each
LLBC expected output gains that one line.

### Testing

- `kani-regression.sh` passes on nightly-2026-11-11 (run in a container
with CBMC 6.11.0), apart from `script-based-pre/compiler_defaults`
(needs `jq`) and `script-based-pre/cbmc_truncated_results` (depends on
the memory limit), which fail only in that container.
`kani-llbc-regression.sh` passes (the LLBC build and clippy with `-D
warnings`, 20 expected tests and the cargo suite), and `kani-fmt.sh
--check` and workspace clippy pass.
- `library/kani/src/fmt_model_tests.rs` compares the models with the
real `derive(Debug)` output natively (named, tuple and unit structs,
more than five fields, nesting, `{:#?}`, widths, C-like enums with raw
and non-ASCII names). Checking exact formatter output inside Kani takes
over nine minutes per harness, with or without the models, so this is a
native test; `tests/kani/FmtDerive` checks that Kani verifies formatting
of each shape through the models (84s).
- `cargo-kani/iss2857` is the performance regression test.

Resolves model-checking#5061

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Signed-off-by: Felipe R. Monteiro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler 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