Fix new broken tests

This commit is contained in:
Ryan Levick 2021-06-24 16:45:19 +02:00
parent 15eae851de
commit ef08c6bc4d
15 changed files with 67 additions and 63 deletions

View File

@ -9,20 +9,20 @@ extern crate or_pattern;
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, )+

View File

@ -9,20 +9,20 @@ extern crate or_pattern;
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, )+

View File

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

View File

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

View File

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

View File

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

View File

@ -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()
}
@ -53,17 +55,17 @@ 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();
@ -71,26 +73,26 @@ fn main() {
// 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
}

View File

@ -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()
}
@ -53,17 +55,17 @@ 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();
@ -71,26 +73,26 @@ fn main() {
// 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
}

View File

@ -1,5 +1,5 @@
warning: trait method `try_into` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision.rs:54:18
--> $DIR/future-prelude-collision.rs:56:18
|
LL | let _: u32 = 3u8.try_into().unwrap();
| ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)`
@ -9,70 +9,70 @@ 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-associated function `try_from` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision.rs:59:13
--> $DIR/future-prelude-collision.rs:61:13
|
LL | let _ = u32::try_from(3u8).unwrap();
| ^^^^^^^^^^^^^ help: disambiguate the associated function: `<u32 as TryFromU8>::try_from`
|
= 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-associated function `from_iter` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision.rs:64:13
--> $DIR/future-prelude-collision.rs:66:13
|
LL | let _ = <Vec<u8>>::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter());
| ^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `<Vec<u8> as FromByteIterator>::from_iter`
|
= 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-associated function `try_from` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision.rs:72:18
--> $DIR/future-prelude-collision.rs:74:18
|
LL | let _: u32 = <_>::try_from(3u8).unwrap();
| ^^^^^^^^^^^^^ help: disambiguate the associated function: `<_ as TryFromU8>::try_from`
|
= 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
--> $DIR/future-prelude-collision.rs:77:18
--> $DIR/future-prelude-collision.rs:79:18
|
LL | let _: u32 = (&3u8).try_into().unwrap();
| ^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `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
--> $DIR/future-prelude-collision.rs:82:18
--> $DIR/future-prelude-collision.rs:84:18
|
LL | let _: u32 = 3.0.try_into().unwrap();
| ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(&3.0)`
|
= 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
--> $DIR/future-prelude-collision.rs:88:18
--> $DIR/future-prelude-collision.rs:90:18
|
LL | let _: u32 = mut_ptr.try_into().unwrap();
| ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(mut_ptr as *const _)`
|
= 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-associated function `try_from` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision.rs:93:13
--> $DIR/future-prelude-collision.rs:95:13
|
LL | let _ = U32Alias::try_from(3u8).unwrap();
| ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `<U32Alias as TryFromU8>::try_from`
|
= 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: 8 warnings emitted

View File

@ -14,5 +14,5 @@ impl<T> MyTrait<()> for Vec<T> {
fn main() {
<Vec<i32> as MyTrait<_>>::from_iter(None);
//~^ 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
}

View File

@ -14,5 +14,5 @@ impl<T> MyTrait<()> for Vec<T> {
fn main() {
<Vec<i32>>::from_iter(None);
//~^ 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
}

View File

@ -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 2015) but is a hard error in Rust 2021!
= note: for more information, see issue #85684 <https://github.com/rust-lang/rust/issues/85684>
warning: 1 warning emitted

View File

@ -40,7 +40,7 @@ mod inner {
pub fn test() -> u32 {
(&*get_dyn_trait()).try_into().unwrap()
//~^ WARNING trait method `try_into` will become ambiguous
//~| WARNING this was previously accepted
//~| WARNING this is accepted in the current edition
}
}

View File

@ -40,7 +40,7 @@ mod inner {
pub fn test() -> u32 {
get_dyn_trait().try_into().unwrap()
//~^ WARNING trait method `try_into` will become ambiguous
//~| WARNING this was previously accepted
//~| WARNING this is accepted in the current edition
}
}

View File

@ -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: 1 warning emitted