Skip to content

literal_string_with_formatting_args ices on {…} #13838

@klensy

Description

@klensy

Summary

Panics on input, with last line essentially added to end of tests/ui/literal_string_with_formatting_arg.rs, where 3 dots is unicode.

#![warn(clippy::literal_string_with_formatting_args)]
#![allow(clippy::unnecessary_literal_unwrap)]

fn main() {
    let x: Option<usize> = None;
    let y = "hello";
    x.expect("{…}");
}

thread 'rustc' panicked at clippy_lints\src\literal_string_with_formatting_args.rs:111:39:
byte index 4 is not a char boundary; it is inside '…' (bytes 2..5) of {…}

cc @GuillaumeGomez

Version

clippy head 968669b00a224d6e97439d317e7443b8493e2f1c

Error output

Backtrace

thread 'rustc' panicked at clippy_lints\src\literal_string_with_formatting_args.rs:111:39:
byte index 4 is not a char boundary; it is inside '…' (bytes 2..5) of ` {…}`
stack backtrace:
 0:     0x7ffc6c3d5181 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfa
33895743e766c4
 1:     0x7ffc6c40745a - core::fmt::write::hf0a60055b609b4d1
 2:     0x7ffc6c3cb487 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h96158b1677189f7a
 3:     0x7ffc6c3d4fc5 - std::sys::backtrace::lock::hddefeaf646d7e790
 4:     0x7ffc6c3d7ee3 - std::panicking::default_hook::h76a011c9926d9519
 5:     0x7ffc6c3d7cc2 - std::panicking::default_hook::h76a011c9926d9519
 6:     0x7ffc6d9ca02a - core[18052f50f01bdff8]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[134b4df
7c25af103]::Level, &str), usize), <((rustc_lint_defs[134b4df7c25af103]::Level, &str), usize) as core[18052f50f01bdff8]::
cmp::PartialOrd>::lt>
 7:     0x7ffc6c3d8712 - std::panicking::rust_panic_with_hook::h4908c5b262b601af
 8:     0x7ffc6c3d8469 - <std::panicking::begin_panic_handler::StaticStrPayload as core::fmt::Display>::fmt::h7433aef5
53e4ccb4
 9:     0x7ffc6c3d5c5f - std::sys::backtrace::__rust_end_short_backtrace::h674460e278763391
10:     0x7ffc6c3d806e - rust_begin_unwind
11:     0x7ffc6f29e1c1 - core::panicking::panic_fmt::h69fe6cfb9de5e2ee
12:     0x7ffc6c40ca58 - core::str::slice_error_fail_rt::ha0967b52668eab09
13:     0x7ffc6f29e878 - core::str::slice_error_fail::hc6896c23d7e9c94b
14:     0x7ff6cc592f7c - <clippy_lints::literal_string_with_formatting_args::LiteralStringWithFormattingArg as rustc_l
int::passes::LateLintPass>::check_expr::hb3b8ca3cfa5eb505
15:     0x7ffc6e936b8d - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
16:     0x7ffc6e936a4c - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
17:     0x7ffc6e936c6a - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
18:     0x7ffc6e936a4c - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
19:     0x7ffc6e937085 - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
20:     0x7ffc6e936a4c - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
21:     0x7ffc6e936e76 - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
22:     0x7ffc6e936a4c - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
23:     0x7ffc6e9378e7 - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
24:     0x7ffc6e937340 - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
25:     0x7ffc6e936a4c - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
26:     0x7ffc6e936961 - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
27:     0x7ffc6e937449 - <rustc_lint[dc46e4f877390854]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[dc46e4f877390
854]::passes::LateLintPass>::check_expr
28:     0x7ffc6e91c3b3 - <alloc[fd8ce09f2ec9137c]::raw_vec::RawVec<rustc_parse[4416fc4c000460be]::lexer::UnmatchedDeli
m>>::grow_one
29:     0x7ffc6e91b99d - <alloc[fd8ce09f2ec9137c]::raw_vec::RawVec<rustc_parse[4416fc4c000460be]::lexer::UnmatchedDeli
m>>::grow_one
30:     0x7ffc6e91b99d - <alloc[fd8ce09f2ec9137c]::raw_vec::RawVec<rustc_parse[4416fc4c000460be]::lexer::UnmatchedDeli
m>>::grow_one
31:     0x7ffc6c02dd09 - rustc_lint[dc46e4f877390854]::late::check_crate
32:     0x7ffc6c02cdbd - rustc_lint[dc46e4f877390854]::late::check_crate
33:     0x7ffc69420cf8 - rustc_interface[ea27108b8052293c]::passes::analysis
34:     0x7ffc6bfcb7ca - <alloc[fd8ce09f2ec9137c]::raw_vec::RawVec<(rustc_query_system[d24d5f250fa3d7ed]::dep_graph::s
erialized::SerializedDepNodeIndex, rustc_middle[68060124d2cba8c0]::query::on_disk_cache::AbsoluteBytePos)>>::grow_one
35:     0x7ffc6bed1264 - RINvNtNtCsi3qTJ1e5DZN_18rustc_query_system5query8plumbing17try_execute_queryINtCsi3f05AdaxSk_
16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs8VIibRlM4fs_12rustc_middle5query5erase6ErasedAhj0_
EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
36:     0x7ffc6bfd1497 - rustc_query_impl[d2442493e6a060ee]::query_system
37:     0x7ffc693e2dad - std[cd92aef4aedcd5c]::sys::backtrace::__rust_begin_short_backtrace::<<std[cd92aef4aedcd5c]::t
hread::Builder>::spawn_unchecked_<<rayon_core[d36b4c56087e7aa2]::registry::DefaultSpawn as rayon_core[d36b4c56087e7aa2]:
:registry::ThreadSpawn>::spawn::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
38:     0x7ffc693e0329 - RINvNtNtCs16og0deVF58_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsk6o6s17WINI
_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_
compileruNCNvCs8U8E0qxlgfM_17rustc_driver_i
39:     0x7ffc693e7465 - std[cd92aef4aedcd5c]::sys::backtrace::__rust_begin_short_backtrace::<<std[cd92aef4aedcd5c]::t
hread::Builder>::spawn_unchecked_<<rayon_core[d36b4c56087e7aa2]::registry::DefaultSpawn as rayon_core[d36b4c56087e7aa2]:
:registry::ThreadSpawn>::spawn::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
40:     0x7ffc6c3ea3ad - std::sys::pal::windows::thread::Thread::new::h3aac1257e182b5b3
41:     0x7ffcd89c7374 - BaseThreadInitThunk
42:     0x7ffcdb07cc91 - RtlUserThreadStart

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions