-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
I tried this code:
$ git clone https://github.com/knurling-rs/derive-mmio
$ cd derive-mmio
$ git checkout weird-pub-issue
$ cargo +1.73 run --example array
...
error[E0446]: private type `Uart` in public interface
--> examples/array.rs:1:10
|
1 | #[derive(derive_mmio::Mmio)]
| ^^^^^^^^^^^^^^^^^ can't leak private type
2 | #[repr(C)]
3 | struct Uart {
| ----------- `Uart` declared as private
|
= note: this error originates in the derive macro `derive_mmio::Mmio` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0446`.
error: could not compile `derive-mmio` (example "array") due to previous error
$ cargo +1.74 run --example array
Finished dev [unoptimized + debuginfo] target(s) in 4.20s
Running `target/debug/examples/array`
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 if PrivateType
is pub. But it was weird that the error went away.
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.