Skip to content

Commit 673c555

Browse files
committed
librustc: Don't ICE with type when name only contain underscores.
1 parent f66fd2e commit 673c555

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/librustc/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ impl LintPass for NonCamelCaseTypes {
754754

755755
// start with a non-lowercase letter rather than non-uppercase
756756
// ones (some scripts don't have a concept of upper/lowercase)
757-
!ident.char_at(0).is_lowercase() && !ident.contains_char('_')
757+
ident.len() > 0 && !ident.char_at(0).is_lowercase() && !ident.contains_char('_')
758758
}
759759

760760
fn to_camel_case(s: &str) -> String {

src/test/compile-fail/lint-non-camel-case-types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ struct foo7 {
3737
bar: int,
3838
}
3939

40+
type __ = int; //~ ERROR type `__` should have a camel case name such as ``
41+
4042
fn main() { }

0 commit comments

Comments
 (0)