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

force-warns panics with unknown lint name #86958

Closed
ehuss opened this issue Jul 7, 2021 · 3 comments · Fixed by #86970
Closed

force-warns panics with unknown lint name #86958

ehuss opened this issue Jul 7, 2021 · 3 comments · Fixed by #86970
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jul 7, 2021

Using the --force-warns option with an unknown lint name causes an ICE.

rustc +nightly --force-warns=abc -Zunstable-options foo.rs

I expected to see this happen: Issue a E0602 error.

Meta

rustc --version --verbose:

rustc 1.55.0-nightly (885399992 2021-07-06)
binary: rustc
commit-hash: 885399992c4c1dde37b506b8507a7d69415646b9
commit-date: 2021-07-06
host: x86_64-apple-darwin
release: 1.55.0-nightly
LLVM version: 12.0.1
Backtrace

thread 'rustc' panicked at 'compiler/rustc_lint/src/levels.rs:117:37: A valid lint failed to produce a lint ids', compiler/rustc_middle/src/util/bug.rs:35:26
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   3: rustc_middle::ty::context::tls::with_opt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_lint::levels::LintLevelsBuilder::process_command_line::{{closure}}
   8: rustc_lint::levels::LintLevelsBuilder::new
   9: rustc_lint::context::EarlyContext::new
  10: rustc_lint::early::check_ast_crate
  11: rustc_interface::passes::pre_expansion_lint
  12: rustc_interface::passes::configure_and_expand
  13: rustc_interface::queries::Queries::expansion
  14: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  15: rustc_span::with_source_map
  16: rustc_interface::interface::create_compiler_and_run
  17: scoped_tls::ScopedKey<T>::set

cc @rylev

@ehuss ehuss added the C-bug Category: This is a bug. label Jul 7, 2021
@inquisitivecrystal
Copy link
Contributor

@rustbot claim

I'm going to take a look at this. I'm also going to see if I can fix the problem you mentioned at #86009 (comment) while I'm at it.

@ehuss
Copy link
Contributor Author

ehuss commented Jul 8, 2021

Just FYI, the cap-lints issue has been fixed by #86572.

@inquisitivecrystal
Copy link
Contributor

Good to know!

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 15, 2021
…vidtwco

Make `--force-warns` a normal lint level option

Now that `ForceWarn` is a lint level, there's no reason `--force-warns` should be treated differently from other options that set lint levels. This merges the `ForceWarn` handling in with the other lint level command line options. It also unifies all of the relevant selection logic in `compiler/rustc_lint/src/levels.rs`, rather than having some of it weirdly elsewhere.

Fixes rust-lang#86958, which arose from the special-cased handling of `ForceWarn` having had an error in it.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 15, 2021
…vidtwco

Make `--force-warns` a normal lint level option

Now that `ForceWarn` is a lint level, there's no reason `--force-warns` should be treated differently from other options that set lint levels. This merges the `ForceWarn` handling in with the other lint level command line options. It also unifies all of the relevant selection logic in `compiler/rustc_lint/src/levels.rs`, rather than having some of it weirdly elsewhere.

Fixes rust-lang#86958, which arose from the special-cased handling of `ForceWarn` having had an error in it.
@inquisitivecrystal inquisitivecrystal added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 18, 2021
@bors bors closed this as completed in b543e0d Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. 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