forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rollup merge of rust-lang#19780: jakub-/e-needstest
Closes rust-lang#5988. Closes rust-lang#10176. Closes rust-lang#10456. Closes rust-lang#12744. Closes rust-lang#13264. Closes rust-lang#13324. Closes rust-lang#14182. Closes rust-lang#15381. Closes rust-lang#15444. Closes rust-lang#15480. Closes rust-lang#15756. Closes rust-lang#16822. Closes rust-lang#16966. Closes rust-lang#17351. Closes rust-lang#17503. Closes rust-lang#17545. Closes rust-lang#17771. Closes rust-lang#17816. Closes rust-lang#17897. Closes rust-lang#17905. Closes rust-lang#18188. Closes rust-lang#18232. Closes rust-lang#18345. Closes rust-lang#18389. Closes rust-lang#18400. Closes rust-lang#18502. Closes rust-lang#18611. Closes rust-lang#18783. Closes rust-lang#19009. Closes rust-lang#19081. Closes rust-lang#19098. Closes rust-lang#19127. Closes rust-lang#19135.
- Loading branch information
Showing
35 changed files
with
923 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2014 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. | ||
|
||
#![crate_type="lib"] | ||
|
||
use std::cell::RefCell; | ||
|
||
pub struct Window<Data>{ | ||
pub data: RefCell<Data> | ||
} | ||
|
||
impl<Data: Update> Window<Data> { | ||
pub fn update(&self, e: i32) { | ||
match e { | ||
1 => self.data.borrow_mut().update(), | ||
_ => {} | ||
} | ||
} | ||
} | ||
|
||
pub trait Update { | ||
fn update(&mut self); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2014 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. | ||
|
||
#![crate_type="lib"] | ||
|
||
struct Foo; | ||
// This is the ICE trigger | ||
struct Formatter; | ||
|
||
trait Show { | ||
fn fmt(&self); | ||
} | ||
|
||
impl Show for Foo { | ||
fn fmt(&self) {} | ||
} | ||
|
||
fn bar<T>(f: extern "Rust" fn(&T), t: &T) { } | ||
|
||
// ICE requirement: this has to be marked as inline | ||
#[inline] | ||
pub fn baz() { | ||
bar(Show::fmt, &Foo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 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. | ||
|
||
fn f() -> int { | ||
(return 1, return 2) | ||
//~^ ERROR mismatched types: expected `int`, found `(_, _)` (expected int, found tuple) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2014 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. | ||
|
||
struct Foo { | ||
f: for <'b> |&'b int|: | ||
'b -> &'b int //~ ERROR use of undeclared lifetime name `'b` | ||
} | ||
|
||
fn main() { | ||
let mut x: Vec< for <'a> || | ||
:'a //~ ERROR use of undeclared lifetime name `'a` | ||
> = Vec::new(); | ||
x.push(|| {}); | ||
|
||
let foo = Foo { | ||
f: |x| x | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2014 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. | ||
|
||
fn main() { | ||
let values: Vec<u8> = vec![1,2,3,4,5,6,7,8]; | ||
|
||
for | ||
[x,y,z] | ||
//~^ ERROR refutable pattern in `for` loop binding: `[]` not covered | ||
in values.as_slice().chunks(3).filter(|&xs| xs.len() == 3) { | ||
println!("y={}", y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2014 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. | ||
|
||
fn main() { | ||
let v = vec![ | ||
&3i | ||
//~^ ERROR borrowed value does not live long enough | ||
]; | ||
|
||
for &&x in v.iter() { | ||
println!("{}", x + 3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2014 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. | ||
|
||
use std::slice::Chunks; | ||
use std::slice::MutChunks; | ||
|
||
fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: MutChunks<'a,T>) | ||
{ | ||
for | ||
&something | ||
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[T]` | ||
in arg2 | ||
{ | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2014 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. | ||
|
||
fn main() { | ||
panic!( | ||
1.2 //~ ERROR cannot determine a type for this expression | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2014 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. | ||
|
||
#![feature(unboxed_closures)] | ||
|
||
pub fn foo<'a, F: Fn<(&'a (),), ()>>(bar: F) { | ||
bar.call(( | ||
&(), //~ ERROR borrowed value does not live long enough | ||
)); | ||
} | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2014 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. | ||
|
||
#[deriving(Show)] | ||
struct Pair<T, V> (T, V); | ||
|
||
impl Pair< | ||
&str, //~ ERROR missing lifetime specifier | ||
int | ||
> { | ||
fn say(self: &Pair<&str, int>) { | ||
//~^ ERROR mismatched types: expected `Pair<&'static str, int>`, found `Pair<&str, int>` | ||
println!("{}", self); | ||
} | ||
} | ||
|
||
fn main() { | ||
let result = &Pair("shane", 1i); | ||
result.say(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2014 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. | ||
|
||
type Step<'s, R, T> = |R, T|: 's -> R; | ||
type Transducer<'t, R, T, U> = |Step<'t, R, U>|: 't -> Step<'t, R, T>; | ||
|
||
fn mapping<'f, R, T, U>(f: |T|: 'f -> U) -> &'f Transducer<'f, R, T, U> { | ||
|step| |r, x| | ||
step(r, f(x)) //~ ERROR the type of this value must be known in this context | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2014 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. | ||
|
||
#![feature(unboxed_closures)] | ||
#![feature(associated_types)] | ||
|
||
use std::any::Any; | ||
use std::intrinsics::TypeId; | ||
|
||
pub trait Pt {} | ||
pub trait Rt {} | ||
|
||
trait Private<P: Pt, R: Rt> { | ||
fn call(&self, p: P, r: R); | ||
} | ||
pub trait Public: Private< | ||
<Self as Public>::P, | ||
//~^ ERROR illegal recursive type; insert an enum or struct in the cycle, if this is desired | ||
<Self as Public>::R | ||
> { | ||
type P; | ||
type R; | ||
|
||
fn call_inner(&self); | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2014 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. | ||
|
||
trait Set<T> { | ||
fn contains(&self, T) -> bool; | ||
fn set(&mut self, T); | ||
} | ||
|
||
impl<'a, T, S> Set<&'a [T]> for S where | ||
T: Copy, | ||
S: Set<T>, | ||
{ | ||
fn contains(&self, bits: &[T]) -> bool { | ||
bits.iter().all(|&bit| self.contains(bit)) | ||
} | ||
|
||
fn set(&mut self, bits: &[T]) { | ||
for &bit in bits.iter() { | ||
self.set(bit) | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
let bits: &[_] = &[0, 1]; | ||
|
||
0.contains(bits); | ||
//~^ ERROR the trait `Set<_>` is not implemented for the type `_` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2014 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. | ||
|
||
#![feature(associated_types)] | ||
|
||
fn add_state(op: | ||
<int as HasState>::State | ||
//~^ ERROR it is currently unsupported to access associated types except through a type parameter | ||
) {} | ||
|
||
trait HasState { | ||
type State; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2014 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. | ||
|
||
use std::cell::RefCell; | ||
|
||
fn main() { | ||
let c = RefCell::new(vec![]); | ||
let mut y = 1u; | ||
c.push(|| y = 0); | ||
c.push(|| y = 0); | ||
//~^ ERROR cannot borrow `y` as mutable more than once at a time | ||
} | ||
|
||
fn ufcs() { | ||
let c = RefCell::new(vec![]); | ||
let mut y = 1u; | ||
|
||
Push::push(&c, || y = 0); | ||
Push::push(&c, || y = 0); | ||
} | ||
|
||
trait Push<'c> { | ||
fn push<'f: 'c>(&self, push: ||:'f -> ()); | ||
} | ||
|
||
impl<'c> Push<'c> for RefCell<Vec<||:'c>> { | ||
fn push<'f: 'c>(&self, fun: ||:'f -> ()) { | ||
self.borrow_mut().push(fun) | ||
} | ||
} |
Oops, something went wrong.
c59b9b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+ p=1
c59b9b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors: retry