Skip to content

Commit

Permalink
Fix new broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev committed Jun 24, 2021
1 parent 56a7719 commit e7adb02
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 63 deletions.
8 changes: 4 additions & 4 deletions src/test/ui/macros/macro-or-patterns-back-compat.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

macro_rules! foo { ($x:pat_param | $y:pat) => {} }
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
macro_rules! bar { ($($x:pat_param)+ | $($y:pat)+) => {} }
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok
macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok
macro_rules! ogg { ($x:pat_param | $y:pat_param) => {} }
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
macro_rules! match_any {
( $expr:expr , $( $( $pat:pat_param )|+ => $expr_arm:expr ),+ ) => {
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
match $expr {
$(
$( $pat => $expr_arm, )+
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/macros/macro-or-patterns-back-compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

macro_rules! foo { ($x:pat | $y:pat) => {} }
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok
macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok
macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
macro_rules! match_any {
( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
//~| WARN this was previously accepted
//~| WARN this is accepted in the current edition
match $expr {
$(
$( $pat => $expr_arm, )+
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/macros/macro-or-patterns-back-compat.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ note: the lint level is defined here
|
LL | #![deny(or_patterns_back_compat)]
| ^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>

error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
Expand All @@ -18,7 +18,7 @@ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, whi
LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>

error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
Expand All @@ -27,7 +27,7 @@ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, whi
LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>

error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
Expand All @@ -36,7 +36,7 @@ error: the meaning of the `pat` fragment specifier is changing in Rust 2021, whi
LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
| ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>

error: aborting due to 4 previous errors
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/rust-2021/future-prelude-collision-imported.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod a {
// In this case, we can just use `TryIntoU32`
let _: u32 = TryIntoU32::try_into(3u8).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
}

Expand All @@ -39,7 +39,7 @@ mod b {
// the path `crate::m::TryIntoU32` (with which it was imported).
let _: u32 = crate::m::TryIntoU32::try_into(3u8).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
}

Expand All @@ -52,7 +52,7 @@ mod c {
// the path `super::m::TryIntoU32` (with which it was imported).
let _: u32 = super::m::TryIntoU32::try_into(3u8).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/rust-2021/future-prelude-collision-imported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod a {
// In this case, we can just use `TryIntoU32`
let _: u32 = 3u8.try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
}

Expand All @@ -39,7 +39,7 @@ mod b {
// the path `crate::m::TryIntoU32` (with which it was imported).
let _: u32 = 3u8.try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
}

Expand All @@ -52,7 +52,7 @@ mod c {
// the path `super::m::TryIntoU32` (with which it was imported).
let _: u32 = 3u8.try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ note: the lint level is defined here
|
LL | #![warn(future_prelude_collision)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684>

warning: trait method `try_into` will become ambiguous in Rust 2021
Expand All @@ -18,7 +18,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021
LL | let _: u32 = 3u8.try_into().unwrap();
| ^^^^^^^^^^^^^^ help: disambiguate the associated function: `crate::m::TryIntoU32::try_into(3u8)`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684>

warning: trait method `try_into` will become ambiguous in Rust 2021
Expand All @@ -27,7 +27,7 @@ warning: trait method `try_into` will become ambiguous in Rust 2021
LL | let _: u32 = 3u8.try_into().unwrap();
| ^^^^^^^^^^^^^^ help: disambiguate the associated function: `super::m::TryIntoU32::try_into(3u8)`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684>

warning: 3 warnings emitted
Expand Down
22 changes: 12 additions & 10 deletions src/test/ui/rust-2021/future-prelude-collision.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ impl TryIntoU32 for *const u16 {

trait FromByteIterator {
fn from_iter<T>(iter: T) -> Self
where T: Iterator<Item = u8>;
where
T: Iterator<Item = u8>;
}

impl FromByteIterator for Vec<u8> {
fn from_iter<T>(iter: T) -> Self
where T: Iterator<Item = u8>
where
T: Iterator<Item = u8>,
{
iter.collect()
}
Expand All @@ -53,44 +55,44 @@ fn main() {
// test dot-call that will break in 2021 edition
let _: u32 = TryIntoU32::try_into(3u8).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test associated function call that will break in 2021 edition
let _ = <u32 as TryFromU8>::try_from(3u8).unwrap();
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test reverse turbofish too
let _ = <Vec<u8> as FromByteIterator>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter());
//~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// negative testing lint (this line should *not* emit a warning)
let _: u32 = TryFromU8::try_from(3u8).unwrap();

// test type omission
let _: u32 = <_ as TryFromU8>::try_from(3u8).unwrap();
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test autoderef
let _: u32 = TryIntoU32::try_into(*(&3u8)).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test autoref
let _: u32 = TryIntoU32::try_into(&3.0).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

let mut data = 3u16;
let mut_ptr = std::ptr::addr_of_mut!(data);
let _: u32 = TryIntoU32::try_into(mut_ptr as *const _).unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

type U32Alias = u32;
let _ = <U32Alias as TryFromU8>::try_from(3u8).unwrap();
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
22 changes: 12 additions & 10 deletions src/test/ui/rust-2021/future-prelude-collision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ impl TryIntoU32 for *const u16 {

trait FromByteIterator {
fn from_iter<T>(iter: T) -> Self
where T: Iterator<Item = u8>;
where
T: Iterator<Item = u8>;
}

impl FromByteIterator for Vec<u8> {
fn from_iter<T>(iter: T) -> Self
where T: Iterator<Item = u8>
where
T: Iterator<Item = u8>,
{
iter.collect()
}
Expand All @@ -53,44 +55,44 @@ fn main() {
// test dot-call that will break in 2021 edition
let _: u32 = 3u8.try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test associated function call that will break in 2021 edition
let _ = u32::try_from(3u8).unwrap();
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test reverse turbofish too
let _ = <Vec<u8>>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter());
//~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// negative testing lint (this line should *not* emit a warning)
let _: u32 = TryFromU8::try_from(3u8).unwrap();

// test type omission
let _: u32 = <_>::try_from(3u8).unwrap();
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test autoderef
let _: u32 = (&3u8).try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

// test autoref
let _: u32 = 3.0.try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

let mut data = 3u16;
let mut_ptr = std::ptr::addr_of_mut!(data);
let _: u32 = mut_ptr.try_into().unwrap();
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition

type U32Alias = u32;
let _ = U32Alias::try_from(3u8).unwrap();
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~^^ WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
//~^^ WARNING this is accepted in the current edition
}
Loading

0 comments on commit e7adb02

Please sign in to comment.