diff --git a/COPYRIGHT b/COPYRIGHT index c7ea3d39c5c19..abe8998030871 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -6,7 +6,7 @@ terms. Longer version: -The Rust Project is copyright 2016, The Rust Project +The Rust Project is copyright 2010, The Rust Project Developers. Licensed under the Apache License, Version 2.0 diff --git a/LICENSE-MIT b/LICENSE-MIT index 40b8817a47beb..25597d5838fa4 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2016 The Rust Project Developers +Copyright (c) 2010 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/src/doc/grammar.md b/src/doc/grammar.md index a400e70e97dfd..fac488d9c4aa3 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -516,7 +516,7 @@ struct_expr : expr_path '{' ident ':' expr ### Block expressions ```antlr -block_expr : '{' [ stmt ';' | item ] * +block_expr : '{' [ stmt | item ] * [ expr ] '}' ; ``` diff --git a/src/doc/reference.md b/src/doc/reference.md index 16ff95abef6b6..19c9b571a33c2 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -984,8 +984,8 @@ fn first((value, _): (i32, i32)) -> i32 { value } #### Generic functions A _generic function_ allows one or more _parameterized types_ to appear in its -signature. Each type parameter must be explicitly declared, in an -angle-bracket-enclosed, comma-separated list following the function name. +signature. Each type parameter must be explicitly declared in an +angle-bracket-enclosed and comma-separated list, following the function name. ```rust,ignore // foo is generic over A and B @@ -1179,7 +1179,7 @@ Enumeration constructors can have either named or unnamed fields: ```rust enum Animal { Dog (String, f64), - Cat { name: String, weight: f64 } + Cat { name: String, weight: f64 }, } let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); @@ -1237,12 +1237,12 @@ const STRING: &'static str = "bitstring"; struct BitsNStrings<'a> { mybits: [u32; 2], - mystring: &'a str + mystring: &'a str, } const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings { mybits: BITS, - mystring: STRING + mystring: STRING, }; ``` @@ -1661,7 +1661,7 @@ struct Foo; // Declare a public struct with a private field pub struct Bar { - field: i32 + field: i32, } // Declare a public enum with two public variants @@ -3212,7 +3212,7 @@ may refer to the variables bound within the pattern they follow. let message = match maybe_digit { Some(x) if x < 10 => process_digit(x), Some(x) => process_other(x), - None => panic!() + None => panic!(), }; ``` @@ -3504,7 +3504,7 @@ An example of a `fn` type: ``` fn add(x: i32, y: i32) -> i32 { - return x + y; + x + y } let mut x = add(5,7); diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index b6123264ea8db..38f79079b29f3 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -18,6 +18,27 @@ use mem; use ops::Range; /// Extension methods for ASCII-subset only operations on string slices. +/// +/// Be aware that operations on seemingly non-ASCII characters can sometimes +/// have unexpected results. Consider this example: +/// +/// ``` +/// use std::ascii::AsciiExt; +/// +/// assert_eq!("café".to_ascii_uppercase(), "CAFÉ"); +/// assert_eq!("café".to_ascii_uppercase(), "CAFé"); +/// ``` +/// +/// In the first example, the lowercased string is represented `"cafe\u{301}"` +/// (the last character is an acute accent [combining character]). Unlike the +/// other characters in the string, the combining character will not get mapped +/// to an uppercase variant, resulting in `"CAFE\u{301}"`. In the second +/// example, the lowercased string is represented `"caf\u{e9}"` (the last +/// character is a single Unicode character representing an 'e' with an acute +/// accent). Since the last character is defined outside the scope of ASCII, +/// it will not get mapped to an uppercase variant, resulting in `"CAF\u{e9}"`. +/// +/// [combining character]: https://en.wikipedia.org/wiki/Combining_character #[stable(feature = "rust1", since = "1.0.0")] pub trait AsciiExt { /// Container type for copied ASCII characters. diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 7ce4aa07b50e8..f8efada9f6c45 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -282,9 +282,9 @@ fn test_resize_policy() { /// let mut player_stats = HashMap::new(); /// /// fn random_stat_buff() -> u8 { -/// // could actually return some random value here - let's just return -/// // some fixed value for now -/// 42 +/// // could actually return some random value here - let's just return +/// // some fixed value for now +/// 42 /// } /// /// // insert a key only if it doesn't already exist