diff options
Diffstat (limited to 'src/test/ui/on-unimplemented')
5 files changed, 40 insertions, 6 deletions
diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.rs b/src/test/ui/on-unimplemented/expected-comma-found-token.rs new file mode 100644 index 00000000000..f7a632dfaa1 --- /dev/null +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.rs @@ -0,0 +1,24 @@ +// Copyright 2018 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. + +// Tests that two closures cannot simultaneously have mutable +// access to the variable, whether that mutable access be used +// for direct assignment or for taking mutable ref. Issue #6801. + +#![feature(on_unimplemented)] + +#[rustc_on_unimplemented( + message="the message" + label="the label" +)] +trait T {} +//~^^^ ERROR expected one of `)` or `,`, found `label` + +fn main() { } diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr new file mode 100644 index 00000000000..9a564bb872e --- /dev/null +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -0,0 +1,10 @@ +error: expected one of `)` or `,`, found `label` + --> $DIR/expected-comma-found-token.rs:19:5 + | +LL | message="the message" + | - expected one of `)` or `,` here +LL | label="the label" + | ^^^^^ unexpected token + +error: aborting due to previous error + diff --git a/src/test/ui/on-unimplemented/multiple-impls.rs b/src/test/ui/on-unimplemented/multiple-impls.rs index 539f5d63c0b..4467ac4356b 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.rs +++ b/src/test/ui/on-unimplemented/multiple-impls.rs @@ -11,7 +11,7 @@ // Test if the on_unimplemented message override works #![feature(on_unimplemented)] -#![feature(rustc_attrs)] + struct Foo<T>(T); struct Bar<T>(T); @@ -38,7 +38,7 @@ impl Index<Bar<usize>> for [i32] { } } -#[rustc_error] + fn main() { Index::index(&[] as &[i32], 2u32); //~^ ERROR E0277 diff --git a/src/test/ui/on-unimplemented/on-impl.rs b/src/test/ui/on-unimplemented/on-impl.rs index da56ae64993..d104d1ed033 100644 --- a/src/test/ui/on-unimplemented/on-impl.rs +++ b/src/test/ui/on-unimplemented/on-impl.rs @@ -11,7 +11,7 @@ // Test if the on_unimplemented message override works #![feature(on_unimplemented)] -#![feature(rustc_attrs)] + #[rustc_on_unimplemented = "invalid"] trait Index<Idx: ?Sized> { @@ -27,7 +27,7 @@ impl Index<usize> for [i32] { } } -#[rustc_error] + fn main() { Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32); //~^ ERROR E0277 diff --git a/src/test/ui/on-unimplemented/slice-index.rs b/src/test/ui/on-unimplemented/slice-index.rs index 7d67e89a78e..79bb277d2c1 100644 --- a/src/test/ui/on-unimplemented/slice-index.rs +++ b/src/test/ui/on-unimplemented/slice-index.rs @@ -11,11 +11,11 @@ // Test new Index error message for slices // ignore-tidy-linelength -#![feature(rustc_attrs)] + use std::ops::Index; -#[rustc_error] + fn main() { let x = &[1, 2, 3] as &[i32]; x[1i32]; //~ ERROR E0277 |
