Skip to content

Commit d36dc39

Browse files
committed
---
yaml --- r: 209979 b: refs/heads/try c: 188f3eb h: refs/heads/master i: 209977: e325732 209975: 0d4293a v: v3
1 parent f122703 commit d36dc39

File tree

10 files changed

+62
-38
lines changed

10 files changed

+62
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: cf650a217495940bdf3f8a843f5dd959b6e37b5e
5+
refs/heads/try: 188f3eb8f54d6224cec6a14c1c70372e02550a15
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/trpl/hello-cargo.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ $ mkdir src
3232
$ mv main.rs src/main.rs
3333
```
3434

35+
Note that since we're creating an executable, we used `main.rs`. If we
36+
want to make a library instead, we should use `lib.rs`.
37+
Custom file locations for the entry point can be specified
38+
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
39+
40+
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
41+
3542
Cargo expects your source files to live inside a `src` directory. That leaves
3643
the top level for other things, like READMEs, license information, and anything
3744
not related to your code. Cargo helps us keep our projects nice and tidy. A

branches/try/src/libcollections/string.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,12 +951,13 @@ impl<'a> Deref for DerefString<'a> {
951951
/// # #![feature(collections)]
952952
/// use std::string::as_string;
953953
///
954-
/// fn string_consumer(s: String) {
955-
/// assert_eq!(s, "foo".to_string());
954+
/// // Let's pretend we have a function that requires `&String`
955+
/// fn string_consumer(s: &String) {
956+
/// assert_eq!(s, "foo");
956957
/// }
957958
///
958-
/// let string = as_string("foo").clone();
959-
/// string_consumer(string);
959+
/// // Provide a `&String` from a `&str` without allocating
960+
/// string_consumer(&as_string("foo"));
960961
/// ```
961962
#[unstable(feature = "collections")]
962963
pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {

branches/try/src/libcollections/vec.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,22 @@ impl<'a, T> Drop for DerefVec<'a, T> {
19151915
}
19161916

19171917
/// Converts a slice to a wrapper type providing a `&Vec<T>` reference.
1918+
///
1919+
/// # Examples
1920+
///
1921+
/// ```
1922+
/// # #![feature(collections)]
1923+
/// use std::vec::as_vec;
1924+
///
1925+
/// // Let's pretend we have a function that requires `&Vec<i32>`
1926+
/// fn vec_consumer(s: &Vec<i32>) {
1927+
/// assert_eq!(s, &[1, 2, 3]);
1928+
/// }
1929+
///
1930+
/// // Provide a `&Vec<i32>` from a `&[i32]` without allocating
1931+
/// let values = [1, 2, 3];
1932+
/// vec_consumer(&as_vec(&values));
1933+
/// ```
19181934
#[unstable(feature = "collections")]
19191935
pub fn as_vec<'a, T>(x: &'a [T]) -> DerefVec<'a, T> {
19201936
unsafe {

branches/try/src/libcore/convert.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ pub trait Into<T>: Sized {
8383
/// `String` implements `From<&str>`:
8484
///
8585
/// ```
86-
/// let s = "hello";
8786
/// let string = "hello".to_string();
88-
///
89-
/// let other_string: String = From::from(s);
87+
/// let other_string = String::from("hello");
9088
///
9189
/// assert_eq!(string, other_string);
9290
/// ```

branches/try/src/librustdoc/html/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> {
14601460
try!(write!(fmt, "<span class='out-of-band'>"));
14611461
try!(write!(fmt,
14621462
r##"<span id='render-detail'>
1463-
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
1463+
<a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</a>
14641464
</span>"##));
14651465

14661466
// Write `src` tag

branches/try/src/librustdoc/html/static/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ a {
392392
text-decoration: underline;
393393
}
394394

395-
.content span.trait, .content a.trait, .block a.current.trait { color: #ed9603; }
395+
.content span.trait, .content a.trait, .block a.current.trait { color: #8866ff; }
396396
.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; }
397397
.content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; }
398398
.content span.struct, .content a.struct, .block a.current.struct { color: #e53700; }

branches/try/src/librustdoc/html/static/main.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -808,20 +808,20 @@
808808

809809
$("#toggle-all-docs").on("click", function() {
810810
var toggle = $("#toggle-all-docs");
811-
if (toggle.html() == "[-]") {
812-
toggle.html("[+]");
811+
if (toggle.html() == "[&minus;]") {
812+
toggle.html("[&plus;]");
813813
toggle.attr("title", "expand all docs");
814814
$(".docblock").hide();
815815
$(".toggle-label").show();
816816
$(".toggle-wrapper").addClass("collapsed");
817-
$(".collapse-toggle").children(".inner").html("+");
817+
$(".collapse-toggle").children(".inner").html("&plus;");
818818
} else {
819-
toggle.html("[-]");
819+
toggle.html("[&minus;]");
820820
toggle.attr("title", "collapse all docs");
821821
$(".docblock").show();
822822
$(".toggle-label").hide();
823823
$(".toggle-wrapper").removeClass("collapsed");
824-
$(".collapse-toggle").children(".inner").html("-");
824+
$(".collapse-toggle").children(".inner").html("&minus;");
825825
}
826826
});
827827

@@ -835,20 +835,20 @@
835835
if (relatedDoc.is(":visible")) {
836836
relatedDoc.slideUp({duration:'fast', easing:'linear'});
837837
toggle.parent(".toggle-wrapper").addClass("collapsed");
838-
toggle.children(".inner").html("+");
838+
toggle.children(".inner").html("&plus;");
839839
toggle.children(".toggle-label").fadeIn();
840840
} else {
841841
relatedDoc.slideDown({duration:'fast', easing:'linear'});
842842
toggle.parent(".toggle-wrapper").removeClass("collapsed");
843-
toggle.children(".inner").html("-");
843+
toggle.children(".inner").html("&minus;");
844844
toggle.children(".toggle-label").hide();
845845
}
846846
}
847847
});
848848

849849
$(function() {
850850
var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'})
851-
.html("[<span class='inner'>-</span>]");
851+
.html("[<span class='inner'>&minus;</span>]");
852852

853853
$(".method").each(function() {
854854
if ($(this).next().is(".docblock") ||

branches/try/src/libstd/sys/windows/process2.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ fn zeroed_process_information() -> libc::types::os::arch::extra::PROCESS_INFORMA
367367

368368
// Produces a wide string *without terminating null*
369369
fn make_command_line(prog: &OsStr, args: &[OsString]) -> Vec<u16> {
370+
// Encode the command and arguments in a command line string such
371+
// that the spawned process may recover them using CommandLineToArgvW.
370372
let mut cmd: Vec<u16> = Vec::new();
371373
append_arg(&mut cmd, prog);
372374
for arg in args {
@@ -387,30 +389,27 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> Vec<u16> {
387389
}
388390

389391
let mut iter = arg.encode_wide();
392+
let mut backslashes: usize = 0;
390393
while let Some(x) = iter.next() {
391-
if x == '"' as u16 {
392-
// escape quotes
393-
cmd.push('\\' as u16);
394-
cmd.push('"' as u16);
395-
} else if x == '\\' as u16 {
396-
// is this a run of backslashes followed by a " ?
397-
if iter.clone().skip_while(|y| *y == '\\' as u16).next() == Some('"' as u16) {
398-
// Double it ... NOTE: this behavior is being
399-
// preserved as it's been part of Rust for a long
400-
// time, but no one seems to know exactly why this
401-
// is the right thing to do.
402-
cmd.push('\\' as u16);
403-
cmd.push('\\' as u16);
404-
} else {
405-
// Push it through unescaped
406-
cmd.push('\\' as u16);
407-
}
394+
if x == '\\' as u16 {
395+
backslashes += 1;
408396
} else {
409-
cmd.push(x)
397+
if x == '"' as u16 {
398+
// Add n+1 backslashes to total 2n+1 before internal '"'.
399+
for _ in 0..(backslashes+1) {
400+
cmd.push('\\' as u16);
401+
}
402+
}
403+
backslashes = 0;
410404
}
405+
cmd.push(x);
411406
}
412407

413408
if quote {
409+
// Add n backslashes to total 2n before ending '"'.
410+
for _ in 0..backslashes {
411+
cmd.push('\\' as u16);
412+
}
414413
cmd.push('"' as u16);
415414
}
416415
}
@@ -486,6 +485,10 @@ mod tests {
486485
test_wrapper("echo", &["a b c"]),
487486
"echo \"a b c\""
488487
);
488+
assert_eq!(
489+
test_wrapper("echo", &["\" \\\" \\", "\\"]),
490+
"echo \"\\\" \\\\\\\" \\\\\" \\"
491+
);
489492
assert_eq!(
490493
test_wrapper("\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}", &[]),
491494
"\u{03c0}\u{042f}\u{97f3}\u{00e6}\u{221e}"

branches/try/src/libstd/thread/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@
115115
//! ## Configuring threads
116116
//!
117117
//! A new thread can be configured before it is spawned via the `Builder` type,
118-
//! which currently allows you to set the name, stack size, and writers for
119-
//! `println!` and `panic!` for the child thread:
118+
//! which currently allows you to set the name and stack size for the child thread:
120119
//!
121120
//! ```rust
122121
//! # #![allow(unused_must_use)]

0 commit comments

Comments
 (0)