Stream: t-compiler/help

Topic: Questions about lint level checking.


Charles Lew (Jun 13 2020 at 02:17, on Zulip):

So i'm adding a check within src/librustc_lint/levels.rs https://github.com/crlf0710/rust/commit/9ea10e749767f4e9c97dbef2ad9bceb24de7be8d#diff-c2c9f6bb6073e5b9a7ff19ad6596c5a2R341-R364

Charles Lew (Jun 13 2020 at 02:18, on Zulip):

It mostly works fine, the only problem is that, when there's an error, it got triggered three times.

Charles Lew (Jun 13 2020 at 02:20, on Zulip):

I investigated into how that happens, and it seems that the first comes from

  10: rustc_lint::levels::LintLevelsBuilder::push
  11: <rustc_lint::early::EarlyContextAndPass<T> as rustc_ast::visit::Visitor>::visit_item
  12: rustc_ast::visit::walk_crate
  13: rustc_lint::early::check_ast_crate
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  15: rustc_interface::passes::configure_and_expand_inner

The second:

  10: rustc_lint::levels::LintLevelsBuilder::push
  11: <rustc_lint::early::EarlyContextAndPass<T> as rustc_ast::visit::Visitor>::visit_item
  12: rustc_ast::visit::walk_crate
  13: rustc_lint::early::check_ast_crate
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  15: rustc_interface::passes::lower_to_hir
Charles Lew (Jun 13 2020 at 02:20, on Zulip):

(Haven't check the third one yet)

Charles Lew (Jun 13 2020 at 02:20, on Zulip):

In general this makes sense, since the code really runs multiple times.

Charles Lew (Jun 13 2020 at 02:21, on Zulip):

However, there's a neighboring check just next to it:
https://github.com/crlf0710/rust/commit/9ea10e749767f4e9c97dbef2ad9bceb24de7be8d#diff-c2c9f6bb6073e5b9a7ff19ad6596c5a2R369-R404

Charles Lew (Jun 13 2020 at 02:22, on Zulip):

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=26657889517b3ec0db16c9fa50def768
This error doesn't trigger multiple times... I'm puzzled by the difference.

Charles Lew (Jun 13 2020 at 02:37, on Zulip):

Oh never mind, it seems that error is also triggered three times. It's just that there're no internal tests covering E0453.

Charles Lew (Jun 13 2020 at 02:38, on Zulip):

I wonder if this is worth fixing?

Last update: Sep 28 2020 at 16:00UTC