Rollup merge of #28681 - arielb1:destructor-fixes, r=eddyb

Fixes #28568 

r? @eddyb
This commit is contained in:
Manish Goregaokar 2015-09-27 15:05:17 +05:30
commit 7e6e64b12d
36 changed files with 172 additions and 84 deletions

View file

@ -32,5 +32,4 @@ fn ice<A>(a: A) {
let r = loop {};
r = r + a;
//~^ ERROR not implemented
//~| ERROR not implemented
}

View file

@ -39,7 +39,6 @@ pub fn f1_int_uint() {
pub fn f1_uint_uint() {
f1(2u32, 4u32);
//~^ ERROR the trait `Foo` is not implemented
//~| ERROR the trait `Foo` is not implemented
}
pub fn f1_uint_int() {

View file

@ -11,5 +11,4 @@
fn main() {
let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
//~^ ERROR E0277
//~| ERROR E0277
}

View file

@ -23,7 +23,6 @@ const A_I8_T
: [u32; (i8::MAX as i8 + 1u8) as usize]
//~^ ERROR mismatched types
//~| the trait `core::ops::Add<u8>` is not implemented for the type `i8`
//~| the trait `core::ops::Add<u8>` is not implemented for the type `i8`
= [0; (i8::MAX as usize) + 1];
fn main() {
@ -33,4 +32,3 @@ fn main() {
fn foo<T:fmt::Debug>(x: T) {
println!("{:?}", x);
}

View file

@ -20,10 +20,8 @@ fn main() {
apply(&3, takes_imm);
apply(&3, takes_mut);
//~^ ERROR (values differ in mutability)
//~| ERROR (values differ in mutability)
apply(&mut 3, takes_mut);
apply(&mut 3, takes_imm);
//~^ ERROR (values differ in mutability)
//~| ERROR (values differ in mutability)
}

View file

@ -25,9 +25,6 @@ pub fn main() {
y: 2,
};
for x in bogus { //~ ERROR `core::iter::Iterator` is not implemented for the type `MyStruct`
//~^ ERROR
//~^^ ERROR
// FIXME(#21528) not fulfilled obligation error should be reported once, not thrice
drop(x);
}
}

View file

@ -14,7 +14,6 @@
fn main() {
fn bar<T>(_: T) {}
[0][0u8]; //~ ERROR: the trait `core::ops::Index<u8>` is not implemented
//~^ ERROR: the trait `core::ops::Index<u8>` is not implemented
[0][0]; // should infer to be a usize

View file

@ -14,21 +14,13 @@ pub fn main() {
v[3_usize];
v[3];
v[3u8]; //~ERROR the trait `core::ops::Index<u8>` is not implemented
//~^ ERROR the trait `core::ops::Index<u8>` is not implemented
v[3i8]; //~ERROR the trait `core::ops::Index<i8>` is not implemented
//~^ ERROR the trait `core::ops::Index<i8>` is not implemented
v[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented
//~^ ERROR the trait `core::ops::Index<u32>` is not implemented
v[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented
//~^ ERROR the trait `core::ops::Index<i32>` is not implemented
s.as_bytes()[3_usize];
s.as_bytes()[3];
s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index<u8>` is not implemented
//~^ ERROR the trait `core::ops::Index<u8>` is not implemented
s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index<i8>` is not implemented
//~^ ERROR the trait `core::ops::Index<i8>` is not implemented
s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented
//~^ ERROR the trait `core::ops::Index<u32>` is not implemented
s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented
//~^ ERROR the trait `core::ops::Index<i32>` is not implemented
}

View file

@ -12,12 +12,10 @@ fn main() {
let x = ();
1 +
x //~^ ERROR E0277
//~| ERROR E0277
;
let x: () = ();
1 +
x //~^ ERROR E0277
//~| ERROR E0277
;
}

View file

@ -18,5 +18,4 @@ fn main() {
});
2_usize + (loop {});
//~^ ERROR E0277
//~| ERROR E0277
}

View file

@ -14,5 +14,4 @@
fn main() {
in () { 0 };
//~^ ERROR: the trait `core::ops::Placer<_>` is not implemented
//~| ERROR: the trait `core::ops::Placer<_>` is not implemented
}

View file

@ -11,9 +11,6 @@
fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
for item in *things { *item = 0 }
//~^ ERROR the trait `core::marker::Sized` is not implemented for the type `core::iter::Iterator
//~^^ ERROR
//~^^^ ERROR
// FIXME(#21528) error should be reported once, not thrice
}
fn main() {}

View file

@ -0,0 +1,23 @@
// 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.
trait Array: Sized {}
fn f<T: Array>(x: &T) {
let _ = x
//~^ ERROR `Array` cannot be made into an object
//~| NOTE the trait cannot require that `Self : Sized`
as
&Array;
//~^ ERROR `Array` cannot be made into an object
//~| NOTE the trait cannot require that `Self : Sized`
}
fn main() {}

View file

@ -17,7 +17,6 @@ impl<A> vec_monad<A> for Vec<A> {
let mut r = panic!();
for elt in self { r = r + f(*elt); }
//~^ ERROR E0277
//~| ERROR E0277
}
}
fn main() {

View file

@ -23,7 +23,5 @@ impl<RHS: Scalar> Add <RHS> for Bob {
fn main() {
let b = Bob + 3.5;
b + 3 //~ ERROR: is not implemented
//~^ ERROR: is not implemented
//~^^ ERROR: is not implemented
//~^^^ ERROR: mismatched types
//~^ ERROR: mismatched types
}

View file

@ -11,5 +11,4 @@
fn main() {
1.0f64 - 1.0;
1.0f64 - 1 //~ ERROR: is not implemented
//~^ ERROR: is not implemented
}

View file

@ -0,0 +1,35 @@
// 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.
fn main() {
let _ = Iterator::next(&mut ());
//~^ ERROR the trait `core::iter::Iterator` is not implemented
for _ in false {}
//~^ ERROR the trait `core::iter::Iterator` is not implemented
let _ = Iterator::next(&mut ());
//~^ ERROR the trait `core::iter::Iterator` is not implemented
other()
}
pub fn other() {
// check errors are still reported globally
let _ = Iterator::next(&mut ());
//~^ ERROR the trait `core::iter::Iterator` is not implemented
let _ = Iterator::next(&mut ());
//~^ ERROR the trait `core::iter::Iterator` is not implemented
for _ in false {}
//~^ ERROR the trait `core::iter::Iterator` is not implemented
}

View file

@ -0,0 +1,23 @@
// 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.
struct MyStruct;
impl Drop for MyStruct {
//~^ ERROR conflicting implementations for trait
fn drop(&mut self) { }
}
impl Drop for MyStruct {
//~^ NOTE conflicting implementation here
fn drop(&mut self) { }
}
fn main() {}

View file

@ -18,15 +18,12 @@ struct Panolpy {
fn foo(p: &Panolpy) {
22 >> p.char;
//~^ ERROR E0277
//~| ERROR E0277
22 >> p.str;
//~^ ERROR E0277
//~| ERROR E0277
22 >> p;
//~^ ERROR E0277
//~| ERROR E0277
let x;
22 >> x; // ambiguity error winds up being suppressed

View file

@ -11,5 +11,4 @@
pub fn main() {
let s: &str = "hello";
let c: u8 = s[4]; //~ ERROR the trait `core::ops::Index<_>` is not implemented
//~^ ERROR the trait `core::ops::Index<_>` is not implemented
}

View file

@ -17,7 +17,6 @@ fn mutate(s: &mut str) {
s[1usize] = bot();
//~^ ERROR `core::ops::Index<usize>` is not implemented for the type `str`
//~| ERROR `core::ops::IndexMut<usize>` is not implemented for the type `str`
//~| ERROR `core::ops::Index<usize>` is not implemented for the type `str`
}
pub fn main() {}

View file

@ -35,7 +35,6 @@ fn b() {
fn c() {
let z = call_it_once(square, 22);
//~^ ERROR not implemented
//~| ERROR not implemented
}
fn main() { }

View file

@ -35,7 +35,6 @@ fn b() {
fn c() {
let z = call_it_once(square, 22);
//~^ ERROR not implemented
//~| ERROR not implemented
}
fn main() { }

View file

@ -36,7 +36,6 @@ fn b() {
fn c() {
let z = call_it_once(square, 22);
//~^ ERROR not implemented
//~| ERROR not implemented
}
fn main() { }