From 75a3e29042059c7481358816d22f3a06aae53ba6 Mon Sep 17 00:00:00 2001 From: Brendan Graetz Date: Sun, 3 May 2015 20:42:47 +1000 Subject: [PATCH 01/16] =BG= minor: File::open --> File::create in rust book - `FIle::open` is for opening a file in read-only mode - `FIle::create` is for opening a file in write-only mode, which is what we want instead for this example to make sense --- src/doc/trpl/error-handling.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/trpl/error-handling.md b/src/doc/trpl/error-handling.md index e261eb01dba3e..e4809214bd48e 100644 --- a/src/doc/trpl/error-handling.md +++ b/src/doc/trpl/error-handling.md @@ -252,7 +252,7 @@ struct Info { } fn write_info(info: &Info) -> io::Result<()> { - let mut file = File::open("my_best_friends.txt").unwrap(); + let mut file = File::create("my_best_friends.txt").unwrap(); if let Err(e) = writeln!(&mut file, "name: {}", info.name) { return Err(e) @@ -282,7 +282,7 @@ struct Info { } fn write_info(info: &Info) -> io::Result<()> { - let mut file = try!(File::open("my_best_friends.txt")); + let mut file = try!(File::create("my_best_friends.txt")); try!(writeln!(&mut file, "name: {}", info.name)); try!(writeln!(&mut file, "age: {}", info.age)); From 35149bf1cec8707c186e324bf858f7bb9f2692e8 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 17:44:24 +0200 Subject: [PATCH 02/16] Clean up HashMap examples --- src/libstd/collections/hash/map.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ec130e8233a74..9d0b0dde74f16 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -250,26 +250,26 @@ fn test_resize_policy() { /// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot."); /// /// // check for a specific one. -/// if !book_reviews.contains_key(&("Les Misérables")) { +/// if !book_reviews.contains_key("Les Misérables") { /// println!("We've got {} reviews, but Les Misérables ain't one.", /// book_reviews.len()); /// } /// /// // oops, this review has a lot of spelling mistakes, let's delete it. -/// book_reviews.remove(&("The Adventures of Sherlock Holmes")); +/// book_reviews.remove("The Adventures of Sherlock Holmes"); /// /// // look up the values associated with some keys. /// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"]; -/// for book in to_find.iter() { +/// for book in &to_find { /// match book_reviews.get(book) { -/// Some(review) => println!("{}: {}", *book, *review), -/// None => println!("{} is unreviewed.", *book) +/// Some(review) => println!("{}: {}", book, review), +/// None => println!("{} is unreviewed.", book) /// } /// } /// /// // iterate over everything. -/// for (book, review) in book_reviews.iter() { -/// println!("{}: \"{}\"", *book, *review); +/// for (book, review) in &book_reviews { +/// println!("{}: \"{}\"", book, review); /// } /// ``` /// @@ -300,7 +300,7 @@ fn test_resize_policy() { /// vikings.insert(Viking::new("Harald", "Iceland"), 12); /// /// // Use derived implementation to print the status of the vikings. -/// for (viking, health) in vikings.iter() { +/// for (viking, health) in &vikings { /// println!("{:?} has {} hp", viking, health); /// } /// ``` From 6814c2f1aa0b214a9d2767283c57446d0b66fa6f Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 18:02:43 +0200 Subject: [PATCH 03/16] HashSet Docs: Split First Paragraph This way, the module index renders only the first sentence as a short description. --- src/libstd/collections/hash/set.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index f7e43b38539f1..9ff3ed88cc4eb 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -31,10 +31,12 @@ use super::state::HashState; // to get rid of it properly. /// An implementation of a hash set using the underlying representation of a -/// HashMap where the value is (). As with the `HashMap` type, a `HashSet` -/// requires that the elements implement the `Eq` and `Hash` traits. This can -/// frequently be achieved by using `#[derive(Eq, Hash)]`. If you implement -/// these yourself, it is important that the following property holds: +/// HashMap where the value is (). +/// +/// As with the `HashMap` type, a `HashSet` requires that the elements +/// implement the `Eq` and `Hash` traits. This can frequently be achieved by +/// using `#[derive(Eq, Hash)]`. If you implement these yourself, it is +/// important that the following property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) From 1283044a1a48fae610e7b602e0eb876748c7fb73 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 18:06:08 +0200 Subject: [PATCH 04/16] Clean up HashSet Examples --- src/libstd/collections/hash/set.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 9ff3ed88cc4eb..896573cbf8b25 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -66,17 +66,17 @@ use super::state::HashState; /// books.insert("The Great Gatsby"); /// /// // Check for a specific one. -/// if !books.contains(&("The Winds of Winter")) { +/// if !books.contains("The Winds of Winter") { /// println!("We have {} books, but The Winds of Winter ain't one.", /// books.len()); /// } /// /// // Remove a book. -/// books.remove(&"The Odyssey"); +/// books.remove("The Odyssey"); /// /// // Iterate over everything. -/// for book in books.iter() { -/// println!("{}", *book); +/// for book in &books { +/// println!("{}", book); /// } /// ``` /// @@ -100,7 +100,7 @@ use super::state::HashState; /// vikings.insert(Viking { name: "Harald", power: 8 }); /// /// // Use derived implementation to print the vikings. -/// for x in vikings.iter() { +/// for x in &vikings { /// println!("{:?}", x); /// } /// ``` From 5ad6edbe528113640d5a53656fa3601a3dda6cd8 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 21:50:37 +0200 Subject: [PATCH 05/16] Fix Derive Notice for HashMap --- src/libstd/collections/hash/map.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 9d0b0dde74f16..40d287b1806e2 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -212,8 +212,9 @@ fn test_resize_policy() { /// overridden with one of the constructors. /// /// It is required that the keys implement the `Eq` and `Hash` traits, although -/// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you -/// implement these yourself, it is important that the following property holds: +/// this can frequently be achieved by using `#[derive(PartialEq, Eq, Hash)]`. +/// If you implement these yourself, it is important that the following +/// property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) From 2ac380a29492a0f7c481fc839ad723a1488b3e29 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 21:51:41 +0200 Subject: [PATCH 06/16] Fix Derive Notice for HashSet --- src/libstd/collections/hash/set.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 896573cbf8b25..d6754f10335ca 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -35,8 +35,8 @@ use super::state::HashState; /// /// As with the `HashMap` type, a `HashSet` requires that the elements /// implement the `Eq` and `Hash` traits. This can frequently be achieved by -/// using `#[derive(Eq, Hash)]`. If you implement these yourself, it is -/// important that the following property holds: +/// using `#[derive(PartialEq, Eq, Hash)]`. If you implement these yourself, +/// it is important that the following property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) From 92d49cf6c5dec016fc1262e4436c62dc199f2b9d Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Sun, 3 May 2015 17:41:23 -0400 Subject: [PATCH 07/16] Remove unused extract_grammar.py This script used to be used to extract the grammar sections from the reference, but there is now a separate src/doc/grammar.md where the grammar sections that used to be in the reference live, so there is no longer a need to extract the grammar from the reference. --- src/etc/extract_grammar.py | 156 ------------------------------------- 1 file changed, 156 deletions(-) delete mode 100755 src/etc/extract_grammar.py diff --git a/src/etc/extract_grammar.py b/src/etc/extract_grammar.py deleted file mode 100755 index a12c3298cb35b..0000000000000 --- a/src/etc/extract_grammar.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -# This script is for extracting the grammar from the rust docs. - -import fileinput - -collections = {"gram": [], - "keyword": [], - "reserved": [], - "binop": [], - "unop": []} - - -in_coll = False -coll = "" - -for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")): - if in_coll: - if line.startswith("~~~~"): - in_coll = False - else: - if coll in ["keyword", "reserved", "binop", "unop"]: - for word in line.split(): - if word not in collections[coll]: - collections[coll].append(word) - else: - collections[coll].append(line) - - else: - if line.startswith("~~~~"): - for cname in collections: - if ("." + cname) in line: - coll = cname - in_coll = True - break - -# Define operator symbol-names here - -tokens = ["non_star", "non_slash", "non_eol", - "non_single_quote", "non_double_quote", "ident"] - -symnames = { - ".": "dot", - "+": "plus", - "-": "minus", - "/": "slash", - "*": "star", - "%": "percent", - - "~": "tilde", - "@": "at", - - "!": "not", - "&": "and", - "|": "or", - "^": "xor", - - "<<": "lsl", - ">>": "lsr", - ">>>": "asr", - - "&&": "andand", - "||": "oror", - - "<": "lt", - "<=": "le", - "==": "eqeq", - ">=": "ge", - ">": "gt", - - "=": "eq", - - "+=": "plusequal", - "-=": "minusequal", - "/=": "divequal", - "*=": "starequal", - "%=": "percentequal", - - "&=": "andequal", - "|=": "orequal", - "^=": "xorequal", - - ">>=": "lsrequal", - ">>>=": "asrequal", - "<<=": "lslequal", - - "::": "coloncolon", - - "->": "rightarrow", - "<-": "leftarrow", - "<->": "swaparrow", - - "//": "linecomment", - "/*": "openblockcomment", - "*/": "closeblockcomment", - "macro_rules": "macro_rules", - "=>": "eg", - "..": "dotdot", - ",": "comma" -} - -lines = [] - -for line in collections["gram"]: - line2 = "" - for word in line.split(): - # replace strings with keyword-names or symbol-names from table - if word.startswith("\""): - word = word[1:-1] - if word in symnames: - word = symnames[word] - else: - for ch in word: - if not ch.isalpha(): - raise Exception("non-alpha apparent keyword: " - + word) - if word not in tokens: - if (word in collections["keyword"] or - word in collections["reserved"]): - tokens.append(word) - else: - raise Exception("unknown keyword/reserved word: " - + word) - - line2 += " " + word - lines.append(line2) - - -for word in collections["keyword"] + collections["reserved"]: - if word not in tokens: - tokens.append(word) - -for sym in collections["unop"] + collections["binop"] + symnames.keys(): - word = symnames[sym] - if word not in tokens: - tokens.append(word) - - -print("%start parser, token;") -print("%%token %s ;" % ("\n\t, ".join(tokens))) -for coll in ["keyword", "reserved"]: - print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll]))) -for coll in ["binop", "unop"]: - print("%s: %s ; " % (coll, "\n\t| ".join([symnames[x] - for x in collections[coll]]))) -print("\n".join(lines)) From 51463c3b17749801e80513d297351ede0f683418 Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Sun, 3 May 2015 23:47:10 -0500 Subject: [PATCH 08/16] Improve std::vec module documentation. This changes the std::vec module docs to use full sentences. It also adds an example for indexing vectors. --- src/libcollections/vec.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 33de6b7973672..ecb07582932cd 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -15,13 +15,13 @@ //! //! # Examples //! -//! Explicitly creating a `Vec` with `new()`: +//! You can explicitly create a `Vec` with `new()`: //! //! ``` //! let xs: Vec = Vec::new(); //! ``` //! -//! Using the `vec!` macro: +//! ...or by using the `vec!` macro: //! //! ``` //! let ys: Vec = vec![]; @@ -29,7 +29,7 @@ //! let zs = vec![1i32, 2, 3, 4, 5]; //! ``` //! -//! Push: +//! You can `push` values onto the end of a vector (which will grow the vector as needed): //! //! ``` //! let mut xs = vec![1i32, 2]; @@ -37,13 +37,21 @@ //! xs.push(3); //! ``` //! -//! And pop: +//! Popping values works in much the same way: //! //! ``` //! let mut xs = vec![1i32, 2]; //! //! let two = xs.pop(); //! ``` +//! +//! Vectors also support indexing (through the `Index` and `IndexMut` traits): +//! +//! ``` +//! let mut xs = vec![1i32, 2, 3]; +//! let three = xs[2]; +//! xs[1] = xs[1] + 5; +//! ``` #![stable(feature = "rust1", since = "1.0.0")] From c62c908f083ae5cc1fa914bba9837db054995450 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 4 May 2015 10:21:39 +0200 Subject: [PATCH 09/16] Correct pretty-printing of `type Foo where T: Bound = ...;` Fix #25031 --- src/libsyntax/print/pprust.rs | 2 +- src/test/pretty/issue-25031.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/test/pretty/issue-25031.rs diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 87c164f7550f9..5c1f6cc12f59e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -903,10 +903,10 @@ impl<'a> State<'a> { try!(self.print_generics(params)); try!(self.end()); // end the inner ibox + try!(self.print_where_clause(¶ms.where_clause)); try!(space(&mut self.s)); try!(self.word_space("=")); try!(self.print_type(&**ty)); - try!(self.print_where_clause(¶ms.where_clause)); try!(word(&mut self.s, ";")); try!(self.end()); // end the outer ibox } diff --git a/src/test/pretty/issue-25031.rs b/src/test/pretty/issue-25031.rs new file mode 100644 index 0000000000000..6c5a847869e4c --- /dev/null +++ b/src/test/pretty/issue-25031.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// Testing that type items with where clauses output correctly. + +// pp-exact + +fn main() { + type Foo where T: Copy = Box; +} From 86de427b2556d0f349ed0d31d0529ff9f241b9c9 Mon Sep 17 00:00:00 2001 From: Lee Jeffery Date: Mon, 4 May 2015 17:53:08 +0100 Subject: [PATCH 10/16] Fix incorrect link in Option documentation. --- src/libcore/option.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/option.rs b/src/libcore/option.rs index d1bc24bd9baa5..8da28094be3ae 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -161,7 +161,7 @@ use slice; // `Iterator` is an enumeration with one type parameter and two variants, // which basically means it must be `Option`. -/// The `Option` type. See [the module level documentation](../index.html) for more. +/// The `Option` type. See [the module level documentation](index.html) for more. #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] #[stable(feature = "rust1", since = "1.0.0")] pub enum Option { From 464069a4bfff2e94cb91c6cc5f0da40bba086bc4 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Mon, 4 May 2015 13:21:27 -0400 Subject: [PATCH 11/16] Fix spelling errors in documentation. --- src/libcollections/str.rs | 4 ++-- src/libcollections/string.rs | 2 +- src/libcore/str/mod.rs | 2 +- src/librustc/middle/infer/higher_ranked/mod.rs | 2 +- src/librustc/middle/ty.rs | 2 +- src/libstd/macros.rs | 2 +- src/libstd/path.rs | 2 +- src/libsyntax/ast.rs | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index db9f526a0f22e..38431ab5bf1b0 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -713,7 +713,7 @@ impl str { /// is skipped if empty. /// /// This method can be used for string data that is _terminated_, - /// rather than _seperated_ by a pattern. + /// rather than _separated_ by a pattern. /// /// # Iterator behavior /// @@ -760,7 +760,7 @@ impl str { /// skipped if empty. /// /// This method can be used for string data that is _terminated_, - /// rather than _seperated_ by a pattern. + /// rather than _separated_ by a pattern. /// /// # Iterator behavior /// diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index ad5ed1c89cdd9..3c668f7fe9bc6 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -757,7 +757,7 @@ impl FromUtf8Error { #[stable(feature = "rust1", since = "1.0.0")] pub fn into_bytes(self) -> Vec { self.bytes } - /// Accesss the underlying UTF8-error that was the cause of this error. + /// Access the underlying UTF8-error that was the cause of this error. #[stable(feature = "rust1", since = "1.0.0")] pub fn utf8_error(&self) -> Utf8Error { self.error } } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 6b65d74625614..c9bbcba31e9de 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -421,7 +421,7 @@ macro_rules! derive_pattern_clone { /// wrapping an private internal one that makes use of the `Pattern` API. /// /// For all patterns `P: Pattern<'a>` the following items will be -/// generated (generics ommitted): +/// generated (generics omitted): /// /// struct $forward_iterator($internal_iterator); /// struct $reverse_iterator($internal_iterator); diff --git a/src/librustc/middle/infer/higher_ranked/mod.rs b/src/librustc/middle/infer/higher_ranked/mod.rs index f347d28b93c2b..b0940aa7ec0ac 100644 --- a/src/librustc/middle/infer/higher_ranked/mod.rs +++ b/src/librustc/middle/infer/higher_ranked/mod.rs @@ -461,7 +461,7 @@ impl<'a,'tcx> InferCtxtExt for InferCtxt<'a,'tcx> { /// Constructs and returns a substitution that, for a given type /// scheme parameterized by `generics`, will replace every generic -/// parmeter in the type with a skolemized type/region (which one can +/// parameter in the type with a skolemized type/region (which one can /// think of as a "fresh constant", except at the type/region level of /// reasoning). /// diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 94071ff91903c..c80dba6d1fb31 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1908,7 +1908,7 @@ pub enum Predicate<'tcx> { } impl<'tcx> Predicate<'tcx> { - /// Performs a substituion suitable for going from a + /// Performs a substitution suitable for going from a /// poly-trait-ref to supertraits that must hold if that /// poly-trait-ref holds. This is slightly different from a normal /// substitution in terms of what happens with bound regions. See diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index fcebe9c5e98d6..362296cd1339d 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -434,7 +434,7 @@ pub mod builtin { /// Parse the current given file as an expression. /// - /// This is generally a bad idea, because it's going to behave unhygenically. + /// This is generally a bad idea, because it's going to behave unhygienically. /// /// # Examples /// diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 2ceb60cc3aa9f..8ccc387c90277 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -358,7 +358,7 @@ pub fn is_separator(c: char) -> bool { c.is_ascii() && is_sep_byte(c as u8) } -/// The primary sperator for the current platform +/// The primary separator for the current platform #[stable(feature = "rust1", since = "1.0.0")] pub const MAIN_SEPARATOR: char = platform::MAIN_SEP; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 3b7bfb1043a35..e00cb82649b7b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -595,7 +595,7 @@ pub enum Pat_ { /// An associated const named using the qualified path `::CONST` or /// `::CONST`. Associated consts from inherent impls can be - /// refered to as simply `T::CONST`, in which case they will end up as + /// referred to as simply `T::CONST`, in which case they will end up as /// PatEnum, and the resolver will have to sort that out. PatQPath(QSelf, Path), From 9b1dd4b35a081ca064d46a9bf799210863661b34 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 3 May 2015 12:28:48 -0700 Subject: [PATCH 12/16] std: Fix {atime,mtime,ctime}_nsec accessors These all had a typo where they were accessing the seconds field, not the nanoseconds field. --- src/libstd/sys/unix/ext/fs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 2e4ed38e50fe7..39910f509f9c2 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -138,11 +138,11 @@ impl Metadata { pub fn rdev(&self) -> raw::dev_t { self.0.raw().st_rdev as raw::dev_t } pub fn size(&self) -> raw::off_t { self.0.raw().st_size as raw::off_t } pub fn atime(&self) -> raw::time_t { self.0.raw().st_atime } - pub fn atime_nsec(&self) -> c_long { self.0.raw().st_atime } + pub fn atime_nsec(&self) -> c_long { self.0.raw().st_atime_nsec as c_long } pub fn mtime(&self) -> raw::time_t { self.0.raw().st_mtime } - pub fn mtime_nsec(&self) -> c_long { self.0.raw().st_mtime } + pub fn mtime_nsec(&self) -> c_long { self.0.raw().st_mtime_nsec as c_long } pub fn ctime(&self) -> raw::time_t { self.0.raw().st_ctime } - pub fn ctime_nsec(&self) -> c_long { self.0.raw().st_ctime } + pub fn ctime_nsec(&self) -> c_long { self.0.raw().st_ctime_nsec as c_long } pub fn blksize(&self) -> raw::blksize_t { self.0.raw().st_blksize as raw::blksize_t From 2de6515de8cf3298a9f17f0c520c491f56b017b7 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 30 Apr 2015 16:17:42 -0700 Subject: [PATCH 13/16] doc: rustup.sh doesn't require sudo --- src/doc/trpl/installing-rust.md | 12 +++++------- src/doc/trpl/nightly-rust.md | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/doc/trpl/installing-rust.md b/src/doc/trpl/installing-rust.md index 58d9e57dc51cc..b8230f060e073 100644 --- a/src/doc/trpl/installing-rust.md +++ b/src/doc/trpl/installing-rust.md @@ -6,16 +6,16 @@ or a Mac, all you need to do is this (note that you don't need to type in the `$`s, they just indicate the start of each command): ```bash -$ curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh +$ curl -sf -L https://static.rust-lang.org/rustup.sh | sh ``` If you're concerned about the [potential insecurity][insecurity] of using `curl -| sudo sh`, please keep reading and see our disclaimer below. And feel free to +| sh`, please keep reading and see our disclaimer below. And feel free to use a two-step version of the installation and examine our installation script: ```bash $ curl -f -L https://static.rust-lang.org/rustup.sh -O -$ sudo sh rustup.sh +$ sh rustup.sh ``` [insecurity]: http://curlpipesh.tumblr.com @@ -40,13 +40,11 @@ If you used the Windows installer, just re-run the `.msi` and it will give you an uninstall option. Some people, and somewhat rightfully so, get very upset when we tell you to -`curl | sudo sh`. Basically, when you do this, you are trusting that the good +`curl | sh`. Basically, when you do this, you are trusting that the good people who maintain Rust aren't going to hack your computer and do bad things. That's a good instinct! If you're one of those people, please check out the documentation on [building Rust from Source][from source], or [the official -binary downloads][install page]. And we promise that this method will not be -the way to install Rust forever: it's just the easiest way to keep people -updated while Rust is in its alpha state. +binary downloads][install page]. [from source]: https://github.com/rust-lang/rust#building-from-source [install page]: http://www.rust-lang.org/install.html diff --git a/src/doc/trpl/nightly-rust.md b/src/doc/trpl/nightly-rust.md index 1cb62e8b2d3e9..2f3055deb04e0 100644 --- a/src/doc/trpl/nightly-rust.md +++ b/src/doc/trpl/nightly-rust.md @@ -9,16 +9,16 @@ process, see ‘[Stability as a deliverable][stability]’. To install nightly Rust, you can use `rustup.sh`: ```bash -$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly +$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly ``` If you're concerned about the [potential insecurity][insecurity] of using `curl -| sudo sh`, please keep reading and see our disclaimer below. And feel free to +| sh`, please keep reading and see our disclaimer below. And feel free to use a two-step version of the installation and examine our installation script: ```bash $ curl -f -L https://static.rust-lang.org/rustup.sh -O -$ sudo sh rustup.sh --channel=nightly +$ sh rustup.sh --channel=nightly ``` [insecurity]: http://curlpipesh.tumblr.com @@ -43,13 +43,11 @@ If you used the Windows installer, just re-run the `.msi` and it will give you an uninstall option. Some people, and somewhat rightfully so, get very upset when we tell you to -`curl | sudo sh`. Basically, when you do this, you are trusting that the good +`curl | sh`. Basically, when you do this, you are trusting that the good people who maintain Rust aren't going to hack your computer and do bad things. That's a good instinct! If you're one of those people, please check out the documentation on [building Rust from Source][from source], or [the official -binary downloads][install page]. And we promise that this method will not be -the way to install Rust forever: it's just the easiest way to keep people -updated while Rust is in its alpha state. +binary downloads][install page]. [from source]: https://github.com/rust-lang/rust#building-from-source [install page]: http://www.rust-lang.org/install.html From 93055587a2927b0c32b2d4e71fa64b3cee97926c Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 4 May 2015 23:05:24 +0200 Subject: [PATCH 14/16] doc: fix markup --- src/libstd/net/ip.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index bd0408b21d229..c23259770caef 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -142,7 +142,8 @@ impl Ipv4Addr { /// Returns true if this address is in a range designated for documentation. /// - /// This is defined in RFC 5737 + /// This is defined in RFC 5737: + /// /// - 192.0.2.0/24 (TEST-NET-1) /// - 198.51.100.0/24 (TEST-NET-2) /// - 203.0.113.0/24 (TEST-NET-3) From b630cd74dc1ab65840397ba2a7d1c8009c1ef721 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 4 May 2015 17:37:03 -0400 Subject: [PATCH 15/16] Strings and vectors are not built-in types. strs messy but string is something else... --- src/doc/complement-lang-faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/complement-lang-faq.md b/src/doc/complement-lang-faq.md index fa4e0304d1a0f..92e2fd93df406 100644 --- a/src/doc/complement-lang-faq.md +++ b/src/doc/complement-lang-faq.md @@ -109,7 +109,7 @@ This does mean that indexed access to a Unicode codepoint inside a `str` value i * Most "character oriented" operations on text only work under very restricted language assumptions sets such as "ASCII-range codepoints only". Outside ASCII-range, you tend to have to use a complex (non-constant-time) algorithm for determining linguistic-unit (glyph, word, paragraph) boundaries anyways. We recommend using an "honest" linguistically-aware, Unicode-approved algorithm. * The `char` type is UCS4. If you honestly need to do a codepoint-at-a-time algorithm, it's trivial to write a `type wstr = [char]`, and unpack a `str` into it in a single pass, then work with the `wstr`. In other words: the fact that the language is not "decoding to UCS4 by default" shouldn't stop you from decoding (or re-encoding any other way) if you need to work with that encoding. -## Why are strings, vectors etc. built-in types rather than (say) special kinds of trait/impl? +## Why are `str`s, slices, arrays etc. built-in types rather than (say) special kinds of trait/impl? In each case there is one or more operator, literal constructor, overloaded use or integration with a built-in control structure that makes us think it would be awkward to phrase the type in terms of more-general type constructors. Same as, say, with numbers! But this is partly an aesthetic call, and we'd be willing to look at a worked-out proposal for eliminating or rephrasing these special cases. From 2c04696978e5db737c1b491b171fbcfa2ac921c6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 4 May 2015 16:25:02 -0700 Subject: [PATCH 16/16] doc: Cargo documentation doesn't have https Right now it's all hosted over GitHub pages so https doesn't work, so only link to the http version. --- src/doc/trpl/hello-cargo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index d547451fccec2..cc8747d1fa7c1 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -5,7 +5,7 @@ projects. Cargo is currently in a pre-1.0 state, and so it is still a work in progress. However, it is already good enough to use for many Rust projects, and so it is assumed that Rust projects will use Cargo from the beginning. -[cratesio]: https://doc.crates.io +[cratesio]: http://doc.crates.io Cargo manages three things: building your code, downloading the dependencies your code needs, and building those dependencies. At first, your