Skip to content

Make no_implicit_prelude not suppress tool attributes - #165377

Open
mejrs wants to merge 1 commit into
rust-lang:mainfrom
mejrs:no_implicit_prelude_tool_attr
Open

mejrs wants to merge 1 commit into
rust-lang:mainfrom
mejrs:no_implicit_prelude_tool_attr

Conversation

@mejrs

@mejrs mejrs commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Implements part of the register_tool rfc, RFC 3808:

Today, #![no_implicit_prelude] suppresses the tool attribute prelude but does not suppress the lint prelude (e.g., #[allow(clippy::foo)] continues to work). Under this RFC, neither prelude is suppressed by #![no_implicit_prelude]. This is technically a breaking change since it can produce new ambiguity errors in stable code.

(The breaking change is already taken care of in #162597, the ambiguity error is raised regardless of whether the no_implicit_prelude attribute is used)

Currently, the following code errors. After this PR, it will start compiling.

#![no_implicit_prelude]
#![feature(register_tool)]
#![register_tool(my_tool)]

#[my_tool::attr] // ERROR cannot find module or crate `my_tool` in this scope
#[rustfmt::skip] // ERROR cannot find module or crate `rustfmt` in this scope
struct X;

Reference PR: rust-lang/reference#2404

r? petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 2, 2026
@workingjubilee workingjubilee changed the title Make the no_implicit_prelude not suppress tool attributes Make no_implicit_prelude not suppress tool attributes Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants