Skip to content
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

When an ADT field is missing a stability attribute, look at its parent #68401

Closed
wants to merge 1 commit into from

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jan 20, 2020

This will allow us to remove stability attributes in fields in the stdlib which are shown in user visible output unnecessarily, obscuring the meaning of the span.

Partially address verbosity issues with the new output for #65386 introduced in #65912.

Once this is landed, we can manually modify the stdlib to no longer include stable attributes in tuple-like fields. This way the output can go from:

error[E0425]: cannot find function, tuple struct or tuple variant `OK` in this scope
   --> file.rs:2:11
    |
2   |   let _ = OK(());
    |           ^^ help: a tuple variant with a similar name exists (notice the capitalization): `Ok`
    |
   ::: src/libcore/result.rs:249:5
    |
249 |     Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     --------------------------------------------------- similarly named tuple variant `Ok` defined here

to

error[E0425]: cannot find function, tuple struct or tuple variant `OK` in this scope
   --> file.rs:2:11
    |
2   |   let _ = OK(());
    |           ^^ help: a tuple variant with a similar name exists (notice the capitalization): `Ok`
    |
   ::: src/libcore/result.rs:249:5
    |
249 |     Ok(T),
    |     ----- similarly named tuple variant `Ok` defined here

r? @petrochenkov

This will allow us to remove stability attributes in fields in the
stdlib which are shown in user visible output unnecessarily, obscuring
the meaning of the span.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 20, 2020
@petrochenkov
Copy link
Contributor

I'd prefer to avoid adding arbitrary exceptions into the stability system without strong reasons.

Standard library is currently shipped with remapped paths and spans from it are not displayed, so this is not a pressing issue.

fn main() {
    ok;
}

---

error[E0425]: cannot find value `ok` in this scope
 --> src/main.rs:2:5
  |
2 |     ok;
  |     ^^
  |
help: a tuple variant with a similar name exists
  |
2 |     Ok;
  |     ^^
help: possible candidates are found in other modules, you can import them into scope
  |
1 | use futures::future::ok;
  |
1 | use futures_util::future::ok;
  |

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=dc9e9c25122f5ea56f62f14a12d7557a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants