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: 'internal error: entered unreachable code', compiler/rustc_parse/src/parser/item.rs:1723:17 #86086

Closed
Cancelll opened this issue Jun 7, 2021 · 5 comments
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

@Cancelll
Copy link

Cancelll commented Jun 7, 2021

Code

trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (35fff69d0 2021-06-06)
binary: rustc
commit-hash: 35fff69d043b1c0f5c29894e7f4b0da8b039c131
commit-date: 2021-06-06
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:75
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                          ^^^^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' "default" 'async' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                                          ^^^^^^^^^

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:85
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                                    ^^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' "async" '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                                                    ^^^^^^^

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:93
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                                            ^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' "&raw" ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                                                            ^^^^^^

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:104
  |
1 | ...ync' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ...
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & "?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && "_ mut ( ) ;
  |                                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: underscore literal suffix is not allowed
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:180
  |
1 | ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                         ^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: see issue #42326 <https://github.com/rust-lang/rust/issues/42326> for more information

error[E0670]: `async fn` is not permitted in Rust 2015
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:20
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                    ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: set `edition = "2018"` in `Cargo.toml`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected identifier, found `']'`
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:67
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                  ^^^ expected identifier

error: expected one of `)`, `,`, `->`, `;`, `where`, or `{`, found `]`
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:100
  |
1 | ...�áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... ,...
  |                         -                                     -^
  |                         |                                     |
  |                         unclosed delimiter                    help: `)` may belong here

thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_parse/src/parser/item.rs:1723:17
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (35fff69d0 2021-06-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0670`.
Backtrace

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:75
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                          ^^^^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' "default" 'async' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                                          ^^^^^^^^^

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:85
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                                    ^^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' "async" '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                                                    ^^^^^^^

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:93
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                                            ^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' "&raw" ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                                                            ^^^^^^

error: character literal may only contain one codepoint
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:104
  |
1 | ...ync' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ...
  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & "?ဪൈ self , ... , ... , ... , ... , ... , ... , ... , ... , ... , ) -> && "_ mut ( ) ;
  |                                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: underscore literal suffix is not allowed
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:180
  |
1 | ... , ... , ... , ... , ... , ... , ... , ... , ) -> && '_ mut ( ) ;
  |                                                         ^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: see issue #42326 <https://github.com/rust-lang/rust/issues/42326> for more information

error[E0670]: `async fn` is not permitted in Rust 2015
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:20
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                    ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: set `edition = "2018"` in `Cargo.toml`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected identifier, found `']'`
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:67
  |
1 | trait Tr : Sized { async extern r###"��áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ s...
  |                                                                  ^^^ expected identifier

error: expected one of `)`, `,`, `->`, `;`, `where`, or `{`, found `]`
 --> default_finding_folder_rust/crash_20210605_014058_0055/delta/perses_result/mutant.rs:1:100
  |
1 | ...�áÖ@"### fn union < > ( # [ ']' '[' 'default' 'async' '&raw' ] & '?ဪൈ self , ... , ... , ... , ... , ... ,...
  |                         -                                     -^
  |                         |                                     |
  |                         unclosed delimiter                    help: `)` may belong here

thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_parse/src/parser/item.rs:1723:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/35fff69d043b1c0f5c29894e7f4b0da8b039c131/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/35fff69d043b1c0f5c29894e7f4b0da8b039c131/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/35fff69d043b1c0f5c29894e7f4b0da8b039c131/library/core/src/panicking.rs:50:5
   3: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_fn
   4: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_kind
   5: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
   6: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_assoc_item
   7: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_kind
   8: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item_common
   9: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_mod
  10: rustc_parse::parse_crate_from_file
  11: rustc_interface::passes::parse
  12: rustc_interface::queries::Queries::parse
  13: rustc_span::with_session_globals
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-nightly (35fff69d0 2021-06-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3 -Z new-llvm-pass-manager=yes -Z unsound-mir-opts=yes -Z polonius=yes -Z polymorphize=yes -C debuginfo=2 -C opt-level=3 --crate-type staticlib

query stack during panic:
end of query stack
error: aborting due to 7 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0670`.

@Cancelll Cancelll added C-bug Category: This is a bug. 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. labels Jun 7, 2021
@Cancelll
Copy link
Author

Cancelll commented Jun 7, 2021

Possibly related to #81804

@leonardo-m
Copy link

Was this bug found by fuzzing?

@Cancelll
Copy link
Author

Cancelll commented Jun 7, 2021

Was this bug found by fuzzing?

yes

@jonas-schievink jonas-schievink added the A-parser Area: The parsing of Rust source code to an AST label Jun 7, 2021
@hellow554
Copy link
Contributor

hellow554 commented Jun 7, 2021

trait Tr {
    fn union(#[]
}

fn main() {}

I can confirm that this issue referes to the same rollup as #81804 (which was suggested by cancelll as a possible duplicate). Therefore I would suggest adding this to the other issue as an example that will be added as a testcase and close this :)

On a second thought, the only difference is that this is a trait function instead of a plain function, therefore a possible fix should cover both...

fanninpm added a commit to fanninpm/glacier that referenced this issue Jun 11, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 12, 2021
@JohnTitor
Copy link
Member

Closing as duplicate, added this case to #81804 (comment) just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

No branches or pull requests

6 participants