-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 panic: "byte index 10 is not a char boundary" #62524
Comments
There's two slicing operations in Edit: Building the debug compiler was a bust. Embarassingly, things seem to have changed and I don't know how to get those debug macros to fire in the current compiler. |
@ExpHP do you mean you were using If so, that is because the environment variable name under As an example, here is the tail of my log output:
|
triage: P-medium. Removing nomination. |
This was broken between 1.15 and 1.16, but those are so old and the nature of the ICE itself has changed from 1.28 to 1.29, so I do not think bisection would be worthwhile. |
Offtopic@pnkfelix : Thanks. Unfortunately, I did guess the name of
I set |
Okay, I did the following evil, evil thing: Pure evil, do not opendiff --git a/src/libsyntax_pos/span_encoding.rs b/src/libsyntax_pos/span_encoding.rs
index 525ec13623..d7da2206ab 100644
--- a/src/libsyntax_pos/span_encoding.rs
+++ b/src/libsyntax_pos/span_encoding.rs
@@ -74,6 +74,12 @@ pub const DUMMY_SP: Span = Span { base_or_index: 0, len_or_tag: 0, ctxt_or_zero:
impl Span {
#[inline]
pub fn new(mut lo: BytePos, mut hi: BytePos, ctxt: SyntaxContext) -> Self {
+ if lo == BytePos(10) || hi == BytePos(10) {
+ eprintln!("=========================");
+ eprintln!("{:?}", (lo, hi));
+ eprintln!();
+ let _ = std::panic::catch_unwind(|| panic!()); // potentially print backtrace
+ }
if lo > hi {
std::mem::swap(&mut lo, &mut hi);
} And acquired the following backtrace of when the span was first constructed:
It also gets constructed a second time: Second backtrace
(the region of the backtrace that differs between the two is items 22-29 in the first one, or 22-25 in the second) Some interesting spots from here: This is clearly where the value of 10 is created: rust/src/libsyntax/tokenstream.rs Lines 136 to 144 in 4bb6b4a
Here's the innermost bit that's specific to rust/src/libsyntax/parse/parser.rs Lines 622 to 634 in 4bb6b4a
|
@ExpHP I’m not familiar with I tend to list (comma separated) module paths in my own use of RUSTC_LOG; did you try that? You can see an example in the transcript I gave in my comment above |
Oh. (I'm so used to |
Same ICE occurs with: y![
Ϥ, Which returns:
|
@Chocol4te could you post a base64-encoded version of your |
@dwrensha My bad
|
syntax: Avoid span arithmetic for delimiter tokens The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it. Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly. If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries. Fixes rust-lang#62524 r? @estebank
Hm, the example from #62524 (comment) hasn't been fixed? |
Seems so, on the current nightly:
|
@Alexendoo I guess my fix #66264 would help. I'll get some time to test it out. |
Confirmed that my fix fixed this issue, I also add this unit test in this PR: #66429 |
Add a regression test for rust-lang#62524 Closes rust-lang#62524
Found with the help of libfuzzer-sys.
The text was updated successfully, but these errors were encountered: