Repository navigation
Disappearing error in Rust 1.74 #138982
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
- addedneeds-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Mar 26, 2025 I believe this is expected, see #113126.
jonathanpallant commented
on Mar 26, 2025 ContributorAuthorMore actionsIf I expand the macro (
cargo expand) and write it out to a new file (and clean it up a bit), I get some warnings. Are the warnings elided because the code is macro generated?warning: type `Uart` is more private than the item `MmioUart::<'_>::ptr` --> src/main.rs:39:5 | 39 | pub const unsafe fn ptr(&self) -> *mut Uart { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method `MmioUart::<'_>::ptr` is reachable at visibility `pub` | note: but type `Uart` is only usable at visibility `pub(crate)`The
private_interfaceslint andprivate_boundslints (like most lints) are indeed silenced in macro generated code.Do you think it would make sense to also show these two lints in macro generated code?
- addedA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.and removedC-bugCategory: This is a bug.Category: This is a bug.needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triagingThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
on Mar 26, 2025
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: Both 1.73 and 1.74 would report the same error?
Instead, this happened: 1.74 builds without an error.
Is this because the offending function (
pub fn ptr() -> PrivateType) was macro generated?I think the fix is to change our macro so that
fn ptr()is only pub ifPrivateTypeis pub. But it was weird that the error went away.