Skip to content

Add more missing 2015 edition directives #141959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/ui/issues/issue-10806.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-pass
#![allow(unused_imports)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-12729.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ check-pass
#![allow(dead_code)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-13105.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ check-pass

trait Foo {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-13775.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ check-pass

trait Foo {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-15774.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-pass

#![deny(warnings)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-34074.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ check-pass
// Make sure several unnamed function parameters don't conflict with each other

Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-50571.fixed
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-rustfix

#![allow(dead_code)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-50571.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-rustfix

#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issues/issue-50571.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0642]: patterns aren't allowed in methods without bodies
--> $DIR/issue-50571.rs:5:12
--> $DIR/issue-50571.rs:6:12
|
LL | fn foo([a, b]: [i32; 2]) {}
| ^^^^^^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/issues/issue-86756.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
trait Foo<T, T = T> {}
//~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters

Expand Down
10 changes: 5 additions & 5 deletions tests/ui/issues/issue-86756.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
--> $DIR/issue-86756.rs:1:14
--> $DIR/issue-86756.rs:2:14
|
LL | trait Foo<T, T = T> {}
| - ^ already used
| |
| first use of `T`

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

warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/issue-86756.rs:5:15
--> $DIR/issue-86756.rs:6:15
|
LL | eq::<dyn, Foo>
| ^^^
Expand All @@ -27,13 +27,13 @@ LL | eq::<dyn, dyn Foo>
| +++

error[E0107]: missing generics for trait `Foo`
--> $DIR/issue-86756.rs:5:15
--> $DIR/issue-86756.rs:6:15
|
LL | eq::<dyn, Foo>
| ^^^ expected at least 1 generic argument
|
note: trait defined here, with at least 1 generic parameter: `T`
--> $DIR/issue-86756.rs:1:7
--> $DIR/issue-86756.rs:2:7
|
LL | trait Foo<T, T = T> {}
| ^^^ -
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lexer/lex-bad-str-literal-as-char-3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ revisions: rust2015 rust2018 rust2021
//@[rust2015] edition:2015
//@[rust2018] edition:2018
//@[rust2021] edition:2021
fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0762]: unterminated character literal
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:26
|
LL | println!('hello world');
| ^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0762]: unterminated character literal
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:26
|
LL | println!('hello world');
| ^^^
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: prefix `world` is unknown
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:21
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:21
|
LL | println!('hello world');
| ^^^^^ unknown prefix
Expand All @@ -12,7 +12,7 @@ LL + println!("hello world");
|

error[E0762]: unterminated character literal
--> $DIR/lex-bad-str-literal-as-char-3.rs:5:26
--> $DIR/lex-bad-str-literal-as-char-3.rs:6:26
|
LL | println!('hello world');
| ^^^
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/lifetimes/bare-trait-object-borrowck.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![allow(bare_trait_objects)]
//@ edition: 2015
//@ check-pass
#![allow(bare_trait_objects)]

pub struct FormatWith<'a, I, F> {
sep: &'a str,
/// FormatWith uses interior mutability because Display::fmt takes &self.
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lifetimes/bare-trait-object.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Verify that lifetime resolution correctly accounts for `Fn` bare trait objects.
//@ edition: 2015
//@ check-pass
#![allow(bare_trait_objects)]

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/bare-trait-objects-path.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
#![feature(associated_type_defaults)]

trait Assoc {
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/lint/bare-trait-objects-path.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:14:5
--> $DIR/bare-trait-objects-path.rs:15:5
|
LL | Dyn::func();
| ^^^
Expand All @@ -13,7 +13,7 @@ LL | <dyn Dyn>::func();
| ++++ +

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

warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/bare-trait-objects-path.rs:20:5
--> $DIR/bare-trait-objects-path.rs:21:5
|
LL | Dyn::CONST;
| ^^^
Expand All @@ -39,7 +39,7 @@ LL | <dyn Dyn>::CONST;
| ++++ +

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

error[E0223]: ambiguous associated type
--> $DIR/bare-trait-objects-path.rs:23:12
--> $DIR/bare-trait-objects-path.rs:24:12
|
LL | let _: Dyn::Ty;
| ^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-pre-expansion-extern-module.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ check-pass
//@ compile-flags: -W rust-2018-compatibility
//@ edition: 2015

fn main() {}

Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-qualification.fixed
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-rustfix
#![deny(unused_qualifications)]
#![deny(unused_imports)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/lint-qualification.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ run-rustfix
#![deny(unused_qualifications)]
#![deny(unused_imports)]
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/lint/lint-qualification.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: unnecessary qualification
--> $DIR/lint-qualification.rs:12:5
--> $DIR/lint-qualification.rs:13:5
|
LL | foo::bar();
| ^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-qualification.rs:2:9
--> $DIR/lint-qualification.rs:3:9
|
LL | #![deny(unused_qualifications)]
| ^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -16,7 +16,7 @@ LL + bar();
|

error: unnecessary qualification
--> $DIR/lint-qualification.rs:13:5
--> $DIR/lint-qualification.rs:14:5
|
LL | crate::foo::bar();
| ^^^^^^^^^^^^^^^
Expand All @@ -28,7 +28,7 @@ LL + bar();
|

error: unnecessary qualification
--> $DIR/lint-qualification.rs:18:13
--> $DIR/lint-qualification.rs:19:13
|
LL | let _ = std::string::String::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -40,7 +40,7 @@ LL + let _ = String::new();
|

error: unnecessary qualification
--> $DIR/lint-qualification.rs:20:12
--> $DIR/lint-qualification.rs:21:12
|
LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new();
| ^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -52,7 +52,7 @@ LL + let _: Vec<String> = std::vec::Vec::<String>::new();
|

error: unnecessary qualification
--> $DIR/lint-qualification.rs:20:36
--> $DIR/lint-qualification.rs:21:36
|
LL | let _: std::vec::Vec<String> = std::vec::Vec::<String>::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -64,19 +64,19 @@ LL + let _: std::vec::Vec<String> = Vec::<String>::new();
|

error: unused import: `std::fmt`
--> $DIR/lint-qualification.rs:24:9
--> $DIR/lint-qualification.rs:25:9
|
LL | use std::fmt;
| ^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-qualification.rs:3:9
--> $DIR/lint-qualification.rs:4:9
|
LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^

error: unnecessary qualification
--> $DIR/lint-qualification.rs:29:13
--> $DIR/lint-qualification.rs:30:13
|
LL | let _ = <bool as std::default::Default>::default(); // issue #121999 (modified)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@ edition: 2015
//@ check-pass
#![warn(redundant_imports)]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: the item `Some` is imported redundantly
--> $DIR/use-redundant-prelude-rust-2015.rs:5:5
--> $DIR/use-redundant-prelude-rust-2015.rs:6:5
|
LL | use std::option::Option::Some;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -8,13 +8,13 @@ LL | use std::option::Option::Some;
= note: the item `Some` is already defined here
|
note: the lint level is defined here
--> $DIR/use-redundant-prelude-rust-2015.rs:2:9
--> $DIR/use-redundant-prelude-rust-2015.rs:3:9
|
LL | #![warn(redundant_imports)]
| ^^^^^^^^^^^^^^^^^

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

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

warning: the item `Err` is imported redundantly
--> $DIR/use-redundant-prelude-rust-2015.rs:9:5
--> $DIR/use-redundant-prelude-rust-2015.rs:10:5
|
LL | use std::result::Result::Err;
| ^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/macros/try-macro.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@ run-pass
//@ edition: 2015
#![allow(deprecated)] // for deprecated `try!()` macro
use std::num::{ParseFloatError, ParseIntError};

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/parser/dyn-trait-compatibility.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//@ edition: 2015

type A0 = dyn;
//~^ ERROR cannot find type `dyn` in this scope
type A1 = dyn::dyn;
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/parser/dyn-trait-compatibility.stderr
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
error[E0412]: cannot find type `dyn` in this scope
--> $DIR/dyn-trait-compatibility.rs:1:11
--> $DIR/dyn-trait-compatibility.rs:3:11
|
LL | type A0 = dyn;
| ^^^ not found in this scope

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

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

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

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

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

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

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