Skip to content

'available fields are' message in diagnostic lists unstable/hidden fields. #93210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
m-ou-se opened this issue Jan 22, 2022 · 2 comments · Fixed by #93214
Closed

'available fields are' message in diagnostic lists unstable/hidden fields. #93210

m-ou-se opened this issue Jan 22, 2022 · 2 comments · Fixed by #93214
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@m-ou-se
Copy link
Member

m-ou-se commented Jan 22, 2022

With this patch to std:

diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs
index ce5ed40940ec6..b8511eb664cb5 100644
--- a/library/core/src/pin.rs
+++ b/library/core/src/pin.rs
@@ -406,7 +406,9 @@ use crate::ops::{CoerceUnsized, Deref, DerefMut, DispatchFromDyn, Receiver};
 #[repr(transparent)]
 #[derive(Copy, Clone)]
 pub struct Pin<P> {
-    pointer: P,
+    #[unstable(feature = "pin_internals", issue = "none")]
+    #[doc(hidden)]
+    pub pointer: P,
 }

The hidden .pointer field appears as a suggestion in a diagnostic:

---- [ui] ui/async-await/suggest-switching-edition-on-await.rs stdout ----
diff of stderr:

24	LL |     x.await;
25	   |       ^^^^^ unknown field
26	   |
+	   = note: available fields are: `pointer`
27	   = note: to `.await` a `Future`, switch to Rust 2018 or later
28	   = help: set `edition = "2021"` in `Cargo.toml`
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
29	   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

(https://github.com/rust-lang/rust/runs/4908271178?check_suite_focus=true)

@m-ou-se m-ou-se added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 22, 2022
@m-ou-se
Copy link
Member Author

m-ou-se commented Jan 22, 2022

Easier reproduction of this issue:

lib.rs:

#[derive(Default)]
pub struct A {
    #[doc(hidden)]
    pub hello: i32,
}

main.rs:

fn main() {
    lib::A::default().hey;
}

output:

$ rustc lib.rs --crate-type=lib && rustc --extern lib=liblib.rlib main.rs --edition=2021 
error[E0609]: no field `hey` on type `A`
 --> main.rs:2:23
  |
2 |     lib::A::default().hey;
  |                       ^^^ unknown field
  |
  = note: available fields are: `hello`

@ibraheemdev
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants