Skip to content

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

@m-ou-se

Description

@m-ou-se
Member

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)

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Jan 22, 2022
m-ou-se

m-ou-se commented on Jan 22, 2022

@m-ou-se
MemberAuthor

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

ibraheemdev commented on Jan 22, 2022

@ibraheemdev
Member

@rustbot claim

added a commit that references this issue on Jan 31, 2022
7de90d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @m-ou-se@ibraheemdev

    Issue actions

      'available fields are' message in diagnostic lists unstable/hidden fields. · Issue #93210 · rust-lang/rust