Remove cast suggestions
This commit is contained in:
parent
621e61bff9
commit
2dee07b12a
@ -76,78 +76,6 @@
|
||||
#[lang = "add"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
any(
|
||||
all(_Self="i128", RHS="i64"),
|
||||
all(_Self="i128", RHS="i32"),
|
||||
all(_Self="i128", RHS="i16"),
|
||||
all(_Self="i128", RHS="i8"),
|
||||
all(_Self="i64", RHS="i32"),
|
||||
all(_Self="i64", RHS="i16"),
|
||||
all(_Self="i64", RHS="i8"),
|
||||
all(_Self="i32", RHS="i16"),
|
||||
all(_Self="i32", RHS="i8"),
|
||||
all(_Self="i16", RHS="i8"),
|
||||
all(_Self="u128", RHS="u64"),
|
||||
all(_Self="u128", RHS="u32"),
|
||||
all(_Self="u128", RHS="u16"),
|
||||
all(_Self="u128", RHS="u8"),
|
||||
all(_Self="u64", RHS="u32"),
|
||||
all(_Self="u64", RHS="u16"),
|
||||
all(_Self="u64", RHS="u8"),
|
||||
all(_Self="u32", RHS="u16"),
|
||||
all(_Self="u32", RHS="u8"),
|
||||
all(_Self="u16", RHS="u8"),
|
||||
all(_Self="f64", RHS="i32"),
|
||||
all(_Self="f64", RHS="i16"),
|
||||
all(_Self="f64", RHS="i8"),
|
||||
all(_Self="f64", RHS="u32"),
|
||||
all(_Self="f64", RHS="u16"),
|
||||
all(_Self="f64", RHS="u8"),
|
||||
all(_Self="f32", RHS="i16"),
|
||||
all(_Self="f32", RHS="i8"),
|
||||
all(_Self="f32", RHS="u16"),
|
||||
all(_Self="f32", RHS="u8"),
|
||||
),
|
||||
label="no implementation for `{Self} + {RHS}`, but you can safely cast \
|
||||
`{RHS}` into `{Self}` using `as {Self}`",
|
||||
),
|
||||
on(
|
||||
any(
|
||||
all(RHS="i128", _Self="i64"),
|
||||
all(RHS="i128", _Self="i32"),
|
||||
all(RHS="i128", _Self="i16"),
|
||||
all(RHS="i128", _Self="i8"),
|
||||
all(RHS="i64", _Self="i32"),
|
||||
all(RHS="i64", _Self="i16"),
|
||||
all(RHS="i64", _Self="i8"),
|
||||
all(RHS="i32", _Self="i16"),
|
||||
all(RHS="i32", _Self="i8"),
|
||||
all(RHS="i16", _Self="i8"),
|
||||
all(RHS="u128", _Self="u64"),
|
||||
all(RHS="u128", _Self="u32"),
|
||||
all(RHS="u128", _Self="u16"),
|
||||
all(RHS="u128", _Self="u8"),
|
||||
all(RHS="u64", _Self="u32"),
|
||||
all(RHS="u64", _Self="u16"),
|
||||
all(RHS="u64", _Self="u8"),
|
||||
all(RHS="u32", _Self="u16"),
|
||||
all(RHS="u32", _Self="u8"),
|
||||
all(RHS="u16", _Self="u8"),
|
||||
all(RHS="f64", _Self="i32"),
|
||||
all(RHS="f64", _Self="i16"),
|
||||
all(RHS="f64", _Self="i8"),
|
||||
all(RHS="f64", _Self="u32"),
|
||||
all(RHS="f64", _Self="u16"),
|
||||
all(RHS="f64", _Self="u8"),
|
||||
all(RHS="f32", _Self="i16"),
|
||||
all(RHS="f32", _Self="i8"),
|
||||
all(RHS="f32", _Self="u16"),
|
||||
all(RHS="f32", _Self="u8"),
|
||||
),
|
||||
label="no implementation for `{Self} + {RHS}`, but you can safely cast \
|
||||
`{Self}` into `{RHS}` using `as {RHS}`",
|
||||
),
|
||||
on(
|
||||
all(_Self="{integer}", RHS="{float}"),
|
||||
message="cannot add a float to an integer",
|
||||
|
@ -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
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user