Skip to content

Commit 89ad574

Browse files
authored
Rollup merge of #140446 - mejrs:test1, r=jieyouxu
chore: fix some tests
2 parents 9625096 + a4ce307 commit 89ad574

12 files changed

+54
-111
lines changed

src/tools/tidy/src/issues.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,6 @@ ui/issues/issue-27997.rs
19791979
ui/issues/issue-28105.rs
19801980
ui/issues/issue-28109.rs
19811981
ui/issues/issue-28181.rs
1982-
ui/issues/issue-2823.rs
19831982
ui/issues/issue-28279.rs
19841983
ui/issues/issue-28344.rs
19851984
ui/issues/issue-28433.rs

src/tools/tidy/src/ui_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ignore::Walk;
1717
const ENTRY_LIMIT: u32 = 901;
1818
// FIXME: The following limits should be reduced eventually.
1919

20-
const ISSUES_ENTRY_LIMIT: u32 = 1626;
20+
const ISSUES_ENTRY_LIMIT: u32 = 1624;
2121

2222
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
2323
"rs", // test source files

tests/ui/diagnostic_namespace/on_impl_trait.rs renamed to tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// used to ICE, see <https://github.com/rust-lang/rust/issues/130627>
2-
// Instead it should just ignore the diagnostic attribute
1+
//! used to ICE, see <https://github.com/rust-lang/rust/issues/130627>
2+
//! Instead it should just ignore the diagnostic attribute
3+
34
#![feature(trait_alias)]
45

56
trait Test {}

tests/ui/diagnostic_namespace/on_impl_trait.stderr renamed to tests/ui/diagnostic_namespace/on_unimplemented/on_impl_trait.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
2-
--> $DIR/on_impl_trait.rs:7:1
2+
--> $DIR/on_impl_trait.rs:8:1
33
|
44
LL | #[diagnostic::on_unimplemented(message = "blah", label = "blah", note = "blah")]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
88

99
error[E0277]: the trait bound `{integer}: Alias` is not satisfied
10-
--> $DIR/on_impl_trait.rs:15:9
10+
--> $DIR/on_impl_trait.rs:16:9
1111
|
1212
LL | foo(&1);
1313
| --- ^^ the trait `Test` is not implemented for `{integer}`
1414
| |
1515
| required by a bound introduced by this call
1616
|
1717
help: this trait has no implementations, consider adding one
18-
--> $DIR/on_impl_trait.rs:5:1
18+
--> $DIR/on_impl_trait.rs:6:1
1919
|
2020
LL | trait Test {}
2121
| ^^^^^^^^^^
2222
= note: required for `{integer}` to implement `Alias`
2323
note: required by a bound in `foo`
24-
--> $DIR/on_impl_trait.rs:12:11
24+
--> $DIR/on_impl_trait.rs:13:11
2525
|
2626
LL | fn foo<T: Alias>(v: &T) {}
2727
| ^^^^^ required by this bound in `foo`

tests/ui/issues/issue-2823.rs

-14
This file was deleted.

tests/ui/issues/issue-2823.stderr

-16
This file was deleted.

tests/ui/methods/clone-missing.rs

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
1-
// This test checks that calling `.clone()` on a type that does not implement the `Clone` trait
2-
// results in a compilation error. The `Foo` struct does not derive or implement `Clone`,
3-
// so attempting to clone it should fail.
1+
//! This test checks that calling `.clone()` on a type that does
2+
//! not implement the `Clone` trait results in a compilation error.
3+
//! The `NotClone` and AlsoNotClone structs do not derive or
4+
//! implement `Clone`, so attempting to clone them should fail.
45
5-
struct Foo {
6-
i: isize,
6+
struct NotClone {
7+
i: isize,
78
}
89

9-
fn foo(i:isize) -> Foo {
10-
Foo {
11-
i: i
10+
fn not_clone(i: isize) -> NotClone {
11+
NotClone { i }
12+
}
13+
14+
struct AlsoNotClone {
15+
i: isize,
16+
j: NotClone,
17+
}
18+
19+
fn also_not_clone(i: isize) -> AlsoNotClone {
20+
AlsoNotClone {
21+
i,
22+
j: NotClone { i: i },
1223
}
1324
}
1425

1526
fn main() {
16-
let x = foo(10);
27+
let x = not_clone(10);
28+
let _y = x.clone();
29+
//~^ ERROR no method named `clone` found
30+
31+
let x = also_not_clone(10);
1732
let _y = x.clone();
1833
//~^ ERROR no method named `clone` found
1934
}

tests/ui/methods/clone-missing.stderr

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1-
error[E0599]: no method named `clone` found for struct `Foo` in the current scope
2-
--> $DIR/clone-missing.rs:17:16
1+
error[E0599]: no method named `clone` found for struct `NotClone` in the current scope
2+
--> $DIR/clone-missing.rs:28:16
33
|
4-
LL | struct Foo {
5-
| ---------- method `clone` not found for this struct
4+
LL | struct NotClone {
5+
| --------------- method `clone` not found for this struct
66
...
77
LL | let _y = x.clone();
8-
| ^^^^^ method not found in `Foo`
8+
| ^^^^^ method not found in `NotClone`
99
|
1010
= help: items from traits can only be used if the trait is implemented and in scope
1111
= note: the following trait defines an item `clone`, perhaps you need to implement it:
1212
candidate #1: `Clone`
1313

14-
error: aborting due to 1 previous error
14+
error[E0599]: no method named `clone` found for struct `AlsoNotClone` in the current scope
15+
--> $DIR/clone-missing.rs:32:16
16+
|
17+
LL | struct AlsoNotClone {
18+
| ------------------- method `clone` not found for this struct
19+
...
20+
LL | let _y = x.clone();
21+
| ^^^^^ method not found in `AlsoNotClone`
22+
|
23+
= help: items from traits can only be used if the trait is implemented and in scope
24+
= note: the following trait defines an item `clone`, perhaps you need to implement it:
25+
candidate #1: `Clone`
26+
27+
error: aborting due to 2 previous errors
1528

1629
For more information about this error, try `rustc --explain E0599`.

tests/ui/noncopyable-class.rs

-36
This file was deleted.

tests/ui/noncopyable-class.stderr

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
// Tests that two closures cannot simultaneously have mutable
2-
// access to the variable, whether that mutable access be used
3-
// for direct assignment or for taking mutable ref. Issue #6801.
1+
//! Test for invalid MetaItem syntax in the attribute
42
3+
#![crate_type = "lib"]
54
#![feature(rustc_attrs)]
65

76
#[rustc_on_unimplemented(
87
message="the message"
98
label="the label" //~ ERROR expected `,`, found `label`
109
)]
1110
trait T {}
12-
13-
fn main() { }

tests/ui/on-unimplemented/expected-comma-found-token.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: expected `,`, found `label`
2-
--> $DIR/expected-comma-found-token.rs:9:5
2+
--> $DIR/expected-comma-found-token.rs:8:5
33
|
44
LL | message="the message"
55
| - expected `,`

0 commit comments

Comments
 (0)