Auto merge of #31416 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415 - Failed merges:
This commit is contained in:
commit
9d8e3a024a
@ -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
|
||||
|
@ -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
|
||||
|
@ -516,7 +516,7 @@ struct_expr : expr_path '{' ident ':' expr
|
||||
### Block expressions
|
||||
|
||||
```antlr
|
||||
block_expr : '{' [ stmt ';' | item ] *
|
||||
block_expr : '{' [ stmt | item ] *
|
||||
[ expr ] '}' ;
|
||||
```
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user