diff --git a/src/types/alias.md b/src/types/alias.md index 5fda9477e8..1d004587cf 100644 --- a/src/types/alias.md +++ b/src/types/alias.md @@ -5,19 +5,15 @@ must have `UpperCamelCase` names, or the compiler will raise a warning. The exception to this rule are the primitive types: `usize`, `f32`, etc. ```rust,editable -// `NanoSecond` is a new name for `u64`. +// `NanoSecond`, `Inch`, and `U64` are new names for `u64`. type NanoSecond = u64; type Inch = u64; - -// Use an attribute to silence warning. -#[allow(non_camel_case_types)] -type u64_t = u64; -// TODO ^ Try removing the attribute +type U64 = u64; fn main() { - // `NanoSecond` = `Inch` = `u64_t` = `u64`. - let nanoseconds: NanoSecond = 5 as u64_t; - let inches: Inch = 2 as u64_t; + // `NanoSecond` = `Inch` = `U64` = `u64`. + let nanoseconds: NanoSecond = 5 as U64; + let inches: Inch = 2 as U64; // Note that type aliases *don't* provide any extra type safety, because // aliases are *not* new types