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

ICE: assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32 #128717

Closed
matthiaskrgr opened this issue Aug 6, 2024 · 4 comments · Fixed by #128864
Closed

ICE: assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32 #128717

matthiaskrgr opened this issue Aug 6, 2024 · 4 comments · Fixed by #128864
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-HIR Area: The high-level intermediate representation (HIR) A-Unicode Area: Unicode C-bug Category: This is a bug. D-Unicode-unaware Diagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

snippet:

pub fn main() {
    main (arr[i];
}

Version information

rustc 1.82.0-nightly (b586701f7 2024-08-05)
binary: rustc
commit-hash: b586701f78a6d5c7f618b76e7ae3cace9a6fbf37
commit-date: 2024-08-05
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: unknown start of token: \u{ff08}
 --> /tmp/icemaker_global_tempdir.hijyp6Vy7Iut/rustc_testrunner_tmpdir_reporting.2jS84jyEH0Ar/mvce.rs:2:10
  |
2 |     main (arr[i]);
  |          ^^
  |
help: Unicode character '(' (Fullwidth Left Parenthesis) looks like '(' (Left Parenthesis), but it is not
  |
2 |     main (arr[i]);
  |          ~

error: unknown start of token: \u{ff09}
 --> /tmp/icemaker_global_tempdir.hijyp6Vy7Iut/rustc_testrunner_tmpdir_reporting.2jS84jyEH0Ar/mvce.rs:2:17
  |
2 |     main (arr[i]);
  |                  ^^
  |
help: Unicode character ')' (Fullwidth Right Parenthesis) looks like ')' (Right Parenthesis), but it is not
  |
2 |     main (arr[i]);
  |                  ~

error[E0425]: cannot find value `arr` in this scope
   --> /tmp/icemaker_global_tempdir.hijyp6Vy7Iut/rustc_testrunner_tmpdir_reporting.2jS84jyEH0Ar/mvce.rs:2:11
    |
2   |     main (arr[i]);
    |            ^^^ help: a tuple variant with a similar name exists: `Err`
    |
   ::: /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/result.rs:536:5
    |
536 |     Err(#[stable(feature = "rust1", since = "1.0.0")] E),
    |     --- similarly named tuple variant `Err` defined here

error[E0425]: cannot find value `i` in this scope
 --> /tmp/icemaker_global_tempdir.hijyp6Vy7Iut/rustc_testrunner_tmpdir_reporting.2jS84jyEH0Ar/mvce.rs:2:15
  |
2 |     main (arr[i]);
  |                ^ not found in this scope

error[E0061]: this function takes 0 arguments but 1 argument was supplied
 --> /tmp/icemaker_global_tempdir.hijyp6Vy7Iut/rustc_testrunner_tmpdir_reporting.2jS84jyEH0Ar/mvce.rs:2:5
  |
2 |     main (arr[i]);
  |     ^^^^   ------ unexpected argument
  |
note: function defined here
 --> /tmp/icemaker_global_tempdir.hijyp6Vy7Iut/rustc_testrunner_tmpdir_reporting.2jS84jyEH0Ar/mvce.rs:1:8
  |
1 | pub fn main() {
  |        ^^^^
thread 'rustc' panicked at compiler/rustc_span/src/lib.rs:2028:17:
assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32
stack backtrace:
   0:     0x7379e402ef5d - std::backtrace_rs::backtrace::libunwind::trace::h54121657fad6b938
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7379e402ef5d - std::backtrace_rs::backtrace::trace_unsynchronized::hd2e82ea9904f2ea9
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7379e402ef5d - std::sys::backtrace::_print_fmt::h75adf07dfa40e5d2
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:66:9
   3:     0x7379e402ef5d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h98e5ee4b224fe254
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:39:26
   4:     0x7379e407f6eb - core::fmt::rt::Argument::fmt::h0835d2bcbbdcecae
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/core/src/fmt/rt.rs:173:76
   5:     0x7379e407f6eb - core::fmt::write::h41425652aafb8d55
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/core/src/fmt/mod.rs:1178:21
   6:     0x7379e4022cc3 - std::io::Write::write_fmt::h722492c13c12a6df
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/io/mod.rs:1823:15
   7:     0x7379e4031752 - std::sys::backtrace::BacktraceLock::print::hcfe3c665d987f44a
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:42:9
   8:     0x7379e4031752 - std::panicking::default_hook::{{closure}}::h73b850e758a43b44
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:266:22
   9:     0x7379e40313be - std::panicking::default_hook::h0ed5c4bdc6aad088
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:293:9
  10:     0x7379e0498bf7 - std[5068228d6f0dc02a]::panicking::update_hook::<alloc[8fcb41ef64dc878b]::boxed::Box<rustc_driver_impl[b43ed4103cc78677]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x7379e4032142 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h88c4c4826ca7daef
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/alloc/src/boxed.rs:2164:9
  12:     0x7379e4032142 - std::panicking::rust_panic_with_hook::h9849dc0f6b06d65d
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:805:13
  13:     0x7379e4031dc3 - std::panicking::begin_panic_handler::{{closure}}::hf77d3bd3ba796e45
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:664:13
  14:     0x7379e402f449 - std::sys::backtrace::__rust_end_short_backtrace::h61e613d4057be1a3
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/backtrace.rs:170:18
  15:     0x7379e4031a84 - rust_begin_unwind
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/panicking.rs:662:5
  16:     0x7379e407bd43 - core::panicking::panic_fmt::hc58ff999a1ba55da
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/core/src/panicking.rs:74:14
  17:     0x7379e407bdcc - core::panicking::panic::hbce99ce8443817ed
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/core/src/panicking.rs:148:5
  18:     0x7379de9bb1c0 - <rustc_span[6b6bb1cd45519793]::source_map::SourceMap>::lookup_char_pos
  19:     0x7379e2aafbff - <rustc_span[6b6bb1cd45519793]::source_map::SourceMap>::is_valid_span
  20:     0x7379e2aaaef7 - <core[430efa8e2f06c6b]::iter::adapters::filter_map::FilterMap<core[430efa8e2f06c6b]::iter::adapters::cloned::Cloned<core[430efa8e2f06c6b]::iter::adapters::filter::Filter<core[430efa8e2f06c6b]::slice::iter::Iter<rustc_errors[1c74d9fcab0bdd42]::Substitution>, <rustc_errors[1c74d9fcab0bdd42]::CodeSuggestion>::splice_lines::{closure#0}>>, <rustc_errors[1c74d9fcab0bdd42]::CodeSuggestion>::splice_lines::{closure#1}> as core[430efa8e2f06c6b]::iter::traits::iterator::Iterator>::next
  21:     0x7379e2aa67b2 - <rustc_errors[1c74d9fcab0bdd42]::emitter::HumanEmitter>::emit_messages_default
  22:     0x7379e2ba1227 - <rustc_errors[1c74d9fcab0bdd42]::emitter::HumanEmitter as rustc_errors[1c74d9fcab0bdd42]::emitter::Emitter>::emit_diagnostic
  23:     0x7379e2ba27ef - <rustc_errors[1c74d9fcab0bdd42]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  24:     0x7379e2b9fd51 - rustc_interface[dcf23a6b0366e6de]::callbacks::track_diagnostic::<core[430efa8e2f06c6b]::option::Option<rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>
  25:     0x7379e2b9e1fe - <rustc_errors[1c74d9fcab0bdd42]::DiagCtxtInner>::emit_diagnostic
  26:     0x7379e2b9e0ad - <rustc_errors[1c74d9fcab0bdd42]::DiagCtxtHandle>::emit_diagnostic
  27:     0x7379e2b9d255 - <rustc_span[6b6bb1cd45519793]::ErrorGuaranteed as rustc_errors[1c74d9fcab0bdd42]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  28:     0x7379e07ac5db - <rustc_hir_typeck[3b9cefa2bb200429]::fn_ctxt::FnCtxt>::report_arg_errors
  29:     0x7379deef06b5 - <rustc_hir_typeck[3b9cefa2bb200429]::fn_ctxt::FnCtxt>::confirm_builtin_call
  30:     0x7379e23ac340 - <rustc_hir_typeck[3b9cefa2bb200429]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  31:     0x7379e23a5633 - <rustc_hir_typeck[3b9cefa2bb200429]::fn_ctxt::FnCtxt>::check_block_with_expected
  32:     0x7379e23acf98 - <rustc_hir_typeck[3b9cefa2bb200429]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33:     0x7379e239089c - rustc_hir_typeck[3b9cefa2bb200429]::check::check_fn
  34:     0x7379e2369837 - rustc_hir_typeck[3b9cefa2bb200429]::typeck
  35:     0x7379e23691f3 - rustc_query_impl[bae30e77a033ddc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bae30e77a033ddc]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 8usize]>>
  36:     0x7379e1d92ab5 - rustc_query_system[9eda3ab91ed39e2e]::query::plumbing::try_execute_query::<rustc_query_impl[bae30e77a033ddc]::DynamicConfig<rustc_query_system[9eda3ab91ed39e2e]::query::caches::VecCache<rustc_span[6b6bb1cd45519793]::def_id::LocalDefId, rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bae30e77a033ddc]::plumbing::QueryCtxt, false>
  37:     0x7379e1d91ca3 - rustc_query_impl[bae30e77a033ddc]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7379e1d918c0 - <rustc_middle[6ed3e96e78853911]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[c02afad8edaa9fa]::check_crate::{closure#4}>::{closure#0}
  39:     0x7379e1d8f6ac - rustc_hir_analysis[c02afad8edaa9fa]::check_crate
  40:     0x7379e1d85055 - rustc_interface[dcf23a6b0366e6de]::passes::analysis
  41:     0x7379e1d84c07 - rustc_query_impl[bae30e77a033ddc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bae30e77a033ddc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 1usize]>>
  42:     0x7379e29a816e - rustc_query_system[9eda3ab91ed39e2e]::query::plumbing::try_execute_query::<rustc_query_impl[bae30e77a033ddc]::DynamicConfig<rustc_query_system[9eda3ab91ed39e2e]::query::caches::SingleCache<rustc_middle[6ed3e96e78853911]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bae30e77a033ddc]::plumbing::QueryCtxt, false>
  43:     0x7379e29a7ecf - rustc_query_impl[bae30e77a033ddc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7379e28adc23 - rustc_interface[dcf23a6b0366e6de]::interface::run_compiler::<core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>, rustc_driver_impl[b43ed4103cc78677]::run_compiler::{closure#0}>::{closure#1}
  45:     0x7379e27e9709 - std[5068228d6f0dc02a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_with_globals<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_pool_with_globals<rustc_interface[dcf23a6b0366e6de]::interface::run_compiler<core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>, rustc_driver_impl[b43ed4103cc78677]::run_compiler::{closure#0}>::{closure#1}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>
  46:     0x7379e27e94b2 - <<std[5068228d6f0dc02a]::thread::Builder>::spawn_unchecked_<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_with_globals<rustc_interface[dcf23a6b0366e6de]::util::run_in_thread_pool_with_globals<rustc_interface[dcf23a6b0366e6de]::interface::run_compiler<core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>, rustc_driver_impl[b43ed4103cc78677]::run_compiler::{closure#0}>::{closure#1}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[430efa8e2f06c6b]::result::Result<(), rustc_span[6b6bb1cd45519793]::ErrorGuaranteed>>::{closure#1} as core[430efa8e2f06c6b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7379e403be5b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h47908fbe26776c73
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/alloc/src/boxed.rs:2150:9
  48:     0x7379e403be5b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h54da00d4b6e8da22
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/alloc/src/boxed.rs:2150:9
  49:     0x7379e403be5b - std::sys::pal::unix::thread::Thread::new::thread_start::hbf56854fd7d508a2
                               at /rustc/b586701f78a6d5c7f618b76e7ae3cace9a6fbf37/library/std/src/sys/pal/unix/thread.rs:105:17
  50:     0x7379dcea6ded - <unknown>
  51:     0x7379dcf2a0dc - <unknown>
  52:                0x0 - <unknown>

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.82.0-nightly (b586701f7 2024-08-05) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0061, E0425.
For more information about an error, try `rustc --explain E0061`.

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Aug 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 6, 2024
@jieyouxu jieyouxu added the A-HIR Area: The high-level intermediate representation (HIR) label Aug 6, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Aug 6, 2024

Probably one of those call_expr.span.with_lo(call_expr.span.hi() - BytePos(1)) cases... We should almost have an internal deny lint that bans explicit BytePos manipulations for suggestions.

Possibly

call_expr.span.with_lo(call_expr.span.hi() - BytePos(1))

@jieyouxu jieyouxu added A-diagnostics Area: Messages for errors, warnings, and lints and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 6, 2024
@jieyouxu jieyouxu assigned jieyouxu and unassigned jieyouxu Aug 6, 2024
@fmease fmease added the A-Unicode Area: Unicode label Aug 7, 2024
@fmease
Copy link
Member

fmease commented Aug 7, 2024

We should almost have an internal deny lint that bans explicit BytePos manipulations for suggestions.

Strongly agree. It's so easy to find these kinds of ICEs:

  1. One simply needs to look for /(+|-) BytePos\(\d+\)/ inside compiler/,
  2. Figure out which ASCII character is meant
  3. Go to one's favorite Unicode table website that can list Confusables
  4. Pick a Confusable whose .len_utf8() is >1 and 💥

@fmease
Copy link
Member

fmease commented Aug 7, 2024

For example, here's another one which I organically found while reviewing an unrelated PR:

fn f() {}

fn main() {
    f(0,1;
}

This code uses a Medium Right Parenthesis Ornament (U+2769) which is confusable with Right Parenthesis

@fmease
Copy link
Member

fmease commented Aug 7, 2024

I'll open an issue for the internal lint.

@jieyouxu jieyouxu added the D-Unicode-unaware Diagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertions label Aug 9, 2024
rust-cloud-vms bot pushed a commit to jieyouxu/rust that referenced this issue Aug 9, 2024
@jieyouxu jieyouxu self-assigned this Aug 9, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 9, 2024
Use `SourceMap::end_point` instead of `- BytePos(1)` in arg removal suggestion

Previously, we tried to remove extra arg commas when providing extra arg removal suggestions. One of
the edge cases is having to account for an arg that has a closing delimiter `)` following it.
However, the previous suggestion code assumed that the delimiter is in fact exactly the 1-byte `)`
character. This assumption was proven incorrect, because we recover from Unicode-confusable
delimiters in the parser, which means that the ending delimiter could be a multi-byte codepoint
that looks *like* a `)`. Subtracing 1 byte could land us in the middle of a codepoint, triggering a
codepoint boundary assertion.

This is fixed by using `SourceMap::end_point` which properly accounts for codepoint boundaries.

Fixes rust-lang#128717.

cc `@fmease` and rust-lang#128790
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 9, 2024
Use `SourceMap::end_point` instead of `- BytePos(1)` in arg removal suggestion

Previously, we tried to remove extra arg commas when providing extra arg removal suggestions. One of
the edge cases is having to account for an arg that has a closing delimiter `)` following it.
However, the previous suggestion code assumed that the delimiter is in fact exactly the 1-byte `)`
character. This assumption was proven incorrect, because we recover from Unicode-confusable
delimiters in the parser, which means that the ending delimiter could be a multi-byte codepoint
that looks *like* a `)`. Subtracing 1 byte could land us in the middle of a codepoint, triggering a
codepoint boundary assertion.

This is fixed by using `SourceMap::end_point` which properly accounts for codepoint boundaries.

Fixes rust-lang#128717.

cc ``@fmease`` and rust-lang#128790
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Aug 9, 2024
Use `SourceMap::end_point` instead of `- BytePos(1)` in arg removal suggestion

Previously, we tried to remove extra arg commas when providing extra arg removal suggestions. One of
the edge cases is having to account for an arg that has a closing delimiter `)` following it.
However, the previous suggestion code assumed that the delimiter is in fact exactly the 1-byte `)`
character. This assumption was proven incorrect, because we recover from Unicode-confusable
delimiters in the parser, which means that the ending delimiter could be a multi-byte codepoint
that looks *like* a `)`. Subtracing 1 byte could land us in the middle of a codepoint, triggering a
codepoint boundary assertion.

This is fixed by using `SourceMap::end_point` which properly accounts for codepoint boundaries.

Fixes rust-lang#128717.

cc ```@fmease``` and rust-lang#128790
@bors bors closed this as completed in 9eb77ac Aug 9, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 9, 2024
Rollup merge of rust-lang#128864 - jieyouxu:funnicode, r=Urgau

Use `SourceMap::end_point` instead of `- BytePos(1)` in arg removal suggestion

Previously, we tried to remove extra arg commas when providing extra arg removal suggestions. One of
the edge cases is having to account for an arg that has a closing delimiter `)` following it.
However, the previous suggestion code assumed that the delimiter is in fact exactly the 1-byte `)`
character. This assumption was proven incorrect, because we recover from Unicode-confusable
delimiters in the parser, which means that the ending delimiter could be a multi-byte codepoint
that looks *like* a `)`. Subtracing 1 byte could land us in the middle of a codepoint, triggering a
codepoint boundary assertion.

This is fixed by using `SourceMap::end_point` which properly accounts for codepoint boundaries.

Fixes rust-lang#128717.

cc ````@fmease```` and rust-lang#128790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-HIR Area: The high-level intermediate representation (HIR) A-Unicode Area: Unicode C-bug Category: This is a bug. D-Unicode-unaware Diagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants