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

rustc_lint: Prevent triplication of various lints #119388

Merged
merged 5 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0453.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Example of erroneous code:

#[allow(non_snake_case)]
fn main() {
let MyNumber = 2; // error: allow(non_snake_case) overruled by outer
// forbid(non_snake_case)
// error: allow(non_snake_case) incompatible with previous forbid
let MyNumber = 2;
}
```

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ impl<'a> EarlyContext<'a> {
pub(crate) fn new(
sess: &'a Session,
features: &'a Features,
warn_about_weird_lints: bool,
lint_added_lints: bool,
lint_store: &'a LintStore,
registered_tools: &'a RegisteredTools,
buffered: LintBuffer,
Expand All @@ -1078,7 +1078,7 @@ impl<'a> EarlyContext<'a> {
builder: LintLevelsBuilder::new(
sess,
features,
warn_about_weird_lints,
lint_added_lints,
lint_store,
registered_tools,
),
Expand Down
62 changes: 31 additions & 31 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn lint_expectations(tcx: TyCtxt<'_>, (): ()) -> Vec<(LintExpectationId, LintExp
unstable_to_stable_ids: FxHashMap::default(),
empty: FxHashMap::default(),
},
warn_about_weird_lints: false,
lint_added_lints: false,
store,
registered_tools: tcx.registered_tools(()),
};
Expand Down Expand Up @@ -164,7 +164,7 @@ fn shallow_lint_levels_on(tcx: TyCtxt<'_>, owner: hir::OwnerId) -> ShallowLintLe
empty: FxHashMap::default(),
attrs,
},
warn_about_weird_lints: false,
lint_added_lints: false,
store,
registered_tools: tcx.registered_tools(()),
};
Expand Down Expand Up @@ -451,7 +451,7 @@ pub struct LintLevelsBuilder<'s, P> {
sess: &'s Session,
features: &'s Features,
provider: P,
warn_about_weird_lints: bool,
lint_added_lints: bool,
store: &'s LintStore,
registered_tools: &'s RegisteredTools,
}
Expand All @@ -464,15 +464,15 @@ impl<'s> LintLevelsBuilder<'s, TopDown> {
pub(crate) fn new(
sess: &'s Session,
features: &'s Features,
warn_about_weird_lints: bool,
lint_added_lints: bool,
store: &'s LintStore,
registered_tools: &'s RegisteredTools,
) -> Self {
let mut builder = LintLevelsBuilder {
sess,
features,
provider: TopDown { sets: LintLevelSets::new(), cur: COMMAND_LINE },
warn_about_weird_lints,
lint_added_lints,
store,
registered_tools,
};
Expand Down Expand Up @@ -642,7 +642,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
//
// This means that this only errors if we're truly lowering the lint
// level from forbid.
if level != Level::Forbid {
if self.lint_added_lints && level != Level::Forbid {
if let Level::Forbid = old_level {
// Backwards compatibility check:
//
Expand Down Expand Up @@ -968,7 +968,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
continue;
}

_ if !self.warn_about_weird_lints => {}
_ if !self.lint_added_lints => {}

CheckLintNameResult::Renamed(ref replace) => {
let suggestion =
Expand Down Expand Up @@ -1029,7 +1029,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
}
}

if !is_crate_node {
if self.lint_added_lints && !is_crate_node {
for (id, &(level, ref src)) in self.current_specs().iter() {
if !id.lint.crate_level_only {
continue;
Expand All @@ -1054,33 +1054,33 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
/// Checks if the lint is gated on a feature that is not enabled.
///
/// Returns `true` if the lint's feature is enabled.
// FIXME only emit this once for each attribute, instead of repeating it 4 times for
// pre-expansion lints, post-expansion lints, `shallow_lint_levels_on` and `lint_expectations`.
#[track_caller]
fn check_gated_lint(&self, lint_id: LintId, span: Span, lint_from_cli: bool) -> bool {
if let Some(feature) = lint_id.lint.feature_gate {
if !self.features.active(feature) {
let lint = builtin::UNKNOWN_LINTS;
let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS);
struct_lint_level(
self.sess,
lint,
level,
src,
Some(span.into()),
fluent::lint_unknown_gated_lint,
|lint| {
lint.set_arg("name", lint_id.lint.name_lower());
lint.note(fluent::lint_note);
rustc_session::parse::add_feature_diagnostics_for_issue(
lint,
&self.sess.parse_sess,
feature,
GateIssue::Language,
lint_from_cli,
);
},
);
if self.lint_added_lints {
let lint = builtin::UNKNOWN_LINTS;
let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS);
struct_lint_level(
self.sess,
lint,
level,
src,
Some(span.into()),
fluent::lint_unknown_gated_lint,
|lint| {
lint.set_arg("name", lint_id.lint.name_lower());
lint.note(fluent::lint_note);
rustc_session::parse::add_feature_diagnostics_for_issue(
lint,
&self.sess.parse_sess,
feature,
GateIssue::Language,
lint_from_cli,
);
},
);
}
return false;
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/ui/error-codes/E0453.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

#[allow(non_snake_case)]
//~^ ERROR allow(non_snake_case) incompatible
//~| ERROR allow(non_snake_case) incompatible
fn main() {
}
13 changes: 1 addition & 12 deletions tests/ui/error-codes/E0453.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ LL |
LL | #[allow(non_snake_case)]
| ^^^^^^^^^^^^^^ overruled by previous forbid

error[E0453]: allow(non_snake_case) incompatible with previous forbid
--> $DIR/E0453.rs:3:9
|
LL | #![forbid(non_snake_case)]
| -------------- `forbid` level set here
LL |
LL | #[allow(non_snake_case)]
| ^^^^^^^^^^^^^^ overruled by previous forbid
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 2 previous errors
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0453`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

#![deny(multiple_supertrait_upcastable)]
//~^ WARNING unknown lint: `multiple_supertrait_upcastable`
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
#![warn(multiple_supertrait_upcastable)]
//~^ WARNING unknown lint: `multiple_supertrait_upcastable`
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
//~| WARNING unknown lint: `multiple_supertrait_upcastable`

fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,13 @@ LL | #![deny(multiple_supertrait_upcastable)]
= note: `#[warn(unknown_lints)]` on by default

warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:5:1
|
LL | #![warn(multiple_supertrait_upcastable)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable

warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
|
LL | #![deny(multiple_supertrait_upcastable)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
|
LL | #![warn(multiple_supertrait_upcastable)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
|
LL | #![deny(multiple_supertrait_upcastable)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: unknown lint: `multiple_supertrait_upcastable`
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
|
LL | #![warn(multiple_supertrait_upcastable)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `multiple_supertrait_upcastable` lint is unstable
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

warning: 6 warnings emitted
warning: 2 warnings emitted

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

#![deny(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
#![allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`

fn main() {
enum Foo {
Expand All @@ -19,9 +15,6 @@ fn main() {
#[allow(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it still appear twice?

Copy link
Member Author

@Enselic Enselic Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is emitted twice via with_lint_attrs(), first from visit_stmt() and then from visit_expr() (from inside visit_stmt()). For reference, the code looks like this:

    fn visit_expr(&mut self, e: &'a ast::Expr) {
        self.with_lint_attrs(e.id, &e.attrs, |cx| {
            lint_callback!(cx, check_expr, e);
            ast_visit::walk_expr(cx, e);
        })
    }

   // ...

    fn visit_stmt(&mut self, s: &'a ast::Stmt) {
        // Add the statement's lint attributes to our
        // current state when checking the statement itself.
        // This allows us to handle attributes like
        // `#[allow(unused_doc_comments)]`, which apply to
        // sibling attributes on the same target
        //
        // Note that statements get their attributes from
        // the AST struct that they wrap (e.g. an item)
        self.with_lint_attrs(s.id, s.attrs(), |cx| {
            lint_callback!(cx, check_stmt, s);
            cx.check_id(s.id);
        });
        // The visitor for the AST struct wrapped
        // by the statement (e.g. `Item`) will call
        // `with_lint_attrs`, so do this walk
        // outside of the above `with_lint_attrs` call
        ast_visit::walk_stmt(self, s);
    }

I can look into fixing that, but I would prefer to do it in a separate PR after this PR lands since it is a separate problem.

Copy link
Member Author

@Enselic Enselic Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, here is the top of the backtrace of err.emit() of the second emit:

backtrace
rustc_middle::lint::struct_lint_level::struct_lint_level_impl::<rustc_error_messages::DiagnosticMessage> (\home\martin\src\rust\compiler\rustc_middle\src\lint.rs:406)
rustc_middle::lint::struct_lint_level::<rustc_error_messages::DiagnosticMessage, <rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::check_gated_lint::{closure#0}> (\home\martin\src\rust\compiler\rustc_middle\src\lint.rs:408)
<rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::check_gated_lint (\home\martin\src\rust\compiler\rustc_lint\src\levels.rs:1064)
<rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::add (\home\martin\src\rust\compiler\rustc_lint\src\levels.rs:897)
<rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::push (\home\martin\src\rust\compiler\rustc_lint\src\levels.rs:517)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs::<<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_expr::{closure#0}> (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:66)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_expr (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:119)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_stmt (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:148)
rustc_ast::visit::walk_block::<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>> (\home\martin\src\rust\compiler\rustc_ast\src\visit.rs:724)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_fn (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:154)
rustc_ast::visit::walk_item::<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>> (\home\martin\src\rust\compiler\rustc_ast\src\visit.rs:326)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item::{closure#0} (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:89)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs::<<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item::{closure#0}>::{closure#0} (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:71)
stacker::maybe_grow::<(), <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs<<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item::{closure#0}>::{closure#0}> (\home\martin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\stacker-0.1.15\src\lib.rs:55)
rustc_data_structures::stack::ensure_sufficient_stack::<(), <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs<<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item::{closure#0}>::{closure#0}> (\home\martin\src\rust\compiler\rustc_data_structures\src\stack.rs:17)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs::<<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item::{closure#0}> (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:71)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass> as rustc_ast::visit::Visitor>::visit_item (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:87)
rustc_ast::visit::walk_crate::<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>> (\home\martin\src\rust\compiler\rustc_ast\src\visit.rs:272)
<(&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute]) as rustc_lint::early::EarlyCheckNode>::check::<rustc_lint::BuiltinCombinedEarlyLintPass> (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:356)
rustc_lint::early::check_ast_node_inner::<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])>::{closure#0} (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:422)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs::<rustc_lint::early::check_ast_node_inner<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])>::{closure#0}>::{closure#0} (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:71)
stacker::maybe_grow::<(), <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs<rustc_lint::early::check_ast_node_inner<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])>::{closure#0}>::{closure#0}> (\home\martin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\stacker-0.1.15\src\lib.rs:55)
rustc_data_structures::stack::ensure_sufficient_stack::<(), <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs<rustc_lint::early::check_ast_node_inner<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])>::{closure#0}>::{closure#0}> (\home\martin\src\rust\compiler\rustc_data_structures\src\stack.rs:17)
<rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedEarlyLintPass>>::with_lint_attrs::<rustc_lint::early::check_ast_node_inner<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])>::{closure#0}> (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:71)
rustc_lint::early::check_ast_node_inner::<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])> (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:422)
rustc_lint::early::check_ast_node::<rustc_lint::BuiltinCombinedEarlyLintPass, (&rustc_ast::ast::Crate, &[rustc_ast::ast::Attribute])> (\home\martin\src\rust\compiler\rustc_lint\src\early.rs:405)
rustc_interface::passes::early_lint_checks (\home\martin\src\rust\compiler\rustc_interface\src\passes.rs:325)
rustc_query_impl::query_impl::early_lint_checks::dynamic_query::{closure#2}::{closure#0} (\home\martin\src\rust\compiler\rustc_query_impl\src\plumbing.rs:589)
rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::early_lint_checks::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> (\home\martin\src\rust\compiler\rustc_query_impl\src\plumbing.rs:513)
rustc_query_impl::query_impl::early_lint_checks::dynamic_query::{closure#2} (\home\martin\src\rust\compiler\rustc_query_impl\src\plumbing.rs:585)
<rustc_query_impl::query_impl::early_lint_checks::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once (\home\martin\src\rust\library\core\src\ops\function.rs:250)
<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false> as rustc_query_system::query::config::QueryConfig<rustc_query_impl::plumbing::QueryCtxt>>::compute (\home\martin\src\rust\compiler\rustc_query_impl\src\lib.rs:119)
rustc_query_system::query::plumbing::execute_job_non_incr::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0} (\home\martin\src\rust\compiler\rustc_query_system\src\query\plumbing.rs:464)
rustc_middle::ty::context::tls::enter_context::<rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0} (\home\martin\src\rust\compiler\rustc_middle\src\ty\context\tls.rs:82)
<std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::try_with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> (\home\martin\src\rust\library\std\src\thread\local.rs:270)
<std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> (\home\martin\src\rust\library\std\src\thread\local.rs:246)
rustc_middle::ty::context::tls::enter_context::<rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> (\home\martin\src\rust\compiler\rustc_middle\src\ty\context\tls.rs:79)
<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}>::{closure#0} (\home\martin\src\rust\compiler\rustc_query_impl\src\plumbing.rs:151)
rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0} (\home\martin\src\rust\compiler\rustc_middle\src\ty\context\tls.rs:133)
rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::query::plumbing::execute_job_non_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#0}>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>::{closure#0} (\home\martin\src\rust\compiler\rustc_middle\src\ty\context\tls.rs:111)

The first err.emit() backtrace looks exactly the same, except it does not have the visit_expr() stack frame.

//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
//~^ ERROR non-exhaustive patterns: `Foo::C` not covered
Foo::A => {}
Expand All @@ -31,9 +24,6 @@ fn main() {
#[warn(non_exhaustive_omitted_patterns)]
//~^ WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(See above)

//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
//~| WARNING unknown lint: `non_exhaustive_omitted_patterns`
match Foo::A {
Foo::A => {}
Foo::B => {}
Expand Down
Loading
Loading