diff --git a/tests/ui/array-slice-vec/closure-in-array-len.rs b/tests/ui/array-slice-vec/closure-in-array-len.rs new file mode 100644 index 0000000000000..ce13e0f160815 --- /dev/null +++ b/tests/ui/array-slice-vec/closure-in-array-len.rs @@ -0,0 +1,6 @@ +//! regression test for +struct Foo( + fn([u8; |x: u8| {}]), //~ ERROR mismatched types +); + +fn main() {} diff --git a/tests/ui/issues/issue-50600.stderr b/tests/ui/array-slice-vec/closure-in-array-len.stderr similarity index 70% rename from tests/ui/issues/issue-50600.stderr rename to tests/ui/array-slice-vec/closure-in-array-len.stderr index e3ae7f144c35b..decdde042c6f7 100644 --- a/tests/ui/issues/issue-50600.stderr +++ b/tests/ui/array-slice-vec/closure-in-array-len.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-50600.rs:2:13 + --> $DIR/closure-in-array-len.rs:3:13 | LL | fn([u8; |x: u8| {}]), | ^^^^^^^^^^ expected `usize`, found closure | = note: expected type `usize` - found closure `{closure@$DIR/issue-50600.rs:2:13: 2:20}` + found closure `{closure@$DIR/closure-in-array-len.rs:3:13: 3:20}` error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51714.rs b/tests/ui/array-slice-vec/return-in-array-len.rs similarity index 91% rename from tests/ui/issues/issue-51714.rs rename to tests/ui/array-slice-vec/return-in-array-len.rs index 03b50b7963ea5..dea1bb2818bb2 100644 --- a/tests/ui/issues/issue-51714.rs +++ b/tests/ui/array-slice-vec/return-in-array-len.rs @@ -1,3 +1,4 @@ +//! regression test for fn main() { //~^ NOTE: not the enclosing function body //~| NOTE: not the enclosing function body diff --git a/tests/ui/issues/issue-51714.stderr b/tests/ui/array-slice-vec/return-in-array-len.stderr similarity index 87% rename from tests/ui/issues/issue-51714.stderr rename to tests/ui/array-slice-vec/return-in-array-len.stderr index da3e3caea29a3..974a748edc938 100644 --- a/tests/ui/issues/issue-51714.stderr +++ b/tests/ui/array-slice-vec/return-in-array-len.stderr @@ -1,5 +1,5 @@ error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:6:13 + --> $DIR/return-in-array-len.rs:7:13 | LL | / fn main() { ... | @@ -10,7 +10,7 @@ LL | | } | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:10:10 + --> $DIR/return-in-array-len.rs:11:10 | LL | / fn main() { ... | @@ -21,7 +21,7 @@ LL | | } | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:14:10 + --> $DIR/return-in-array-len.rs:15:10 | LL | / fn main() { ... | @@ -32,7 +32,7 @@ LL | | } | |_- ...not the enclosing function body error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:18:10 + --> $DIR/return-in-array-len.rs:19:10 | LL | / fn main() { ... | diff --git a/tests/ui/issues/issue-17503.rs b/tests/ui/array-slice-vec/slice-of-multi-ref.rs similarity index 75% rename from tests/ui/issues/issue-17503.rs rename to tests/ui/array-slice-vec/slice-of-multi-ref.rs index 6c966b5319cd9..b4917f594d832 100644 --- a/tests/ui/issues/issue-17503.rs +++ b/tests/ui/array-slice-vec/slice-of-multi-ref.rs @@ -1,3 +1,4 @@ +//! regression test for //@ run-pass fn main() { let s: &[isize] = &[0, 1, 2, 3, 4]; diff --git a/tests/ui/derives/derive-hygiene-struct-builder.rs b/tests/ui/derives/derive-hygiene-struct-builder.rs new file mode 100644 index 0000000000000..95245a3b3f5a1 --- /dev/null +++ b/tests/ui/derives/derive-hygiene-struct-builder.rs @@ -0,0 +1,10 @@ +//! regression test for +//! struct named "builder" conflicted with derive macro internals. +//@ run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +#[derive(Debug)] +struct builder; + +fn main() {} diff --git a/tests/ui/dst/unsized-str-mutability.rs b/tests/ui/dst/unsized-str-mutability.rs new file mode 100644 index 0000000000000..d84fa001fd679 --- /dev/null +++ b/tests/ui/dst/unsized-str-mutability.rs @@ -0,0 +1,8 @@ +//! regression test for +//! Test that HIR ty lowering doesn't forget about mutability of `&mut str`. +//@ run-pass + +fn main() { + fn foo(_: &mut T) {} + let _f: fn(&mut str) = foo; +} diff --git a/tests/ui/for-loop-while/break-outside-loop.rs b/tests/ui/for-loop-while/break-outside-loop.rs index 26769b30dd5f0..06c513aa8457b 100644 --- a/tests/ui/for-loop-while/break-outside-loop.rs +++ b/tests/ui/for-loop-while/break-outside-loop.rs @@ -1,25 +1,41 @@ struct Foo { - t: String + t: String, } -fn cond() -> bool { true } +fn cond() -> bool { + true +} -fn foo(_: F) where F: FnOnce() {} +fn foo(_: F) +where + F: FnOnce(), +{ +} fn main() { let pth = break; //~ ERROR: `break` outside of a loop - if cond() { continue } //~ ERROR: `continue` outside of a loop + if cond() { + continue; //~ ERROR: `continue` outside of a loop + } while cond() { - if cond() { break } - if cond() { continue } + if cond() { + break; + } + if cond() { + continue; + } foo(|| { - if cond() { break } //~ ERROR: `break` inside of a closure - if cond() { continue } //~ ERROR: `continue` inside of a closure + if cond() { + break; //~ ERROR: `break` inside of a closure + } + if cond() { + continue; //~ ERROR: `continue` inside of a closure + } }) } - let rs: Foo = Foo{t: pth}; + let rs: Foo = Foo { t: pth }; let unconstrained = break; //~ ERROR: `break` outside of a loop @@ -32,4 +48,10 @@ fn main() { //~| ERROR `break` inside of a closure }; } + + // Make sure that a continue span actually contains the keyword. (#28105) + continue //~ ERROR `continue` outside of a loop + ; + break //~ ERROR `break` outside of a loop + ; } diff --git a/tests/ui/for-loop-while/break-outside-loop.stderr b/tests/ui/for-loop-while/break-outside-loop.stderr index 9092f34df3549..7dbff2d412458 100644 --- a/tests/ui/for-loop-while/break-outside-loop.stderr +++ b/tests/ui/for-loop-while/break-outside-loop.stderr @@ -1,5 +1,5 @@ error[E0767]: use of unreachable label `'lab` - --> $DIR/break-outside-loop.rs:30:19 + --> $DIR/break-outside-loop.rs:46:19 | LL | 'lab: loop { | ---- unreachable label defined here @@ -10,49 +10,62 @@ LL | break 'lab; = note: labels are unreachable through functions, closures, async blocks and modules error[E0268]: `break` outside of a loop or labeled block - --> $DIR/break-outside-loop.rs:10:15 + --> $DIR/break-outside-loop.rs:16:15 | LL | let pth = break; | ^^^^^ cannot `break` outside of a loop or labeled block error[E0268]: `continue` outside of a loop - --> $DIR/break-outside-loop.rs:11:17 + --> $DIR/break-outside-loop.rs:18:9 | -LL | if cond() { continue } - | ^^^^^^^^ cannot `continue` outside of a loop +LL | continue; + | ^^^^^^^^ cannot `continue` outside of a loop error[E0267]: `break` inside of a closure - --> $DIR/break-outside-loop.rs:17:25 + --> $DIR/break-outside-loop.rs:30:17 | LL | foo(|| { | -- enclosing closure -LL | if cond() { break } - | ^^^^^ cannot `break` inside of a closure +LL | if cond() { +LL | break; + | ^^^^^ cannot `break` inside of a closure error[E0267]: `continue` inside of a closure - --> $DIR/break-outside-loop.rs:18:25 + --> $DIR/break-outside-loop.rs:33:17 | LL | foo(|| { | -- enclosing closure -LL | if cond() { break } -LL | if cond() { continue } - | ^^^^^^^^ cannot `continue` inside of a closure +... +LL | continue; + | ^^^^^^^^ cannot `continue` inside of a closure error[E0268]: `break` outside of a loop or labeled block - --> $DIR/break-outside-loop.rs:24:25 + --> $DIR/break-outside-loop.rs:40:25 | LL | let unconstrained = break; | ^^^^^ cannot `break` outside of a loop or labeled block error[E0267]: `break` inside of a closure - --> $DIR/break-outside-loop.rs:30:13 + --> $DIR/break-outside-loop.rs:46:13 | LL | || { | -- enclosing closure LL | break 'lab; | ^^^^^^^^^^ cannot `break` inside of a closure -error: aborting due to 7 previous errors +error[E0268]: `continue` outside of a loop + --> $DIR/break-outside-loop.rs:53:5 + | +LL | continue + | ^^^^^^^^ cannot `continue` outside of a loop + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-outside-loop.rs:55:5 + | +LL | break + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to 9 previous errors Some errors have detailed explanations: E0267, E0268, E0767. For more information about an error, try `rustc --explain E0267`. diff --git a/tests/ui/issues/issue-22706.rs b/tests/ui/generics/type-args-on-module-in-bound.rs similarity index 63% rename from tests/ui/issues/issue-22706.rs rename to tests/ui/generics/type-args-on-module-in-bound.rs index bb8a58d3d2ecc..96ca37407cfcb 100644 --- a/tests/ui/issues/issue-22706.rs +++ b/tests/ui/generics/type-args-on-module-in-bound.rs @@ -1,3 +1,4 @@ +//! regression test for fn is_copy::Copy>() {} //~^ ERROR type arguments are not allowed on module `marker` [E0109] fn main() {} diff --git a/tests/ui/issues/issue-22706.stderr b/tests/ui/generics/type-args-on-module-in-bound.stderr similarity index 88% rename from tests/ui/issues/issue-22706.stderr rename to tests/ui/generics/type-args-on-module-in-bound.stderr index 309e11a25f1ac..ac70ae63e90b4 100644 --- a/tests/ui/issues/issue-22706.stderr +++ b/tests/ui/generics/type-args-on-module-in-bound.stderr @@ -1,5 +1,5 @@ error[E0109]: type arguments are not allowed on module `marker` - --> $DIR/issue-22706.rs:1:29 + --> $DIR/type-args-on-module-in-bound.rs:2:29 | LL | fn is_copy::Copy>() {} | ------ ^^^ type argument not allowed diff --git a/tests/ui/issues/issue-16725.rs b/tests/ui/issues/issue-16725.rs deleted file mode 100644 index 7741f828c4740..0000000000000 --- a/tests/ui/issues/issue-16725.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ aux-build:issue-16725.rs - -extern crate issue_16725 as foo; - -fn main() { - unsafe { foo::bar(); } - //~^ ERROR: function `bar` is private -} diff --git a/tests/ui/issues/issue-17361.rs b/tests/ui/issues/issue-17361.rs deleted file mode 100644 index 6f6fc42db3835..0000000000000 --- a/tests/ui/issues/issue-17361.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass -// Test that HIR ty lowering doesn't forget about mutability of `&mut str`. - - -fn main() { - fn foo(_: &mut T) {} - let _f: fn(&mut str) = foo; -} diff --git a/tests/ui/issues/issue-22577.rs b/tests/ui/issues/issue-22577.rs deleted file mode 100644 index 0fa284cc7c0c2..0000000000000 --- a/tests/ui/issues/issue-22577.rs +++ /dev/null @@ -1,25 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -use std::{fs, net}; - -fn assert_both() {} -fn assert_send() {} - -fn main() { - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); -} diff --git a/tests/ui/issues/issue-28105.rs b/tests/ui/issues/issue-28105.rs deleted file mode 100644 index 1e8d2d6ccf132..0000000000000 --- a/tests/ui/issues/issue-28105.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Make sure that a continue span actually contains the keyword. - -fn main() { - continue //~ ERROR `continue` outside of a loop - ; - break //~ ERROR `break` outside of a loop - ; -} diff --git a/tests/ui/issues/issue-28105.stderr b/tests/ui/issues/issue-28105.stderr deleted file mode 100644 index f450256f3ecf5..0000000000000 --- a/tests/ui/issues/issue-28105.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0268]: `continue` outside of a loop - --> $DIR/issue-28105.rs:4:5 - | -LL | continue - | ^^^^^^^^ cannot `continue` outside of a loop - -error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-28105.rs:6:5 - | -LL | break - | ^^^^^ cannot `break` outside of a loop or labeled block - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-28433.rs b/tests/ui/issues/issue-28433.rs deleted file mode 100644 index 2298ad240d560..0000000000000 --- a/tests/ui/issues/issue-28433.rs +++ /dev/null @@ -1,12 +0,0 @@ -enum Bird { - pub Duck, - //~^ ERROR visibility qualifiers are not permitted here - Goose, - pub(crate) Dove - //~^ ERROR visibility qualifiers are not permitted here -} - - -fn main() { - let y = Bird::Goose; -} diff --git a/tests/ui/issues/issue-28433.stderr b/tests/ui/issues/issue-28433.stderr deleted file mode 100644 index 0fa67e35f1d4b..0000000000000 --- a/tests/ui/issues/issue-28433.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0449]: visibility qualifiers are not permitted here - --> $DIR/issue-28433.rs:2:5 - | -LL | pub Duck, - | ^^^ help: remove the qualifier - | - = note: enum variants and their fields always share the visibility of the enum they are in - -error[E0449]: visibility qualifiers are not permitted here - --> $DIR/issue-28433.rs:5:5 - | -LL | pub(crate) Dove - | ^^^^^^^^^^ help: remove the qualifier - | - = note: enum variants and their fields always share the visibility of the enum they are in - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0449`. diff --git a/tests/ui/issues/issue-42453.rs b/tests/ui/issues/issue-42453.rs deleted file mode 100644 index 9ed9080e8a92e..0000000000000 --- a/tests/ui/issues/issue-42453.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -#[derive(Debug)] -struct builder; - -fn main() { - -} diff --git a/tests/ui/issues/issue-43057.rs b/tests/ui/issues/issue-43057.rs deleted file mode 100644 index 4dd1fe461f1b4..0000000000000 --- a/tests/ui/issues/issue-43057.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ check-pass -#![allow(unused)] - -macro_rules! column { - ($i:ident) => { - $i - }; -} - -fn foo() -> ! { - panic!(); -} - -fn main() {} diff --git a/tests/ui/issues/issue-50600.rs b/tests/ui/issues/issue-50600.rs deleted file mode 100644 index 963e607afcfd4..0000000000000 --- a/tests/ui/issues/issue-50600.rs +++ /dev/null @@ -1,5 +0,0 @@ -struct Foo ( - fn([u8; |x: u8| {}]), //~ ERROR mismatched types -); - -fn main() {} diff --git a/tests/ui/issues/issue-28109.rs b/tests/ui/label/undeclared-label-span.rs similarity index 54% rename from tests/ui/issues/issue-28109.rs rename to tests/ui/label/undeclared-label-span.rs index 755a539b5003e..c6f38c067192a 100644 --- a/tests/ui/issues/issue-28109.rs +++ b/tests/ui/label/undeclared-label-span.rs @@ -1,4 +1,5 @@ -// Make sure that label for continue and break is spanned correctly +//! regression test for +//! Make sure that label for continue and break is spanned correctly. fn main() { loop { diff --git a/tests/ui/issues/issue-28109.stderr b/tests/ui/label/undeclared-label-span.stderr similarity index 79% rename from tests/ui/issues/issue-28109.stderr rename to tests/ui/label/undeclared-label-span.stderr index 0f918d3b6f702..e5451b4655d86 100644 --- a/tests/ui/issues/issue-28109.stderr +++ b/tests/ui/label/undeclared-label-span.stderr @@ -1,11 +1,11 @@ error[E0426]: use of undeclared label `'b` - --> $DIR/issue-28109.rs:6:9 + --> $DIR/undeclared-label-span.rs:7:9 | LL | 'b | ^^ undeclared label `'b` error[E0426]: use of undeclared label `'c` - --> $DIR/issue-28109.rs:9:9 + --> $DIR/undeclared-label-span.rs:10:9 | LL | 'c | ^^ undeclared label `'c` diff --git a/tests/ui/macros/column-macro-collision.rs b/tests/ui/macros/column-macro-collision.rs new file mode 100644 index 0000000000000..7acf491888aff --- /dev/null +++ b/tests/ui/macros/column-macro-collision.rs @@ -0,0 +1,17 @@ +//! regression test for +//! user-defined `column!` macro must not shadow +//! the built-in `column!()` used internally by `panic!()`. +//@ check-pass +#![allow(unused)] + +macro_rules! column { + ($i:ident) => { + $i + }; +} + +fn foo() -> ! { + panic!(); +} + +fn main() {} diff --git a/tests/ui/issues/issue-27008.rs b/tests/ui/mismatched_types/array-repeat-unit-struct.rs similarity index 61% rename from tests/ui/issues/issue-27008.rs rename to tests/ui/mismatched_types/array-repeat-unit-struct.rs index 20aa4f282c7e6..db05e1daedbd1 100644 --- a/tests/ui/issues/issue-27008.rs +++ b/tests/ui/mismatched_types/array-repeat-unit-struct.rs @@ -1,3 +1,5 @@ +//! regression test for + struct S; fn main() { diff --git a/tests/ui/issues/issue-27008.stderr b/tests/ui/mismatched_types/array-repeat-unit-struct.stderr similarity index 83% rename from tests/ui/issues/issue-27008.stderr rename to tests/ui/mismatched_types/array-repeat-unit-struct.stderr index b4bfaa2786332..9a9cc946f82a1 100644 --- a/tests/ui/issues/issue-27008.stderr +++ b/tests/ui/mismatched_types/array-repeat-unit-struct.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-27008.rs:4:17 + --> $DIR/array-repeat-unit-struct.rs:6:17 | LL | let b = [0; S]; | ^ expected `usize`, found `S` diff --git a/tests/ui/issues/issue-24819.rs b/tests/ui/mismatched_types/vec-hashset-type-mismatch.rs similarity index 68% rename from tests/ui/issues/issue-24819.rs rename to tests/ui/mismatched_types/vec-hashset-type-mismatch.rs index 97d288e5cb144..3724a423d0dd6 100644 --- a/tests/ui/issues/issue-24819.rs +++ b/tests/ui/mismatched_types/vec-hashset-type-mismatch.rs @@ -1,3 +1,4 @@ +//! regression test for //@ dont-require-annotations: NOTE use std::collections::HashSet; @@ -9,5 +10,4 @@ fn main() { //~| NOTE expected `&mut HashSet`, found `&mut Vec<_>` } -fn foo(h: &mut HashSet) { -} +fn foo(h: &mut HashSet) {} diff --git a/tests/ui/issues/issue-24819.stderr b/tests/ui/mismatched_types/vec-hashset-type-mismatch.stderr similarity index 79% rename from tests/ui/issues/issue-24819.stderr rename to tests/ui/mismatched_types/vec-hashset-type-mismatch.stderr index e144f37d6e48b..e778422d00642 100644 --- a/tests/ui/issues/issue-24819.stderr +++ b/tests/ui/mismatched_types/vec-hashset-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-24819.rs:7:9 + --> $DIR/vec-hashset-type-mismatch.rs:8:9 | LL | foo(&mut v); | --- ^^^^^^ expected `&mut HashSet`, found `&mut Vec<_>` @@ -9,9 +9,9 @@ LL | foo(&mut v); = note: expected mutable reference `&mut HashSet` found mutable reference `&mut Vec<_>` note: function defined here - --> $DIR/issue-24819.rs:12:4 + --> $DIR/vec-hashset-type-mismatch.rs:13:4 | -LL | fn foo(h: &mut HashSet) { +LL | fn foo(h: &mut HashSet) {} | ^^^ -------------------- error: aborting due to 1 previous error diff --git a/tests/ui/issues/auxiliary/issue-16725.rs b/tests/ui/privacy/auxiliary/private-extern-fn.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-16725.rs rename to tests/ui/privacy/auxiliary/private-extern-fn.rs diff --git a/tests/ui/privacy/privacy-sanity.rs b/tests/ui/privacy/privacy-sanity.rs index 6622089dda6d7..fcd03394d631b 100644 --- a/tests/ui/privacy/privacy-sanity.rs +++ b/tests/ui/privacy/privacy-sanity.rs @@ -25,6 +25,14 @@ pub extern "C" { //~ ERROR visibility qualifiers are not permitted here pub static St: u8; } +enum Bird { + pub Duck, + //~^ ERROR visibility qualifiers are not permitted here + pub(crate) Dove, + //~^ ERROR visibility qualifiers are not permitted here + Goose, +} + const MAIN: u8 = { pub trait Tr { fn f(); @@ -79,4 +87,11 @@ fn main() { pub fn f(); pub static St: u8; } + enum Bird { + pub Duck, + //~^ ERROR visibility qualifiers are not permitted here + pub(crate) Dove, + //~^ ERROR visibility qualifiers are not permitted here + Goose, + } } diff --git a/tests/ui/privacy/privacy-sanity.stderr b/tests/ui/privacy/privacy-sanity.stderr index 0acb05cbabaa7..fd643357335a1 100644 --- a/tests/ui/privacy/privacy-sanity.stderr +++ b/tests/ui/privacy/privacy-sanity.stderr @@ -47,7 +47,23 @@ LL | pub extern "C" { = note: place qualifiers on individual foreign items instead error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:39:5 + --> $DIR/privacy-sanity.rs:29:5 + | +LL | pub Duck, + | ^^^ help: remove the qualifier + | + = note: enum variants and their fields always share the visibility of the enum they are in + +error[E0449]: visibility qualifiers are not permitted here + --> $DIR/privacy-sanity.rs:31:5 + | +LL | pub(crate) Dove, + | ^^^^^^^^^^ help: remove the qualifier + | + = note: enum variants and their fields always share the visibility of the enum they are in + +error[E0449]: visibility qualifiers are not permitted here + --> $DIR/privacy-sanity.rs:47:5 | LL | pub impl Tr for S { | ^^^ help: remove the qualifier @@ -55,7 +71,7 @@ LL | pub impl Tr for S { = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:40:9 + --> $DIR/privacy-sanity.rs:48:9 | LL | pub fn f() {} | ^^^ help: remove the qualifier @@ -63,7 +79,7 @@ LL | pub fn f() {} = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:41:9 + --> $DIR/privacy-sanity.rs:49:9 | LL | pub const C: u8 = 0; | ^^^ help: remove the qualifier @@ -71,7 +87,7 @@ LL | pub const C: u8 = 0; = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:42:9 + --> $DIR/privacy-sanity.rs:50:9 | LL | pub type T = u8; | ^^^ help: remove the qualifier @@ -79,7 +95,7 @@ LL | pub type T = u8; = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:44:5 + --> $DIR/privacy-sanity.rs:52:5 | LL | pub impl S { | ^^^ help: remove the qualifier @@ -87,7 +103,7 @@ LL | pub impl S { = note: place qualifiers on individual impl items instead error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:49:5 + --> $DIR/privacy-sanity.rs:57:5 | LL | pub extern "C" { | ^^^ help: remove the qualifier @@ -95,7 +111,7 @@ LL | pub extern "C" { = note: place qualifiers on individual foreign items instead error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:68:5 + --> $DIR/privacy-sanity.rs:76:5 | LL | pub impl Tr for S { | ^^^ help: remove the qualifier @@ -103,7 +119,7 @@ LL | pub impl Tr for S { = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:69:9 + --> $DIR/privacy-sanity.rs:77:9 | LL | pub fn f() {} | ^^^ help: remove the qualifier @@ -111,7 +127,7 @@ LL | pub fn f() {} = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:70:9 + --> $DIR/privacy-sanity.rs:78:9 | LL | pub const C: u8 = 0; | ^^^ help: remove the qualifier @@ -119,7 +135,7 @@ LL | pub const C: u8 = 0; = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:71:9 + --> $DIR/privacy-sanity.rs:79:9 | LL | pub type T = u8; | ^^^ help: remove the qualifier @@ -127,7 +143,7 @@ LL | pub type T = u8; = note: trait items always share the visibility of their trait error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:73:5 + --> $DIR/privacy-sanity.rs:81:5 | LL | pub impl S { | ^^^ help: remove the qualifier @@ -135,13 +151,29 @@ LL | pub impl S { = note: place qualifiers on individual impl items instead error[E0449]: visibility qualifiers are not permitted here - --> $DIR/privacy-sanity.rs:78:5 + --> $DIR/privacy-sanity.rs:86:5 | LL | pub extern "C" { | ^^^ help: remove the qualifier | = note: place qualifiers on individual foreign items instead -error: aborting due to 18 previous errors +error[E0449]: visibility qualifiers are not permitted here + --> $DIR/privacy-sanity.rs:91:9 + | +LL | pub Duck, + | ^^^ help: remove the qualifier + | + = note: enum variants and their fields always share the visibility of the enum they are in + +error[E0449]: visibility qualifiers are not permitted here + --> $DIR/privacy-sanity.rs:93:9 + | +LL | pub(crate) Dove, + | ^^^^^^^^^^ help: remove the qualifier + | + = note: enum variants and their fields always share the visibility of the enum they are in + +error: aborting due to 22 previous errors For more information about this error, try `rustc --explain E0449`. diff --git a/tests/ui/privacy/private-extern-fn-visibility.rs b/tests/ui/privacy/private-extern-fn-visibility.rs new file mode 100644 index 0000000000000..39f2c3c003d57 --- /dev/null +++ b/tests/ui/privacy/private-extern-fn-visibility.rs @@ -0,0 +1,11 @@ +//! regression test for +//@ aux-build:private-extern-fn.rs + +extern crate private_extern_fn as foo; + +fn main() { + unsafe { + foo::bar(); + //~^ ERROR: function `bar` is private + } +} diff --git a/tests/ui/issues/issue-16725.stderr b/tests/ui/privacy/private-extern-fn-visibility.stderr similarity index 60% rename from tests/ui/issues/issue-16725.stderr rename to tests/ui/privacy/private-extern-fn-visibility.stderr index dcb7d58b0f961..8b1fa512b5de2 100644 --- a/tests/ui/issues/issue-16725.stderr +++ b/tests/ui/privacy/private-extern-fn-visibility.stderr @@ -1,11 +1,11 @@ error[E0603]: function `bar` is private - --> $DIR/issue-16725.rs:6:19 + --> $DIR/private-extern-fn-visibility.rs:8:14 | -LL | unsafe { foo::bar(); } - | ^^^ private function +LL | foo::bar(); + | ^^^ private function | note: the function `bar` is defined here - --> $DIR/auxiliary/issue-16725.rs:2:5 + --> $DIR/auxiliary/private-extern-fn.rs:2:5 | LL | fn bar(); | ^^^^^^^^^ diff --git a/tests/ui/issues/issue-22894.rs b/tests/ui/static/static-str-deref-ref.rs similarity index 51% rename from tests/ui/issues/issue-22894.rs rename to tests/ui/static/static-str-deref-ref.rs index e8fc680f04224..86c37e527657c 100644 --- a/tests/ui/issues/issue-22894.rs +++ b/tests/ui/static/static-str-deref-ref.rs @@ -1,3 +1,4 @@ +//! regression test for //@ build-pass #[allow(dead_code)] static X: &'static str = &*""; diff --git a/tests/ui/threads-sendsync/std-sync-right-kind-impls.rs b/tests/ui/threads-sendsync/std-sync-right-kind-impls.rs index b2d22631c1a5e..42135fe1c45bd 100644 --- a/tests/ui/threads-sendsync/std-sync-right-kind-impls.rs +++ b/tests/ui/threads-sendsync/std-sync-right-kind-impls.rs @@ -1,6 +1,6 @@ //@ run-pass -use std::sync; +use std::{fs, net, sync}; fn assert_both() {} @@ -12,4 +12,20 @@ fn main() { assert_both::>(); assert_both::>(); assert_both::(); + + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); }