You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using non-pub types in ascent macros the generated code emits a "private type … in public interface (error E0446)" warning that will turn into an error in future versions of Rust.
warning: private type `PrivateType` in public interface(error E0446)
--> src/main.rs:6:13
|
6 | let _ = ascent::ascent_run! {
| _____________^
7 | | // struct Program;8 | |
9 | | relation dummy(PrivateType);
10 | | };
| |_____^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note:for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
= note: `#[warn(private_in_public)]` on by default
= note: this warning originates in the macro `ascent::ascent_run` (in Nightly builds, run with -Z macro-backtrace for more info)
Un-commenting the // struct Program; silences the warning.
I'm not sure if there's a good solution for this (which doesn't get in the way of scenarios for public types), but it might be a good idea to add a note in the docs for this, since the fix might not be obvious immediately?
The text was updated successfully, but these errors were encountered:
As you pointed out, the solution already exists: a struct declaration at the top of the Ascent program. I'll add a hint to the documentation on silencing this warning.
Alternatively the struct <PROGRAM_NAME>; pattern could be mandatory, which would then allow for specifying the visibility by use of pub struct <PROGRAM_NAME>;, pub(crate) struct <PROGRAM_NAME>;, or whatever other level is required.
This way future changes in the compiler turning the warning into an error won't break any existing ascent-using projects.
When using non-
pub
types in ascent macros the generated code emits a "private type…
in public interface (error E0446)" warning that will turn into an error in future versions of Rust.To reproduce compile this code:
Un-commenting the
// struct Program;
silences the warning.I'm not sure if there's a good solution for this (which doesn't get in the way of scenarios for public types), but it might be a good idea to add a note in the docs for this, since the fix might not be obvious immediately?
The text was updated successfully, but these errors were encountered: