cleaned up some tests

merge privacy/privacy-sanity-2 with privacy/privacy-sanity.rs

Add comment to generics/type-args-on-module-in-bound.rs

Add comment to array-slice-vec/closure-in-array-eln.rs

Add comment to array-slice-vec/return-in-array-len.rs

Merge for-loop-while/break-outside-loop-2.rs with
for-loop-while/break-outside-loop.rs

Add comment to macros/column-macro-collision.rs

Add comment to privacy/private-extern-fn-visibility.rs

Add comment to mismatched_types/vec-hashset-type-mismatch.rs

Merge std-sync-right-kind-impls-2.rs with std-sync-right-kind-impls.rs

Add comment to array-slice-vec/slice-of-multi-ref.rs

Add comment to mismatched_types\vec-hashset-type-mismatch.rs

Add comment to derives/derive-hygiene-struct-builder.rs

Add comment to label/undeclared-label-span.rs

Add comment to label\undeclared-label-span.rs

Add comment to mismatched_types/array-repeat-unit-struct.rs
This commit is contained in:
reddevilmidzy 2026-01-15 18:34:54 +09:00
parent 559e672489
commit 77b2a196fb
29 changed files with 180 additions and 147 deletions

View file

@ -1,4 +1,5 @@
struct Foo (
//! regression test for <https://github.com/rust-lang/rust/issues/50600>
struct Foo(
fn([u8; |x: u8| {}]), //~ ERROR mismatched types
);

View file

@ -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

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/51714>
fn main() {
//~^ NOTE: not the enclosing function body
//~| NOTE: not the enclosing function body

View file

@ -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() {
... |

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/17503>
//@ run-pass
fn main() {
let s: &[isize] = &[0, 1, 2, 3, 4];

View file

@ -1,3 +1,5 @@
//! regression test for <https://github.com/rust-lang/rust/issues/42453>
//! struct named "builder" conflicted with derive macro internals.
//@ run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
@ -5,6 +7,4 @@
#[derive(Debug)]
struct builder;
fn main() {
}
fn main() {}

View file

@ -1,6 +1,6 @@
//! regression test for <https://github.com/rust-lang/rust/issues/17361>
//! Test that HIR ty lowering doesn't forget about mutability of `&mut str`.
//@ run-pass
// Test that HIR ty lowering doesn't forget about mutability of `&mut str`.
fn main() {
fn foo<T: ?Sized>(_: &mut T) {}

View file

@ -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
;
}

View file

@ -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`.

View file

@ -1,25 +1,41 @@
struct Foo {
t: String
t: String,
}
fn cond() -> bool { true }
fn cond() -> bool {
true
}
fn foo<F>(_: F) where F: FnOnce() {}
fn foo<F>(_: 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
;
}

View file

@ -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`.

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/22706>
fn is_copy<T: ::std::marker<i32>::Copy>() {}
//~^ ERROR type arguments are not allowed on module `marker` [E0109]
fn main() {}

View file

@ -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<T: ::std::marker<i32>::Copy>() {}
| ------ ^^^ type argument not allowed

View file

@ -1,4 +1,5 @@
// Make sure that label for continue and break is spanned correctly
//! regression test for <https://github.com/rust-lang/rust/issues/28109>
//! Make sure that label for continue and break is spanned correctly.
fn main() {
loop {

View file

@ -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`

View file

@ -1,3 +1,6 @@
//! regression test for <https://github.com/rust-lang/rust/issues/43057>
//! user-defined `column!` macro must not shadow
//! the built-in `column!()` used internally by `panic!()`.
//@ check-pass
#![allow(unused)]

View file

@ -1,3 +1,5 @@
//! regression test for <https://github.com/rust-lang/rust/issues/27008>
struct S;
fn main() {

View file

@ -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`

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/24819>
//@ dont-require-annotations: NOTE
use std::collections::HashSet;
@ -9,5 +10,4 @@ fn main() {
//~| NOTE expected `&mut HashSet<u32>`, found `&mut Vec<_>`
}
fn foo(h: &mut HashSet<u32>) {
}
fn foo(h: &mut HashSet<u32>) {}

View file

@ -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<u32>`, found `&mut Vec<_>`
@ -9,9 +9,9 @@ LL | foo(&mut v);
= note: expected mutable reference `&mut HashSet<u32>`
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<u32>) {
LL | fn foo(h: &mut HashSet<u32>) {}
| ^^^ --------------------
error: aborting due to 1 previous error

View file

@ -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;
}

View file

@ -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`.

View file

@ -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,
}
}

View file

@ -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`.

View file

@ -1,8 +1,11 @@
//@ aux-build:issue-16725.rs
//! regression test for <https://github.com/rust-lang/rust/issues/16725>
//@ aux-build:private-extern-fn.rs
extern crate issue_16725 as foo;
extern crate private_extern_fn as foo;
fn main() {
unsafe { foo::bar(); }
//~^ ERROR: function `bar` is private
unsafe {
foo::bar();
//~^ ERROR: function `bar` is private
}
}

View file

@ -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();
| ^^^^^^^^^

View file

@ -1,3 +1,4 @@
//! regression test for <https://github.com/rust-lang/rust/issues/22894>
//@ build-pass
#[allow(dead_code)]
static X: &'static str = &*"";

View file

@ -1,25 +0,0 @@
//@ run-pass
#![allow(dead_code)]
use std::{fs, net};
fn assert_both<T: Send + Sync>() {}
fn assert_send<T: Send>() {}
fn main() {
assert_both::<fs::File>();
assert_both::<fs::Metadata>();
assert_both::<fs::ReadDir>();
assert_both::<fs::DirEntry>();
assert_both::<fs::OpenOptions>();
assert_both::<fs::Permissions>();
assert_both::<net::TcpStream>();
assert_both::<net::TcpListener>();
assert_both::<net::UdpSocket>();
assert_both::<net::SocketAddr>();
assert_both::<net::SocketAddrV4>();
assert_both::<net::SocketAddrV6>();
assert_both::<net::Ipv4Addr>();
assert_both::<net::Ipv6Addr>();
}

View file

@ -1,6 +1,6 @@
//@ run-pass
use std::sync;
use std::{fs, net, sync};
fn assert_both<T: Sync + Send>() {}
@ -12,4 +12,20 @@ fn main() {
assert_both::<sync::Arc<()>>();
assert_both::<sync::Weak<()>>();
assert_both::<sync::Once>();
assert_both::<fs::File>();
assert_both::<fs::Metadata>();
assert_both::<fs::ReadDir>();
assert_both::<fs::DirEntry>();
assert_both::<fs::OpenOptions>();
assert_both::<fs::Permissions>();
assert_both::<net::TcpStream>();
assert_both::<net::TcpListener>();
assert_both::<net::UdpSocket>();
assert_both::<net::SocketAddr>();
assert_both::<net::SocketAddrV4>();
assert_both::<net::SocketAddrV6>();
assert_both::<net::Ipv4Addr>();
assert_both::<net::Ipv6Addr>();
}