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

The -Z external-macro-backtrace message will appear in the stable channel #46167

Closed
kennytm opened this issue Nov 21, 2017 · 2 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kennytm
Copy link
Member

kennytm commented Nov 21, 2017

Since #45545 is merged, when an error happens in an external macro, rustc will suggest the user to supply the unstable flag -Z external-macro-backtrace to see the detailed backtrace:

error[E0282]: type annotations needed
  --> $DIR/cannot_infer_local_or_vec.rs:12:13
   |
12 |     let x = vec![];
   |         -   ^^^^^^ cannot infer type for `T`
   |         |
   |         consider giving `x` a type
   |
   = note: this error originates in a macro outside of the current crate (run with -Z external-macro-backtrace for more info)

error: aborting due to previous error

The problem is that -Z flags cannot be used in beta/stable, so the suggestion will be wrong. The question would be:

  • Should we explicitly specify the flag is only available in nightly, e.g. (in nightly, run with -Z external-macro-backtrace for more info)
  • Or should we just hide the message in the stable channel?
    • If we do so, how should we manage the affected UI test files?

See #45545 (comment) for detail.

cc @durka

@kennytm kennytm added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Nov 21, 2017
@steveklabnik steveklabnik added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Nov 21, 2017
@steveklabnik
Copy link
Member

We talked about this at the docs team meeting today; there are a variety of opinons, nobody feels super strongly.

However, there is sort of a precendent here with unstable features:

C:\Users\steve\tmp\foo [master +4 ~0 -0 !]> cargo +stable build
   Compiling vs v0.0.1 (file:///C:/Users/steve/tmp/foo)
error: const fn is unstable (see issue #24111)
 --> src\lib.rs:1:1
  |
1 | / pub const fn foo() {
2 | | }
  | |_^

error: aborting due to previous error

error: Could not compile `vs`.

To learn more, run the command again with --verbose.
C:\Users\steve\tmp\foo [master +4 ~0 -0 !]> cargo +nightly build
   Compiling vs v0.0.1 (file:///C:/Users/steve/tmp/foo)
error: const fn is unstable (see issue #24111)
 --> src\lib.rs:1:1
  |
1 | / pub const fn foo() {
2 | | }
  | |_^
  |
  = help: add #![feature(const_fn)] to the crate attributes to enable

error: aborting due to previous error

error: Could not compile `vs`.

To learn more, run the command again with --verbose.

Note that stable doesn't show the help, but nightly does. Could we do something like that? Then it'd be consistent.

@durka
Copy link
Contributor

durka commented Nov 21, 2017

I prefer the other approach (and would support changing the general #![feature] message to be consistent) for the reason explained in my PR.

bors added a commit that referenced this issue Nov 26, 2017
mention nightly in -Z external-macro-backtrace note

Fix #46167 by mentioning that you need nightly in the message that tells you to pass `-Z external-macro-backtrace`.

Rationale:

1. The reason for having this message is to increase discoverability of the functionality. If the message is only shown on nightly it's less disoverable.
2. The same approach is taken if you call a const fn in const context without its feature gate (previously, if you called it without `#![feature(const_fn)]`).

cc @kennytm
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 C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants