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' panicked at 'EscapeOnlyChar' #10148

Closed
xgillard opened this issue Jan 3, 2023 · 3 comments · Fixed by #10401
Closed

'rustc' panicked at 'EscapeOnlyChar' #10148

xgillard opened this issue Jan 3, 2023 · 3 comments · Fixed by #10401

Comments

@xgillard
Copy link

xgillard commented Jan 3, 2023

Hi everyone,
It looks like I have unintendedly written code that breaks clippy in my osrm_client crate (repo here: https://github.com/xgillard/osrm_client). The problem occured on my machine where I am using rust stable. If that helps, here are some more details on the exact config being used.

  • OS: OSX Ventura
  • cargo 1.66.0 (d65d197ad 2022-11-15)
  • rustc 1.66.0 (69f9c33d7 2022-12-12)
  • clippy 0.1.66 (69f9c33d 2022-12-12)

When I try to use clippy to lint my code, it breaks with the following backtrace:

stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <clippy_utils::macros::FormatString>::new::{closure#2}
   3: rustc_lexer::unescape::unescape_literal::<<clippy_utils::macros::FormatString>::new::{closure#2}>
   4: <clippy_utils::macros::FormatString>::new
   5: <clippy_utils::macros::FormatArgsExpn>::parse
   6: <clippy_lints::format_args::FormatArgs as rustc_lint::passes::LateLintPass>::check_expr
   7: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_expr
   8: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
   9: rustc_hir::intravisit::walk_arm::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  10: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  11: rustc_hir::intravisit::walk_block::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  12: rustc_hir::intravisit::walk_expr::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  13: rustc_hir::intravisit::walk_body::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  14: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_body
  15: rustc_hir::intravisit::walk_impl_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  16: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_impl_item
  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_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  20: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
  21: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects>>
  22: <rustc_lint::late::LateContextAndPass<rustc_lint::late::LateLintPassObjects> as rustc_hir::intravisit::Visitor>::visit_nested_item
  23: rustc_lint::late::late_lint_pass_crate::<rustc_lint::late::LateLintPassObjects>
  24: rustc_lint::late::late_lint_crate::<rustc_lint::BuiltinCombinedLateLintPass>
  25: rustc_data_structures::sync::join::<rustc_lint::late::check_crate<rustc_lint::BuiltinCombinedLateLintPass, rustc_interface::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#0}, rustc_lint::late::check_crate<rustc_lint::BuiltinCombinedLateLintPass, rustc_interface::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#1}, (), ()>
  26: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}>
  27: <core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::passes::analysis::{closure#5}::{closure#1}> as core::ops::function::FnOnce<()>>::call_once
  28: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#5}>
  29: rustc_interface::passes::analysis
  30: <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::ErrorGuaranteed>>
  31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  32: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  33: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  34: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  35: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
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.66 (69f9c33d 2022-12-12)

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

The project is a 404?!

@xgillard
Copy link
Author

xgillard commented Jan 3, 2023

Stupid me! I created the repo private iso public. This has been fixed now. Apologies for the inconvenience.

@lukaslueg
Copy link
Contributor

Reduced example:

use displaythis::Display;

#[derive(Display)]
pub enum Approach {
    #[display(""unrestricted)]
    Unrestricted, 
}

fn main() {
    println!("Hello, world!");
}

Notice the format-string ""unrestricted, which somehow gets wired through displaythis, and causes a crash here

The original problem is here, the line should read #[display("unrestricted")]

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

Successfully merging a pull request may close this issue.

2 participants