Remove cast suggestions

This commit is contained in:
Esteban Küber 2018-01-20 02:36:39 -08:00
parent 621e61bff9
commit 2dee07b12a
3 changed files with 0 additions and 240 deletions

View file

@ -1,61 +0,0 @@
// Copyright 2016 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.
// Test if the on_unimplemented message override works
#![feature(on_unimplemented)]
#![feature(rustc_attrs)]
struct Foo<T>(T);
struct Bar<T>(T);
#[rustc_on_unimplemented(
on(_Self="[i32]", label="trait label if i32"),
label="trait label",
message="trait message",
)]
trait Index<Idx: ?Sized> {
type Output: ?Sized;
fn index(&self, index: Idx) -> &Self::Output;
}
#[rustc_on_unimplemented(
label="impl foo {Self} {Idx} {Index}",
)]
impl Index<Foo<usize>> for [i32] {
type Output = i32;
fn index(&self, _index: Foo<usize>) -> &i32 {
loop {}
}
}
#[rustc_on_unimplemented = "on impl for Bar"]
impl Index<Bar<usize>> for [i32] {
type Output = i32;
fn index(&self, _index: Bar<usize>) -> &i32 {
loop {}
}
}
#[rustc_error]
fn main() {
Index::index(&[] as &[i32], 2usize);
Index::index(&[] as &[i32], 2u32);
Index::index(&[] as &[u32], 2u32);
//~^ ERROR E0277
//~| ERROR E0277
Index::index(&[] as &[i32], Foo(2usize));
Index::index(&[] as &[i32], Foo(2u32));
//~^ ERROR E0277
//~| ERROR E0277
Index::index(&[] as &[i32], Bar(2u32));
//~^ ERROR E0277
//~| ERROR E0277
}

View file

@ -1,107 +0,0 @@
error[E0277]: trait message
--> $DIR/multiple-impls-complex-filtering.rs:49:5
|
49 | Index::index(&[] as &[i32], 2usize);
| ^^^^^^^^^^^^ trait label if i32
|
= help: the trait `Index<usize>` is not implemented for `[i32]`
note: required by `Index::index`
--> $DIR/multiple-impls-complex-filtering.rs:26:5
|
26 | fn index(&self, index: Idx) -> &Self::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: trait message
--> $DIR/multiple-impls-complex-filtering.rs:49:5
|
49 | Index::index(&[] as &[i32], 2usize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait label if i32
|
= help: the trait `Index<usize>` is not implemented for `[i32]`
error[E0277]: trait message
--> $DIR/multiple-impls-complex-filtering.rs:50:5
|
50 | Index::index(&[] as &[i32], 2u32);
| ^^^^^^^^^^^^ trait label if i32
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
note: required by `Index::index`
--> $DIR/multiple-impls-complex-filtering.rs:26:5
|
26 | fn index(&self, index: Idx) -> &Self::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: trait message
--> $DIR/multiple-impls-complex-filtering.rs:50:5
|
50 | Index::index(&[] as &[i32], 2u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait label if i32
|
= help: the trait `Index<u32>` is not implemented for `[i32]`
error[E0277]: trait message
--> $DIR/multiple-impls-complex-filtering.rs:51:5
|
51 | Index::index(&[] as &[u32], 2u32);
| ^^^^^^^^^^^^ trait label
|
= help: the trait `Index<_>` is not implemented for `[u32]`
note: required by `Index::index`
--> $DIR/multiple-impls-complex-filtering.rs:26:5
|
26 | fn index(&self, index: Idx) -> &Self::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: trait message
--> $DIR/multiple-impls-complex-filtering.rs:51:5
|
51 | Index::index(&[] as &[u32], 2u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait label
|
= help: the trait `Index<_>` is not implemented for `[u32]`
error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
--> $DIR/multiple-impls-complex-filtering.rs:55:5
|
55 | Index::index(&[] as &[i32], Foo(2u32));
| ^^^^^^^^^^^^ impl foo [i32] Foo<u32> Index
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
note: required by `Index::index`
--> $DIR/multiple-impls-complex-filtering.rs:26:5
|
26 | fn index(&self, index: Idx) -> &Self::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `[i32]: Index<Foo<u32>>` is not satisfied
--> $DIR/multiple-impls-complex-filtering.rs:55:5
|
55 | Index::index(&[] as &[i32], Foo(2u32));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl foo [i32] Foo<u32> Index
|
= help: the trait `Index<Foo<u32>>` is not implemented for `[i32]`
error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
--> $DIR/multiple-impls-complex-filtering.rs:58:5
|
58 | Index::index(&[] as &[i32], Bar(2u32));
| ^^^^^^^^^^^^ on impl for Bar
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
note: required by `Index::index`
--> $DIR/multiple-impls-complex-filtering.rs:26:5
|
26 | fn index(&self, index: Idx) -> &Self::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `[i32]: Index<Bar<u32>>` is not satisfied
--> $DIR/multiple-impls-complex-filtering.rs:58:5
|
58 | Index::index(&[] as &[i32], Bar(2u32));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar
|
= help: the trait `Index<Bar<u32>>` is not implemented for `[i32]`
error: aborting due to 10 previous errors