diff --git a/src/doc/guide-error-handling.md b/src/doc/guide-error-handling.md index 427ca4ba1a16..e2a706e59f0f 100644 --- a/src/doc/guide-error-handling.md +++ b/src/doc/guide-error-handling.md @@ -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 { 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) } } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 1eae5286d79a..41a7ce7d78e5 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -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); } diff --git a/src/test/compile-fail/bad-lit-suffixes.rs b/src/test/compile-fail/bad-lit-suffixes.rs index e142365a8ca0..d10337e768c7 100644 --- a/src/test/compile-fail/bad-lit-suffixes.rs +++ b/src/test/compile-fail/bad-lit-suffixes.rs @@ -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 } diff --git a/src/test/compile-fail/issue-19086.rs b/src/test/compile-fail/issue-19086.rs index 9fd1f228984b..692018594571 100644 --- a/src/test/compile-fail/issue-19086.rs +++ b/src/test/compile-fail/issue-19086.rs @@ -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),