Skip to content

Commit 41a7910

Browse files
committed
auto merge of #18099 : jakub-/rust/fixed-issues, r=alexcrichton
Closes #9249. Closes #13105. Closes #13837. Closes #13847. Closes #15207. Closes #15261. Closes #16048. Closes #16098. Closes #16256. Closes #16562. Closes #16596. Closes #16709. Closes #16747. Closes #17025. Closes #17121. Closes #17450. Closes #17636.
2 parents c7c342d + 64716d5 commit 41a7910

22 files changed

+357
-18
lines changed

src/libsyntax/ext/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ impl<'a> ExtCtxt<'a> {
557557
self.recursion_count += 1;
558558
if self.recursion_count > self.ecfg.recursion_limit {
559559
self.span_fatal(ei.call_site,
560-
format!("Recursion limit reached while expanding the macro `{}`",
560+
format!("recursion limit reached while expanding the macro `{}`",
561561
ei.callee.name).as_slice());
562562
}
563563

src/test/compile-fail/infinite-macro-expansion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
macro_rules! recursive(
1414
() => (
15-
recursive!() //~ ERROR Recursion limit reached while expanding the macro `recursive`
15+
recursive!() //~ ERROR recursion limit reached while expanding the macro `recursive`
1616
)
1717
)
1818

src/test/compile-fail/issue-13847.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
return.is_failure
13+
//~^ ERROR attempted access of field `is_failure` on type `!`, but no field with that name was found
14+
}

src/test/compile-fail/issue-15207.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
loop { break.push(1); } //~ ERROR type `!` does not implement any method in scope named `push`
13+
}

src/test/compile-fail/issue-16048.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
trait NoLifetime {
12+
fn get<'p, T : Test<'p>>(&self) -> T;
13+
}
14+
15+
trait Test<'p> {
16+
fn new(buf: &'p mut [u8]) -> Self;
17+
}
18+
19+
struct Foo<'a> {
20+
buf: &'a mut [u8],
21+
}
22+
23+
impl<'a> Test<'a> for Foo<'a> {
24+
fn new(buf: &'a mut [u8]) -> Foo<'a> {
25+
Foo { buf: buf }
26+
}
27+
}
28+
29+
impl<'a> NoLifetime for Foo<'a> {
30+
fn get<'p, T : Test<'a>>(&self) -> T {
31+
//~^ ERROR lifetime parameters or bounds on method `get` do not match the trait declaration
32+
return *self as T; //~ ERROR non-scalar cast: `Foo<'a>` as `T`
33+
}
34+
}
35+
36+
fn main() {}

src/test/compile-fail/issue-16098.rs

+28
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+
#![feature(macro_rules)]
12+
13+
macro_rules! prob1 {
14+
(0) => {
15+
0
16+
};
17+
($n:expr) => {
18+
if ($n % 3 == 0) || ($n % 5 == 0) {
19+
$n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1`
20+
} else {
21+
prob1!($n - 1);
22+
}
23+
};
24+
}
25+
26+
fn main() {
27+
println!("Problem 1: {}", prob1!(1000));
28+
}

src/test/compile-fail/issue-16562.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
trait MatrixShape {}
12+
13+
struct Col<D, C> {
14+
data: D,
15+
col: C,
16+
}
17+
18+
impl<T, M: MatrixShape> Collection for Col<M, uint> {
19+
//~^ ERROR unable to infer enough type information to locate the impl of the trait
20+
//~^^ NOTE the trait `core::kinds::Sized` must be implemented because it is required by
21+
fn len(&self) -> uint {
22+
unimplemented!()
23+
}
24+
}
25+
26+
fn main() {}

src/test/compile-fail/issue-16709.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
use std::ptr;
12+
use std::raw;
13+
14+
fn main() {
15+
unsafe {
16+
let nil: *const u8 = ptr::null();
17+
let slice: raw::Slice<u8> =
18+
Slice { //~ ERROR use of trait `Slice` as a struct constructor [E0159]
19+
data: nil,
20+
len: 0,
21+
};
22+
}
23+
}

src/test/compile-fail/issue-16747.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
trait ListItem<'a> {
12+
fn list_name() -> &'a str;
13+
}
14+
15+
struct List<'a, T: ListItem<'a>> {
16+
//~^ ERROR the parameter type `T` may not live long enough; consider adding an explicit lifetime bo
17+
//~^^ NOTE ...so that the reference type `&'a [T]` does not outlive the data it points at
18+
slice: &'a [T]
19+
}
20+
21+
impl<'a, T: ListItem<'a>> Collection for List<'a, T> {
22+
fn len(&self) -> uint {
23+
0
24+
}
25+
}
26+
27+
fn main() {}

src/test/compile-fail/issue-17025.rs

+20
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+
enum A {
12+
B(char),
13+
C([Box<A>]),
14+
}
15+
16+
fn c(c:char) -> A {
17+
B(c) //~ ERROR cannot move a value of type A: the size of A cannot be statically determined
18+
}
19+
20+
pub fn main() {}

src/test/compile-fail/issue-17450.rs

+19
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+
#![allow(dead_code)]
12+
13+
static mut x: int = 3;
14+
static mut y: int = unsafe {
15+
x
16+
//~^ ERROR cannot refer to other statics by value, use the address-of operator or a constant instea
17+
};
18+
19+
fn main() {}

src/test/compile-fail/issue-17636.rs

+19
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+
trait MyItem<T> {}
12+
impl<T> MyItem<T> for T {}
13+
14+
pub fn build_archive<'a, I: MyItem<&'a (|&uint|:'a)>>(files: I) {}
15+
16+
fn main() {
17+
build_archive(&(|_| { }));
18+
//~^ ERROR unable to infer enough type information to locate the impl of the trait `MyItem<&|&uint|
19+
}

src/test/compile-fail/non-constant-expr-for-fixed-len-vec.rs

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-test
12-
//
13-
// Ignored because of an ICE at the moment.
14-
1511
// Check that non-constant exprs do fail as count in fixed length vec type
1612

1713
fn main() {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-test #12920
11+
trait Foo {
12+
fn quux(u8) {}
13+
}
1214

13-
pub fn main() { if 1 == 1 { return; } println!("Paul is dead"); }
15+
fn main() {}

src/test/run-pass/issue-13837.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
static TEST_VALUE : *const [int, ..2] = 0x1234 as *const [int, ..2];
12+
13+
fn main() {}

src/test/run-pass/issue-15261.rs

+15
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+
static mut n_mut: uint = 0;
12+
13+
static n: &'static uint = unsafe{ &n_mut };
14+
15+
fn main() {}

src/test/run-pass/issue-16256.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 buf = Vec::new();
13+
|c: u8| buf.push(c);
14+
}

src/test/run-pass/issue-16596.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
trait MatrixRow {}
12+
13+
struct Mat;
14+
15+
impl<'a> MatrixRow for &'a Mat {}
16+
17+
struct Rows<M: MatrixRow> {
18+
mat: M,
19+
}
20+
21+
impl<'a> Iterator<()> for Rows<&'a Mat> {
22+
fn next(&mut self) -> Option<()> {
23+
unimplemented!()
24+
}
25+
}
26+
27+
fn main() {}

src/test/run-pass/issue-17121.rs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
use std::io::BufReader;
12+
use std::io::BufferedReader;
13+
use std::io::File;
14+
use std::io::IoResult;
15+
16+
struct Lexer<R: Reader>
17+
{
18+
reader: BufferedReader<R>,
19+
}
20+
21+
impl<R: Reader> Lexer<R>
22+
{
23+
pub fn new_from_reader(r: R) -> Lexer<R>
24+
{
25+
Lexer{reader: BufferedReader::new(r)}
26+
}
27+
28+
pub fn new_from_file(p: Path) -> IoResult<Lexer<File>>
29+
{
30+
Ok(Lexer::new_from_reader(try!(File::open(&p))))
31+
}
32+
33+
pub fn new_from_str<'a>(s: &'a str) -> Lexer<BufReader<'a>>
34+
{
35+
Lexer::new_from_reader(BufReader::new(s.as_bytes()))
36+
}
37+
}
38+
39+
fn main() {}

0 commit comments

Comments
 (0)