From 2dee07b12a2dd08a281a84146dc7085299389add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 20 Jan 2018 02:36:39 -0800 Subject: [PATCH] Remove cast suggestions --- src/libcore/ops/arith.rs | 72 ------------ .../multiple-impls-complex-filtering.rs | 61 ---------- .../multiple-impls-complex-filtering.stderr | 107 ------------------ 3 files changed, 240 deletions(-) delete mode 100644 src/test/ui/on-unimplemented/multiple-impls-complex-filtering.rs delete mode 100644 src/test/ui/on-unimplemented/multiple-impls-complex-filtering.stderr diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index 47617b22dd34..d0d0c09869e9 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -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", diff --git a/src/test/ui/on-unimplemented/multiple-impls-complex-filtering.rs b/src/test/ui/on-unimplemented/multiple-impls-complex-filtering.rs deleted file mode 100644 index b48b08daa196..000000000000 --- a/src/test/ui/on-unimplemented/multiple-impls-complex-filtering.rs +++ /dev/null @@ -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 or the MIT license -// , 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); -struct Bar(T); - -#[rustc_on_unimplemented( - on(_Self="[i32]", label="trait label if i32"), - label="trait label", - message="trait message", -)] -trait Index { - type Output: ?Sized; - fn index(&self, index: Idx) -> &Self::Output; -} - -#[rustc_on_unimplemented( - label="impl foo {Self} {Idx} {Index}", -)] -impl Index> for [i32] { - type Output = i32; - fn index(&self, _index: Foo) -> &i32 { - loop {} - } -} - -#[rustc_on_unimplemented = "on impl for Bar"] -impl Index> for [i32] { - type Output = i32; - fn index(&self, _index: Bar) -> &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 -} diff --git a/src/test/ui/on-unimplemented/multiple-impls-complex-filtering.stderr b/src/test/ui/on-unimplemented/multiple-impls-complex-filtering.stderr deleted file mode 100644 index c4bac12eebdb..000000000000 --- a/src/test/ui/on-unimplemented/multiple-impls-complex-filtering.stderr +++ /dev/null @@ -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` 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` 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` 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` 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>` is not satisfied - --> $DIR/multiple-impls-complex-filtering.rs:55:5 - | -55 | Index::index(&[] as &[i32], Foo(2u32)); - | ^^^^^^^^^^^^ impl foo [i32] Foo Index - | - = help: the trait `Index>` 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>` is not satisfied - --> $DIR/multiple-impls-complex-filtering.rs:55:5 - | -55 | Index::index(&[] as &[i32], Foo(2u32)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl foo [i32] Foo Index - | - = help: the trait `Index>` is not implemented for `[i32]` - -error[E0277]: the trait bound `[i32]: Index>` 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>` 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>` 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>` is not implemented for `[i32]` - -error: aborting due to 10 previous errors -