diff options
| author | Jimmie Elvenmark <flugsio@gmail.com> | 2014-08-23 16:03:28 +0200 |
|---|---|---|
| committer | Jimmie Elvenmark <flugsio@gmail.com> | 2014-08-23 16:03:28 +0200 |
| commit | 673c5554437fe50d8c45f71ad8f97e769591b038 (patch) | |
| tree | 6a0dd359e44167fc9a7209ccbf10fec1e031ef65 | |
| parent | f66fd2eed10de2acacd8af73c704bf4d140410bb (diff) | |
| download | rust-673c5554437fe50d8c45f71ad8f97e769591b038.tar.gz rust-673c5554437fe50d8c45f71ad8f97e769591b038.zip | |
librustc: Don't ICE with type when name only contain underscores.
| -rw-r--r-- | src/librustc/lint/builtin.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-non-camel-case-types.rs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 80b47640146..1fa4c53832f 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -754,7 +754,7 @@ impl LintPass for NonCamelCaseTypes { // start with a non-lowercase letter rather than non-uppercase // ones (some scripts don't have a concept of upper/lowercase) - !ident.char_at(0).is_lowercase() && !ident.contains_char('_') + ident.len() > 0 && !ident.char_at(0).is_lowercase() && !ident.contains_char('_') } fn to_camel_case(s: &str) -> String { diff --git a/src/test/compile-fail/lint-non-camel-case-types.rs b/src/test/compile-fail/lint-non-camel-case-types.rs index 784930003d0..03a2d63e123 100644 --- a/src/test/compile-fail/lint-non-camel-case-types.rs +++ b/src/test/compile-fail/lint-non-camel-case-types.rs @@ -37,4 +37,6 @@ struct foo7 { bar: int, } +type __ = int; //~ ERROR type `__` should have a camel case name such as `` + fn main() { } |
