Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2592,7 +2592,8 @@ impl Symbol {
/// (`token_to_string`, `Ident::to_string`), except that symbols don't keep the rawness flag
/// or edition, so we have to guess the rawness using the global edition.
pub fn to_ident_string(self) -> String {
Ident::with_dummy_span(self).to_string()
// Avoid creating an empty identifier, because that asserts in debug builds.
if self == kw::Empty { String::new() } else { Ident::with_dummy_span(self).to_string() }
}
}

Expand Down
6 changes: 0 additions & 6 deletions tests/crashes/140884.rs

This file was deleted.

3 changes: 3 additions & 0 deletions tests/ui/extern/extern-empty-string-issue-140884.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern "" {} //~ ERROR invalid ABI: found ``

fn main() {}
15 changes: 15 additions & 0 deletions tests/ui/extern/extern-empty-string-issue-140884.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error[E0703]: invalid ABI: found ``
--> $DIR/extern-empty-string-issue-140884.rs:1:8
|
LL | extern "" {}
| ^^ invalid ABI
|
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions
help: there's a similarly named valid ABI `C`
|
LL | extern "C" {}
| +

error: aborting due to 1 previous error

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