Skip to content

[ICE]: Span must not be empty and have no suggestion : unused_braces points at nonexisting brace  #107423

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

impl A for B {
    fn a(){{{{({{{ExprKind::Use {});(]),}}
    fn b()  {c!(<> []))}

#[rustc_legacy_const_generics(2)]
pub unsafe fn c<>() -> () {}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.69.0-nightly (d6f064282 2023-01-28)
binary: rustc
commit-hash: d6f0642827e21a088b0130c84857d84f5433301d
commit-date: 2023-01-28
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

+ debug assertions

Current error output

without debug assertions we show this:

warning: unnecessary braces around block return value
 --> /home/matthias/vcs/github/glacier2/fixed/94629.rs:2:17
  |
2 |     fn a(){{{{({{{ExprKind::Use {});(]),}}
  |                 ^                  ^
  |
  = note: `#[warn(unused_braces)]` on by default
help: remove these braces
  |
2 -     fn a(){{{{({{{ExprKind::Use {});(]),}}
2 +     fn a(){{{{({{ExprKind::Use {});(]),}}
  |

You can see that the second code span is a `;` and not a brace.
I believe this causes the crash with debug assertions enabled (th

Backtrace

.

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some way

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions