Skip to content

Commit db74a33

Browse files
committed
---
yaml --- r: 102402 b: refs/heads/master c: 13e10f5 h: refs/heads/master v: v3
1 parent 982b9bd commit db74a33

20 files changed

+346
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: bd47f679faffaeedd0c046d814d11dc9d2755ee1
2+
refs/heads/master: 13e10f5b7e6fef35770cb6f835492893d43c2e07
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff

trunk/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3167,7 +3167,7 @@ Now compile and run like this (adjust to your platform if necessary):
31673167
Notice that the library produced contains the version in the file name
31683168
as well as an inscrutable string of alphanumerics. As explained in the previous paragraph,
31693169
these are both part of Rust's library versioning scheme. The alphanumerics are
3170-
a hash representing the crate's id.
3170+
a hash representing the crates id.
31713171

31723172
## The standard library and the prelude
31733173

trunk/src/librustc/back/link.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use util::common::time;
2626
use util::ppaux;
2727
use util::sha2::{Digest, Sha256};
2828

29-
use std::c_str::{ToCStr, CString};
29+
use std::c_str::ToCStr;
3030
use std::char;
3131
use std::os::consts::{macos, freebsd, linux, android, win32};
3232
use std::ptr;
@@ -61,9 +61,7 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
6161
if cstr == ptr::null() {
6262
sess.fatal(msg);
6363
} else {
64-
let err = CString::new(cstr, false);
65-
let err = str::from_utf8_lossy(err.as_bytes());
66-
sess.fatal(msg + ": " + err.as_slice());
64+
sess.fatal(msg + ": " + str::raw::from_c_str(cstr));
6765
}
6866
}
6967
}

trunk/src/librustdoc/html/markdown.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use std::vec;
3838
use collections::HashMap;
3939

4040
use html::highlight;
41+
use html::escape::Escape;
4142

4243
/// A unit struct which has the `fmt::Show` trait implemented. When
4344
/// formatted, this struct will emit the HTML corresponding to the rendered
@@ -197,7 +198,7 @@ pub fn render(w: &mut io::Writer, s: &str) -> fmt::Result {
197198

198199
// Render the HTML
199200
let text = format!(r#"<h{lvl} id="{id}">{}</h{lvl}>"#,
200-
s, lvl = level, id = id);
201+
Escape(s.as_slice()), lvl = level, id = id);
201202
text.with_c_str(|p| unsafe { bufputs(ob, p) });
202203
}
203204

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[unsafe_no_drop_flag]
12+
pub struct ZeroLengthThingWithDestructor;
13+
impl Drop for ZeroLengthThingWithDestructor {
14+
fn drop(&mut self) {}
15+
}
16+
impl ZeroLengthThingWithDestructor {
17+
pub fn new() -> ZeroLengthThingWithDestructor {
18+
ZeroLengthThingWithDestructor
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct Closed01<F>(F);
12+
13+
pub trait Bar { fn new() -> Self; }
14+
15+
impl<T: Bar> Bar for Closed01<T> {
16+
fn new() -> Closed01<T> { Closed01(Bar::new()) }
17+
}
18+
impl Bar for f32 { fn new() -> f32 { 1.0 } }
19+
20+
pub fn random<T: Bar>() -> T { Bar::new() }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct A<'a>(&'a int);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct V2<T>(T, T);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let mut a = "a";
13+
a += { "b" };
14+
//~^ ERROR: binary assignment operation `+=` cannot be applied
15+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo {
12+
x: int
13+
}
14+
15+
impl Drop for Foo {
16+
fn drop(&mut self) {
17+
println!("drop {}", self.x);
18+
}
19+
}
20+
21+
fn main() {
22+
let mut ptr = ~Foo { x: 0 };
23+
let test = |foo: &Foo| {
24+
println!("access {}", foo.x);
25+
ptr = ~Foo { x: ptr.x + 1 };
26+
println!("access {}", foo.x);
27+
};
28+
test(ptr);
29+
//~^ ERROR: cannot borrow `*ptr` as immutable
30+
}
31+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::vec_ng::Vec;
12+
13+
fn main() {
14+
let mut v = vec!(1);
15+
let f = || v.push(2);
16+
let _w = v; //~ ERROR: cannot move out of `v`
17+
18+
f();
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let r = {
13+
let x = ~42;
14+
let f = proc() &x; //~ ERROR: borrowed value does not live long enough
15+
f()
16+
};
17+
18+
drop(r);
19+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo<T> {
12+
x: T,
13+
}
14+
impl<T> Foo<T> {
15+
fn add(&mut self, v: Foo<T>){
16+
self.x += v.x;
17+
//~^ ERROR: binary assignment operation `+=` cannot be applied
18+
}
19+
}
20+
fn main() {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[feature(managed_boxes)];
12+
13+
struct BarStruct;
14+
15+
impl<'a> BarStruct {
16+
fn foo(&'a mut self) -> @BarStruct { self }
17+
//~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct
18+
}
19+
20+
fn main() {}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-10028.rs
12+
// ignore-fast
13+
14+
extern crate issue10028 = "issue-10028";
15+
16+
use issue10028::ZeroLengthThingWithDestructor;
17+
18+
struct Foo {
19+
zero_length_thing: ZeroLengthThingWithDestructor
20+
}
21+
22+
fn make_foo() -> Foo {
23+
Foo { zero_length_thing: ZeroLengthThingWithDestructor::new() }
24+
}
25+
26+
fn main() {
27+
let _f:Foo = make_foo();
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
enum StdioContainer {
12+
CreatePipe(bool)
13+
}
14+
15+
struct Test<'a> {
16+
args: &'a [~str],
17+
io: &'a [StdioContainer]
18+
}
19+
20+
pub fn main() {
21+
let test = Test {
22+
args: &[],
23+
io: &[CreatePipe(true)]
24+
};
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-11508.rs
12+
// ignore-fast
13+
14+
extern crate rand = "issue-11508";
15+
16+
use rand::{Closed01, random};
17+
18+
fn main() {
19+
let Closed01(val) = random::<Closed01<f32>>();
20+
println!("{}", val);
21+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-11529.rs
12+
// ignore-fast
13+
14+
extern crate a = "issue-11529";
15+
16+
fn main() {
17+
let one = 1;
18+
let _a = a::A(&one);
19+
}

trunk/src/test/run-pass/issue-7899.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-fast
12+
// aux-build:issue-7899.rs
13+
14+
extern crate testcrate = "issue-7899";
15+
16+
fn main() {
17+
let f = testcrate::V2(1.0f32, 2.0f32);
18+
}

0 commit comments

Comments
 (0)