Auto merge of #31416 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415
- Failed merges:
This commit is contained in:
bors 2016-02-04 22:55:47 +00:00
commit 9d8e3a024a
6 changed files with 35 additions and 14 deletions

View File

@ -6,7 +6,7 @@ terms.
Longer version: Longer version:
The Rust Project is copyright 2016, The Rust Project The Rust Project is copyright 2010, The Rust Project
Developers. Developers.
Licensed under the Apache License, Version 2.0 Licensed under the Apache License, Version 2.0

View File

@ -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 Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated person obtaining a copy of this software and associated

View File

@ -516,7 +516,7 @@ struct_expr : expr_path '{' ident ':' expr
### Block expressions ### Block expressions
```antlr ```antlr
block_expr : '{' [ stmt ';' | item ] * block_expr : '{' [ stmt | item ] *
[ expr ] '}' ; [ expr ] '}' ;
``` ```

View File

@ -984,8 +984,8 @@ fn first((value, _): (i32, i32)) -> i32 { value }
#### Generic functions #### Generic functions
A _generic function_ allows one or more _parameterized types_ to appear in its A _generic function_ allows one or more _parameterized types_ to appear in its
signature. Each type parameter must be explicitly declared, in an signature. Each type parameter must be explicitly declared in an
angle-bracket-enclosed, comma-separated list following the function name. angle-bracket-enclosed and comma-separated list, following the function name.
```rust,ignore ```rust,ignore
// foo is generic over A and B // foo is generic over A and B
@ -1179,7 +1179,7 @@ Enumeration constructors can have either named or unnamed fields:
```rust ```rust
enum Animal { enum Animal {
Dog (String, f64), Dog (String, f64),
Cat { name: String, weight: f64 } Cat { name: String, weight: f64 },
} }
let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2);
@ -1237,12 +1237,12 @@ const STRING: &'static str = "bitstring";
struct BitsNStrings<'a> { struct BitsNStrings<'a> {
mybits: [u32; 2], mybits: [u32; 2],
mystring: &'a str mystring: &'a str,
} }
const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings { const BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings {
mybits: BITS, mybits: BITS,
mystring: STRING mystring: STRING,
}; };
``` ```
@ -1661,7 +1661,7 @@ struct Foo;
// Declare a public struct with a private field // Declare a public struct with a private field
pub struct Bar { pub struct Bar {
field: i32 field: i32,
} }
// Declare a public enum with two public variants // 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 { let message = match maybe_digit {
Some(x) if x < 10 => process_digit(x), Some(x) if x < 10 => process_digit(x),
Some(x) => process_other(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 { fn add(x: i32, y: i32) -> i32 {
return x + y; x + y
} }
let mut x = add(5,7); let mut x = add(5,7);

View File

@ -18,6 +18,27 @@ use mem;
use ops::Range; use ops::Range;
/// Extension methods for ASCII-subset only operations on string slices. /// 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")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait AsciiExt { pub trait AsciiExt {
/// Container type for copied ASCII characters. /// Container type for copied ASCII characters.

View File

@ -282,9 +282,9 @@ fn test_resize_policy() {
/// let mut player_stats = HashMap::new(); /// let mut player_stats = HashMap::new();
/// ///
/// fn random_stat_buff() -> u8 { /// fn random_stat_buff() -> u8 {
/// // could actually return some random value here - let's just return /// // could actually return some random value here - let's just return
/// // some fixed value for now /// // some fixed value for now
/// 42 /// 42
/// } /// }
/// ///
/// // insert a key only if it doesn't already exist /// // insert a key only if it doesn't already exist