Auto merge of #25111 - Manishearth:rollup, r=Manishearth
r? @Manishearth
This commit is contained in:
commit
31e3cb7c4e
22 changed files with 81 additions and 212 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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))
|
||||
|
|
@ -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
|
||||
///
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ impl FromUtf8Error {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn into_bytes(self) -> Vec<u8> { 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 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@
|
|||
//!
|
||||
//! # Examples
|
||||
//!
|
||||
//! Explicitly creating a `Vec<T>` with `new()`:
|
||||
//! You can explicitly create a `Vec<T>` with `new()`:
|
||||
//!
|
||||
//! ```
|
||||
//! let xs: Vec<i32> = Vec::new();
|
||||
//! ```
|
||||
//!
|
||||
//! Using the `vec!` macro:
|
||||
//! ...or by using the `vec!` macro:
|
||||
//!
|
||||
//! ```
|
||||
//! let ys: Vec<i32> = 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")]
|
||||
|
||||
|
|
|
|||
|
|
@ -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<T> {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
///
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -250,26 +251,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 +301,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);
|
||||
/// }
|
||||
/// ```
|
||||
|
|
|
|||
|
|
@ -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(PartialEq, Eq, Hash)]`. If you implement these yourself,
|
||||
/// it is important that the following property holds:
|
||||
///
|
||||
/// ```text
|
||||
/// k1 == k2 -> hash(k1) == hash(k2)
|
||||
|
|
@ -64,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);
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -98,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);
|
||||
/// }
|
||||
/// ```
|
||||
|
|
|
|||
|
|
@ -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
|
||||
///
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ pub enum Pat_ {
|
|||
|
||||
/// An associated const named using the qualified path `<T>::CONST` or
|
||||
/// `<T as Trait>::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),
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
17
src/test/pretty/issue-25031.rs
Normal file
17
src/test/pretty/issue-25031.rs
Normal file
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<T> where T: Copy = Box<T>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue