Fixes to the roll-up
This commit is contained in:
parent
2e9f705b93
commit
ee66c84165
|
@ -84,6 +84,8 @@ While we know that we've covered all possible cases, Rust can't tell. It
|
|||
doesn't know that probability is between 0.0 and 1.0. So we add another case:
|
||||
|
||||
```rust
|
||||
use Event::NewRelease;
|
||||
|
||||
enum Event {
|
||||
NewRelease,
|
||||
}
|
||||
|
@ -106,7 +108,7 @@ fn descriptive_probability(event: Event) -> &'static str {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
std::io::println(descriptive_probability(NewRelease));
|
||||
println!("{}", descriptive_probability(NewRelease));
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -151,15 +153,14 @@ enum Version { Version1, Version2 }
|
|||
#[deriving(Show)]
|
||||
enum ParseError { InvalidHeaderLength, InvalidVersion }
|
||||
|
||||
|
||||
fn parse_version(header: &[u8]) -> Result<Version, ParseError> {
|
||||
if header.len() < 1 {
|
||||
return Err(InvalidHeaderLength);
|
||||
return Err(ParseError::InvalidHeaderLength);
|
||||
}
|
||||
match header[0] {
|
||||
1 => Ok(Version1),
|
||||
2 => Ok(Version2),
|
||||
_ => Err(InvalidVersion)
|
||||
1 => Ok(Version::Version1),
|
||||
2 => Ok(Version::Version2),
|
||||
_ => Err(ParseError::InvalidVersion)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local) {
|
|||
|
||||
pub fn walk_lifetime_def<'v, V: Visitor<'v>>(visitor: &mut V,
|
||||
lifetime_def: &'v LifetimeDef) {
|
||||
visitor.visit_lifetime_ref(&lifetime_def.lifetime);
|
||||
visitor.visit_name(lifetime_def.lifetime.span, lifetime_def.lifetime.name);
|
||||
for bound in lifetime_def.bounds.iter() {
|
||||
visitor.visit_lifetime_ref(bound);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,6 @@ fn main() {
|
|||
|
||||
1234suffix; //~ ERROR illegal suffix `suffix` for numeric literal
|
||||
0b101suffix; //~ ERROR illegal suffix `suffix` for numeric literal
|
||||
1.0suffix; //~ ERROR illegal suffix `suffix` for numeric literal
|
||||
1.0e10suffix; //~ ERROR illegal suffix `suffix` for numeric literal
|
||||
1.0suffix; //~ ERROR illegal suffix `suffix` for float literal
|
||||
1.0e10suffix; //~ ERROR illegal suffix `suffix` for float literal
|
||||
}
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
enum Foo {
|
||||
FooB { x: i32, y: i32 }
|
||||
}
|
||||
use Foo::FooB;
|
||||
|
||||
enum Foo {
|
||||
FooB { x: i32, y: i32 }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let f = FooB { x: 3, y: 4 };
|
||||
match f {
|
||||
FooB(a, b) => println!("{} {}", a, b),
|
||||
|
|
Loading…
Reference in New Issue