From a60f12d84cc50978b09d1a092047025c7cc2df5e Mon Sep 17 00:00:00 2001 From: Alan Andrade Date: Wed, 25 Dec 2013 18:55:08 -0600 Subject: [PATCH 1/3] Avoid compiler error about glob imports in getopts example --- src/libextra/getopts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index 11afff16825..0220f6a6bf4 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -31,7 +31,7 @@ //! //! ~~~{.rust} //! extern mod extra; -//! use extra::getopts::*; +//! use extra::getopts::{optopt,optflag,getopts}; //! use std::os; //! //! fn do_work(inp: &str, out: Option<~str>) { From 6bc278c8c636a3964aca4b8d2d89e0321d345df3 Mon Sep 17 00:00:00 2001 From: Alan Andrade Date: Wed, 25 Dec 2013 23:48:38 -0600 Subject: [PATCH 2/3] Remove features from librustdoc --- src/librustdoc/test.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index e5ec3661b61..b21b1db955f 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -138,7 +138,6 @@ fn maketest(s: &str, cratename: &str) -> @str { let mut prog = ~r" #[deny(warnings)]; #[allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)]; -#[feature(macro_rules, globs, struct_variant, managed_boxes)]; "; if s.contains("extra") { prog.push_str("extern mod extra;\n"); From ff801d662ebdebee4845dcc825b366215e4b88bf Mon Sep 17 00:00:00 2001 From: Alan Andrade Date: Tue, 31 Dec 2013 00:51:11 -0600 Subject: [PATCH 3/3] Fix tests --- src/libextra/getopts.rs | 2 +- src/libstd/str.rs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index 0220f6a6bf4..5debc999192 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -31,7 +31,7 @@ //! //! ~~~{.rust} //! extern mod extra; -//! use extra::getopts::{optopt,optflag,getopts}; +//! use extra::getopts::{optopt,optflag,getopts,Opt}; //! use std::os; //! //! fn do_work(inp: &str, out: Option<~str>) { diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 8e6d8523f77..4516fb85f90 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -38,11 +38,15 @@ there are three common kinds of strings in rust: As an example, here's a few different kinds of strings. ```rust -let owned_string = ~"I am an owned string"; -let managed_string = @"This string is garbage-collected"; -let borrowed_string1 = "This string is borrowed with the 'static lifetime"; -let borrowed_string2: &str = owned_string; // owned strings can be borrowed -let borrowed_string3: &str = managed_string; // managed strings can also be borrowed +#[feature(managed_boxes)]; + +fn main() { + let owned_string = ~"I am an owned string"; + let managed_string = @"This string is garbage-collected"; + let borrowed_string1 = "This string is borrowed with the 'static lifetime"; + let borrowed_string2: &str = owned_string; // owned strings can be borrowed + let borrowed_string3: &str = managed_string; // managed strings can also be borrowed +} ``` From the example above, you can see that rust has 3 different kinds of string