Skip to content

A Compiler bug #14007

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

Closed
hardglitch opened this issue Jan 16, 2025 · 6 comments · Fixed by #13953
Closed

A Compiler bug #14007

hardglitch opened this issue Jan 16, 2025 · 6 comments · Fixed by #13953
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@hardglitch
Copy link

Summary

"thread 'rustc' panicked at src\tools\clippy\clippy_lints\src\literal_string_with_formatting_args.rs:127:40:
byte index 2 is not a char boundary; it is inside 'и' (bytes 1..3) of {и}"

rustc-ice-2025-01-16T05_10_40-2424.txt

Version

rustc 1.86.0-nightly (419b3e2d3 2025-01-15)
binary: rustc
commit-hash: 419b3e2d3e350822550eee0e82eeded4d324d584
commit-date: 2025-01-15
host: x86_64-pc-windows-msvc
release: 1.86.0-nightly
LLVM version: 19.1.6

Error output

Backtrace

0: 0x7ffa51ace921 - std::backtrace_rs::backtrace::dbghelp64::trace
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src....\backtrace\src\backtrace\dbghelp64.rs:91
1: 0x7ffa51ace921 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src....\backtrace\src\backtrace\mod.rs:66
2: 0x7ffa51ace921 - std::sys::backtrace::_print_fmt
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\sys\backtrace.rs:66
3: 0x7ffa51ace921 - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\sys\backtrace.rs:39
4: 0x7ffa51b017da - core::fmt::rt::Argument::fmt
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\core\src\fmt\rt.rs:177
5: 0x7ffa51b017da - core::fmt::write
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\core\src\fmt\mod.rs:1440
6: 0x7ffa51ac4277 - std::io::Write::write_fmtstd::sys::pal::windows::stdio::Stderr
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\io\mod.rs:1887
7: 0x7ffa51ace765 - std::sys::backtrace::BacktraceLock::print
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\sys\backtrace.rs:42
8: 0x7ffa51ad16a0 - std::panicking::default_hook::closure$0
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\panicking.rs:298
9: 0x7ffa51ad1491 - std::panicking::default_hook
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\panicking.rs:325
10: 0x7ffa530e70c3 - core[e961ba79cc2a9c5b]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[a8fa370892f2fa3e]::Level, &str), usize), <((rustc_lint_defs[a8fa370892f2fa3e]::Level, &str), usize) as core[e961ba79cc2a9c5b]::cmp::PartialOrd>::lt>
11: 0x7ffa51ad232e - alloc::boxed::impl$30::call
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\alloc\src\boxed.rs:2027
12: 0x7ffa51ad232e - std::panicking::rust_panic_with_hook
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\panicking.rs:839
13: 0x7ffa51ad2089 - std::panicking::begin_panic_handler::closure$0
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\panicking.rs:704
14: 0x7ffa51acf49f - std::sys::backtrace::__rust_end_short_backtracestd::panicking::begin_panic_handler::closure_env$0,never$
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\sys\backtrace.rs:168
15: 0x7ffa51ad1c8e - std::panicking::begin_panic_handler
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\panicking.rs:695
16: 0x7ffa549b07a1 - core::panicking::panic_fmt
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\core\src\panicking.rs:75
17: 0x7ffa51b06dc8 - core::str::slice_error_fail_rt
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\core\src\str\mod.rs:111
18: 0x7ffa549b0e58 - core::str::slice_error_fail
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\core\src\str\mod.rs:68
19: 0x7ff6d2580f0d -
20: 0x7ffa5406272d - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
21: 0x7ffa540625ec - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
22: 0x7ffa54062da6 - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
23: 0x7ffa540625ec - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
24: 0x7ffa5406280a - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
25: 0x7ffa540625ec - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
26: 0x7ffa54062c25 - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
27: 0x7ffa540625ec - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
28: 0x7ffa53fc3c78 - <hashbrown[8d04810150b648e]::raw::RawTable<((rustc_middle[5d938f69f472c422]::ty::Ty, rustc_middle[5d938f69f472c422]::ty::Ty), ())>>::reserve_rehash::<hashbrown[8d04810150b648e]::map::make_hasher<(rustc_middle[5d938f69f472c422]::ty::Ty, rustc_middle[5d938f69f472c422]::ty::Ty), (), rustc_hash[7483773b1fec81f7]::FxBuildHasher>::{closure#0}>
29: 0x7ffa54063487 - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
30: 0x7ffa54062ee0 - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
31: 0x7ffa540625ec - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
32: 0x7ffa54062501 - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
33: 0x7ffa54062fe9 - <rustc_lint[fa758735c2b993c]::invalid_from_utf8::InvalidFromUtf8 as rustc_lint[fa758735c2b993c]::passes::LateLintPass>::check_expr
34: 0x7ffa54047fb5 - <alloc[9259e5dcbcace616]::raw_vec::RawVec<rustc_parse[24d98a6f6d0c22a6]::lexer::UnmatchedDelim>>::grow_one
35: 0x7ffa54047595 - <alloc[9259e5dcbcace616]::raw_vec::RawVec<rustc_parse[24d98a6f6d0c22a6]::lexer::UnmatchedDelim>>::grow_one
36: 0x7ffa54047595 - <alloc[9259e5dcbcace616]::raw_vec::RawVec<rustc_parse[24d98a6f6d0c22a6]::lexer::UnmatchedDelim>>::grow_one
37: 0x7ffa54047595 - <alloc[9259e5dcbcace616]::raw_vec::RawVec<rustc_parse[24d98a6f6d0c22a6]::lexer::UnmatchedDelim>>::grow_one
38: 0x7ffa517316c9 - rustc_lint[fa758735c2b993c]::late::check_crate
39: 0x7ffa5173075d - rustc_lint[fa758735c2b993c]::late::check_crate
40: 0x7ffa4eb288b8 - rustc_interface[37b5b39fd50beb21]::passes::analysis
41: 0x7ffa516cea3a - <alloc[9259e5dcbcace616]::sync::Arc<rustc_session[5c824f699cf31e4f]::cstore::CrateSource>>::drop_slow
42: 0x7ffa515e05bc - RINvNtNtCscQVpe5pY0yi_18rustc_query_system5query8plumbing17try_execute_queryINtCsbZBwHjCVeIf_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs826vGZ86jK0_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
43: 0x7ffa516d45e4 - rustc_query_impl[8bb2802b204273e9]::query_system
44: 0x7ffa4eaee5d6 - RINvNtNtCs22spTQJ3Kgb_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCscz1twBMeTME_5alloc5boxed3BoxDINtNtNtCsk2hHNxNtjGp_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECs4rd
45: 0x7ffa4eae6f9e - RINvNtNtCs22spTQJ3Kgb_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCscz1twBMeTME_5alloc5boxed3BoxDINtNtNtCsk2hHNxNtjGp_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECs4rd
46: 0x7ffa4eadf989 - RINvNtNtCs22spTQJ3Kgb_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs4MxAIpyoX3V_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs4rdeu1Xpo33_17rustc_driver_i
47: 0x7ffa4eaf3383 - RINvNtNtCs22spTQJ3Kgb_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCscz1twBMeTME_5alloc5boxed3BoxDINtNtNtCsk2hHNxNtjGp_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECs4rd
48: 0x7ffa51ae427d - alloc::boxed::impl$28::call_once
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\alloc\src\boxed.rs:2013
49: 0x7ffa51ae427d - alloc::boxed::impl$28::call_once
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\alloc\src\boxed.rs:2013
50: 0x7ffa51ae427d - std::sys::pal::windows::thread::impl$0::new::thread_start
at /rustc/419b3e2d3e350822550eee0e82eeded4d324d584/library\std\src\sys\pal\windows\thread.rs:56
51: 0x7ffab953259d - BaseThreadInitThunk
52: 0x7ffaba44af38 - RtlUserThreadStart

@hardglitch hardglitch added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jan 16, 2025
@samueltardieu
Copy link
Contributor

Reproducer:

fn main() {
    let s = "{и}";
}

@profetia
Copy link
Contributor

I doubt if this is the same cause of #13953. Looks like to be a parsing issue.

@samueltardieu
Copy link
Contributor

Yes, it is not the same cause at all, but #13953 is kind of an emergency fix that will need to be retrofitted in the beta, and this also (IMO) needs to make it way through the beta since it's an ICE, hence my remark.

GuillaumeGomez added a commit to GuillaumeGomez/rust-clippy that referenced this issue Jan 18, 2025
@hardglitch
Copy link
Author

The problem disappeared in the nightly build (1.86.0-nightly (a9e7b3048 2025-02-07)). It works for me.
If this bug doesn't slip into the stable release I think this issue can be closed.

@y21
Copy link
Member

y21 commented Feb 8, 2025

It's not fixed. The lint was just moved to nursery in #14014, so as long as you don't enable the lint it gets filtered out and the buggy code doesn't execute. If you add #![warn(clippy::literal_string_with_formatting_args)] to your repro it still happens.

@hardglitch
Copy link
Author

Ok, thanks!
Now I can at least use Clippy. Before that, it was completely broken.

github-merge-queue bot pushed a commit that referenced this issue Feb 13, 2025
… not (#13953)

Fixes #13885.
Fixes #14007.

Problem was that I forgot to check whether or not the `span` was a
"real" one. Because if not, then it starts pointing to pretty much only
wrong content, hence the problems we saw with clippy linting on
`clippy.toml`.

changelog: Fix `literal_string_with_formatting_args` lint emitted when
it should not

r? @samueltardieu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants