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

Compiler error when running clippy after the rust 1.58 update. #8307

Closed
appetrosyan opened this issue Jan 18, 2022 · 5 comments
Closed

Compiler error when running clippy after the rust 1.58 update. #8307

appetrosyan opened this issue Jan 18, 2022 · 5 comments

Comments

@appetrosyan
Copy link

MWE

  • Clone Iroha

  • Checkout iroha2-dev branch.

  • Run cargo clippy -- -D 'anonymous_parameters' -D 'clippy::all' -D 'clippy::dbg_macro' -D 'clippy::nursery' -D 'clippy::pedantic' -D 'clippy::restriction' -D 'future_incompatible' -D 'missing_copy_implementations' -D 'missing_docs' -D 'nonstandard_style' -D 'private_doc_tests' -D 'rust_2018_idioms' -D 'trivial_casts' -D 'trivial_numeric_casts' -D 'unconditional_recursion' -D 'unsafe_code'-D 'unused' -D 'unused_import_braces' -D 'variant_size_differences' -A 'clippy::string_add' -A 'clippy::as_conversions' -A 'clippy::else_if_without_else' -A 'clippy::enum_glob_use' -A 'clippy::exhaustive_enums'-A 'clippy::exhaustive_structs' -A 'clippy::implicit_return' -A 'clippy::inconsistent_struct_constructor' -A 'clippy::indexing_slicing' -A 'clippy::integer_arithmetic' -A 'clippy::let_underscore_must_use' -A'clippy::match_wildcard_for_single_variants' -A 'clippy::missing_docs_in_private_items' -A 'clippy::missing_inline_in_public_items' -A 'clippy::module_name_repetitions' -A 'clippy::must_use_candidate' -A 'clippy::pattern_type_mismatch' -A 'clippy::semicolon_if_nothing_returned' -A 'clippy::shadow_reuse' -A 'clippy::shadow_same' -A 'clippy::unreachable' -A 'clippy::use_self' -A 'clippy::wildcard_enum_match_arm' -A 'clippy::wildcard_imports' -A 'elided_lifetimes_in_paths' -A 'clippy::manual_assert' -A 'clippy::separated_literal_suffix' -A 'clippy::mod-module-files' -A 'clippy::self-named-module-files' -A 'clippy::same_name_method' -A 'clippy::missing_const_for_fn'

  • Observe the following traceback.

Checking iroha_crypto v2.0.0-pre.1 (/mnt/Archive/Git/iroha/crypto)
Checking iroha_telemetry v2.0.0-pre.1 (/mnt/Archive/Git/iroha/telemetry)
thread 'rustc' panicked at 'assertion failed: self.start_pos.to_u32() + total_extra_bytes <= bpos.to_u32()', compiler/rustc_span/src/lib.rs:1677:9
stack backtrace:
0: rust_begin_unwind
at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/panicking.rs:107:14
2: core::panicking::panic
at /rustc/02072b482a8b5357f7fb5e5637444ae30e423c40/library/core/src/panicking.rs:48:5
3: <rustc_span::SourceFile>::lookup_file_pos
4: <rustc_span::SourceFile>::lookup_file_pos_with_col_display
5: <clippy_lints::undocumented_unsafe_blocks::UndocumentedUnsafeBlocks>::block_has_safety_comment
6: <clippy_lints::undocumented_unsafe_blocks::UndocumentedUnsafeBlocks as rustc_lint::passes::LateLintPass>::check_block
7: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_block
8: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_block
9: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_block
11: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_expr
12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_body
13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_fn
14: rustc_hir::intravisit::walk_impl_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
15: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_impl_item
16: rustc_hir::intravisit::walk_impl_item_ref::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
17: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
18: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
19: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
20: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_mod
21: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
22: rustc_hir::intravisit::walk_mod::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
23: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_mod
24: <rustc_middle::hir::map::Map>::walk_toplevel_module::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
25: rustc_lint::late::late_lint_pass_crate::<rustc_lint::late::LateLintPassObjects>
26: rustc_lint::late::late_lint_crate::<rustc_lint::BuiltinCombinedLateLintPass>
27: rustc_data_structures::sync::join::<rustc_lint::late::check_crate<rustc_lint::BuiltinCombinedLateLintPass, rustc_interface::passes::analysis::{closure#5}::{closure#0}::{closure#3}::{closure#0}::{closure#0}>::{closure#0}, rustc_lint::late::check_crate<rustc_lint::BuiltinCombinedLateLintPass, rustc_interface::passes::analysis::{closure#5}::{closure#0}::{closure#3}::{closure#0}::{closure#0}>::{closure#1}, (), ()>
28: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#5}::{closure#0}> as core::ops::function::FnOnce<()>>::call_once
29: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#5}>
30: rustc_interface::passes::analysis
31: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>
32: rustc_data_structures::stack::ensure_sufficient_stack::<(core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::dep_graph::graph::DepNodeIndex), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#3}>
33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
35: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
36: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
37: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
38: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.58 (02072b4 2022-01-11)

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `iroha_crypto`
@appetrosyan
Copy link
Author

appetrosyan commented Jan 18, 2022

Workarounds:

  • Use earlier stable toolchain (rust 1.57)
  • Use nightly 2022-01-15
  • Reduce number lints so that more lints to fix are returned
  • Replace -A with -W

@giraffate
Copy link
Contributor

FYI this has been fixed at #7934.

@appetrosyan
Copy link
Author

Great! So is this going to be fixed in rust 1.58.1?

@giraffate
Copy link
Contributor

Unfortunately, it seems that it wasn't inclueded in 1.58.1.

@flip1995
Copy link
Member

Closing, since this is already fixed in nightly and beta and just has to ride the release train now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants