Skip to content

Commit 4996946

Browse files
committed
Add missing 2015 edition directives
These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
1 parent b17dba4 commit 4996946

36 files changed

+74
-46
lines changed

tests/ui/issues/issue-10806.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-pass
23
#![allow(unused_imports)]
34

tests/ui/issues/issue-12729.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23
#![allow(dead_code)]
34

tests/ui/issues/issue-13105.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23

34
trait Foo {

tests/ui/issues/issue-13775.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23

34
trait Foo {

tests/ui/issues/issue-15774.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-pass
23

34
#![deny(warnings)]

tests/ui/issues/issue-34074.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23
// Make sure several unnamed function parameters don't conflict with each other
34

tests/ui/issues/issue-50571.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-rustfix
23

34
#![allow(dead_code)]

tests/ui/issues/issue-50571.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-rustfix
23

34
#![allow(dead_code)]

tests/ui/issues/issue-50571.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0642]: patterns aren't allowed in methods without bodies
2-
--> $DIR/issue-50571.rs:5:12
2+
--> $DIR/issue-50571.rs:6:12
33
|
44
LL | fn foo([a, b]: [i32; 2]) {}
55
| ^^^^^^

tests/ui/issues/issue-86756.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
trait Foo<T, T = T> {}
23
//~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters
34

tests/ui/issues/issue-86756.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
2-
--> $DIR/issue-86756.rs:1:14
2+
--> $DIR/issue-86756.rs:2:14
33
|
44
LL | trait Foo<T, T = T> {}
55
| - ^ already used
66
| |
77
| first use of `T`
88

99
error[E0412]: cannot find type `dyn` in this scope
10-
--> $DIR/issue-86756.rs:5:10
10+
--> $DIR/issue-86756.rs:6:10
1111
|
1212
LL | eq::<dyn, Foo>
1313
| ^^^ not found in this scope
1414

1515
warning: trait objects without an explicit `dyn` are deprecated
16-
--> $DIR/issue-86756.rs:5:15
16+
--> $DIR/issue-86756.rs:6:15
1717
|
1818
LL | eq::<dyn, Foo>
1919
| ^^^
@@ -27,13 +27,13 @@ LL | eq::<dyn, dyn Foo>
2727
| +++
2828

2929
error[E0107]: missing generics for trait `Foo`
30-
--> $DIR/issue-86756.rs:5:15
30+
--> $DIR/issue-86756.rs:6:15
3131
|
3232
LL | eq::<dyn, Foo>
3333
| ^^^ expected at least 1 generic argument
3434
|
3535
note: trait defined here, with at least 1 generic parameter: `T`
36-
--> $DIR/issue-86756.rs:1:7
36+
--> $DIR/issue-86756.rs:2:7
3737
|
3838
LL | trait Foo<T, T = T> {}
3939
| ^^^ -

tests/ui/lexer/lex-bad-str-literal-as-char-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ revisions: rust2015 rust2018 rust2021
2+
//@[rust2015] edition:2015
23
//@[rust2018] edition:2018
34
//@[rust2021] edition:2021
45
fn main() {

tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0762]: unterminated character literal
2-
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
2+
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:26
33
|
44
LL | println!('hello world');
55
| ^^^

tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0762]: unterminated character literal
2-
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
2+
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:26
33
|
44
LL | println!('hello world');
55
| ^^^

tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: prefix `world` is unknown
2-
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:21
2+
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:21
33
|
44
LL | println!('hello world');
55
| ^^^^^ unknown prefix
@@ -12,7 +12,7 @@ LL + println!("hello world");
1212
|
1313

1414
error[E0762]: unterminated character literal
15-
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
15+
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:26
1616
|
1717
LL | println!('hello world');
1818
| ^^^

tests/ui/lifetimes/bare-trait-object-borrowck.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#![allow(bare_trait_objects)]
1+
//@ edition: 2015
22
//@ check-pass
3+
#![allow(bare_trait_objects)]
4+
35
pub struct FormatWith<'a, I, F> {
46
sep: &'a str,
57
/// FormatWith uses interior mutability because Display::fmt takes &self.

tests/ui/lifetimes/bare-trait-object.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Verify that lifetime resolution correctly accounts for `Fn` bare trait objects.
2+
//@ edition: 2015
23
//@ check-pass
34
#![allow(bare_trait_objects)]
45

tests/ui/lint/bare-trait-objects-path.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
#![feature(associated_type_defaults)]
23

34
trait Assoc {

tests/ui/lint/bare-trait-objects-path.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: trait objects without an explicit `dyn` are deprecated
2-
--> $DIR/bare-trait-objects-path.rs:14:5
2+
--> $DIR/bare-trait-objects-path.rs:15:5
33
|
44
LL | Dyn::func();
55
| ^^^
@@ -13,7 +13,7 @@ LL | <dyn Dyn>::func();
1313
| ++++ +
1414

1515
warning: trait objects without an explicit `dyn` are deprecated
16-
--> $DIR/bare-trait-objects-path.rs:17:5
16+
--> $DIR/bare-trait-objects-path.rs:18:5
1717
|
1818
LL | ::Dyn::func();
1919
| ^^^^^
@@ -26,7 +26,7 @@ LL | <dyn (::Dyn)>::func();
2626
| ++++++ ++
2727

2828
warning: trait objects without an explicit `dyn` are deprecated
29-
--> $DIR/bare-trait-objects-path.rs:20:5
29+
--> $DIR/bare-trait-objects-path.rs:21:5
3030
|
3131
LL | Dyn::CONST;
3232
| ^^^
@@ -39,7 +39,7 @@ LL | <dyn Dyn>::CONST;
3939
| ++++ +
4040

4141
warning: trait objects without an explicit `dyn` are deprecated
42-
--> $DIR/bare-trait-objects-path.rs:23:12
42+
--> $DIR/bare-trait-objects-path.rs:24:12
4343
|
4444
LL | let _: Dyn::Ty;
4545
| ^^^
@@ -52,7 +52,7 @@ LL | let _: <dyn Dyn>::Ty;
5252
| ++++ +
5353

5454
error[E0223]: ambiguous associated type
55-
--> $DIR/bare-trait-objects-path.rs:23:12
55+
--> $DIR/bare-trait-objects-path.rs:24:12
5656
|
5757
LL | let _: Dyn::Ty;
5858
| ^^^^^^^

tests/ui/lint/lint-pre-expansion-extern-module.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ check-pass
22
//@ compile-flags: -W rust-2018-compatibility
3+
//@ edition: 2015
34

45
fn main() {}
56

tests/ui/lint/lint-qualification.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-rustfix
23
#![deny(unused_qualifications)]
34
#![deny(unused_imports)]

tests/ui/lint/lint-qualification.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ run-rustfix
23
#![deny(unused_qualifications)]
34
#![deny(unused_imports)]

tests/ui/lint/lint-qualification.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: unnecessary qualification
2-
--> $DIR/lint-qualification.rs:12:5
2+
--> $DIR/lint-qualification.rs:13:5
33
|
44
LL | foo::bar();
55
| ^^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-qualification.rs:2:9
8+
--> $DIR/lint-qualification.rs:3:9
99
|
1010
LL | #![deny(unused_qualifications)]
1111
| ^^^^^^^^^^^^^^^^^^^^^
@@ -16,7 +16,7 @@ LL + bar();
1616
|
1717

1818
error: unnecessary qualification
19-
--> $DIR/lint-qualification.rs:13:5
19+
--> $DIR/lint-qualification.rs:14:5
2020
|
2121
LL | crate::foo::bar();
2222
| ^^^^^^^^^^^^^^^
@@ -28,7 +28,7 @@ LL + bar();
2828
|
2929

3030
error: unnecessary qualification
31-
--> $DIR/lint-qualification.rs:18:13
31+
--> $DIR/lint-qualification.rs:19:13
3232
|
3333
LL | let _ = std::string::String::new();
3434
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -40,7 +40,7 @@ LL + let _ = String::new();
4040
|
4141

4242
error: unnecessary qualification
43-
--> $DIR/lint-qualification.rs:20:12
43+
--> $DIR/lint-qualification.rs:21:12
4444
|
4545
LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new();
4646
| ^^^^^^^^^^^^^^^^^^^^^
@@ -52,7 +52,7 @@ LL + let _: Vec<String> = std::vec::Vec::<String>::new();
5252
|
5353

5454
error: unnecessary qualification
55-
--> $DIR/lint-qualification.rs:20:36
55+
--> $DIR/lint-qualification.rs:21:36
5656
|
5757
LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new();
5858
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -64,19 +64,19 @@ LL + let _: std::vec::Vec<String> = Vec::<String>::new();
6464
|
6565

6666
error: unused import: `std::fmt`
67-
--> $DIR/lint-qualification.rs:24:9
67+
--> $DIR/lint-qualification.rs:25:9
6868
|
6969
LL | use std::fmt;
7070
| ^^^^^^^^
7171
|
7272
note: the lint level is defined here
73-
--> $DIR/lint-qualification.rs:3:9
73+
--> $DIR/lint-qualification.rs:4:9
7474
|
7575
LL | #![deny(unused_imports)]
7676
| ^^^^^^^^^^^^^^
7777

7878
error: unnecessary qualification
79-
--> $DIR/lint-qualification.rs:29:13
79+
--> $DIR/lint-qualification.rs:30:13
8080
|
8181
LL | let _ = <bool as std::default::Default>::default(); // issue #121999 (modified)
8282
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ edition: 2015
12
//@ check-pass
23
#![warn(redundant_imports)]
34

tests/ui/lint/use-redundant/use-redundant-prelude-rust-2015.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the item `Some` is imported redundantly
2-
--> $DIR/use-redundant-prelude-rust-2015.rs:5:5
2+
--> $DIR/use-redundant-prelude-rust-2015.rs:6:5
33
|
44
LL | use std::option::Option::Some;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,13 +8,13 @@ LL | use std::option::Option::Some;
88
= note: the item `Some` is already defined here
99
|
1010
note: the lint level is defined here
11-
--> $DIR/use-redundant-prelude-rust-2015.rs:2:9
11+
--> $DIR/use-redundant-prelude-rust-2015.rs:3:9
1212
|
1313
LL | #![warn(redundant_imports)]
1414
| ^^^^^^^^^^^^^^^^^
1515

1616
warning: the item `None` is imported redundantly
17-
--> $DIR/use-redundant-prelude-rust-2015.rs:6:5
17+
--> $DIR/use-redundant-prelude-rust-2015.rs:7:5
1818
|
1919
LL | use std::option::Option::None;
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | use std::option::Option::None;
2323
= note: the item `None` is already defined here
2424

2525
warning: the item `Ok` is imported redundantly
26-
--> $DIR/use-redundant-prelude-rust-2015.rs:8:5
26+
--> $DIR/use-redundant-prelude-rust-2015.rs:9:5
2727
|
2828
LL | use std::result::Result::Ok;
2929
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -32,7 +32,7 @@ LL | use std::result::Result::Ok;
3232
= note: the item `Ok` is already defined here
3333

3434
warning: the item `Err` is imported redundantly
35-
--> $DIR/use-redundant-prelude-rust-2015.rs:9:5
35+
--> $DIR/use-redundant-prelude-rust-2015.rs:10:5
3636
|
3737
LL | use std::result::Result::Err;
3838
| ^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/macros/try-macro.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ run-pass
2+
//@ edition: 2015
23
#![allow(deprecated)] // for deprecated `try!()` macro
34
use std::num::{ParseFloatError, ParseIntError};
45

tests/ui/parser/dyn-trait-compatibility.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ edition: 2015
2+
13
type A0 = dyn;
24
//~^ ERROR cannot find type `dyn` in this scope
35
type A1 = dyn::dyn;

tests/ui/parser/dyn-trait-compatibility.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
error[E0412]: cannot find type `dyn` in this scope
2-
--> $DIR/dyn-trait-compatibility.rs:1:11
2+
--> $DIR/dyn-trait-compatibility.rs:3:11
33
|
44
LL | type A0 = dyn;
55
| ^^^ not found in this scope
66

77
error[E0412]: cannot find type `dyn` in this scope
8-
--> $DIR/dyn-trait-compatibility.rs:5:11
8+
--> $DIR/dyn-trait-compatibility.rs:7:11
99
|
1010
LL | type A2 = dyn<dyn, dyn>;
1111
| ^^^ not found in this scope
1212

1313
error[E0412]: cannot find type `dyn` in this scope
14-
--> $DIR/dyn-trait-compatibility.rs:5:15
14+
--> $DIR/dyn-trait-compatibility.rs:7:15
1515
|
1616
LL | type A2 = dyn<dyn, dyn>;
1717
| ^^^ not found in this scope
1818

1919
error[E0412]: cannot find type `dyn` in this scope
20-
--> $DIR/dyn-trait-compatibility.rs:5:20
20+
--> $DIR/dyn-trait-compatibility.rs:7:20
2121
|
2222
LL | type A2 = dyn<dyn, dyn>;
2323
| ^^^ not found in this scope
2424

2525
error[E0412]: cannot find type `dyn` in this scope
26-
--> $DIR/dyn-trait-compatibility.rs:9:11
26+
--> $DIR/dyn-trait-compatibility.rs:11:11
2727
|
2828
LL | type A3 = dyn<<dyn as dyn>::dyn>;
2929
| ^^^ not found in this scope
3030

3131
error[E0405]: cannot find trait `dyn` in this scope
32-
--> $DIR/dyn-trait-compatibility.rs:9:23
32+
--> $DIR/dyn-trait-compatibility.rs:11:23
3333
|
3434
LL | type A3 = dyn<<dyn as dyn>::dyn>;
3535
| ^^^ not found in this scope
3636

3737
error[E0412]: cannot find type `dyn` in this scope
38-
--> $DIR/dyn-trait-compatibility.rs:9:16
38+
--> $DIR/dyn-trait-compatibility.rs:11:16
3939
|
4040
LL | type A3 = dyn<<dyn as dyn>::dyn>;
4141
| ^^^ not found in this scope
4242

4343
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `dyn`
44-
--> $DIR/dyn-trait-compatibility.rs:3:11
44+
--> $DIR/dyn-trait-compatibility.rs:5:11
4545
|
4646
LL | type A1 = dyn::dyn;
4747
| ^^^ use of unresolved module or unlinked crate `dyn`

0 commit comments

Comments
 (0)