diff options
Diffstat (limited to 'src/test/ui/inference')
85 files changed, 0 insertions, 2160 deletions
diff --git a/src/test/ui/inference/ambiguous_type_parameter.rs b/src/test/ui/inference/ambiguous_type_parameter.rs deleted file mode 100644 index dc70ed661..000000000 --- a/src/test/ui/inference/ambiguous_type_parameter.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::collections::HashMap; - -trait Store<K, V> { - fn get_raw(&self, key: &K) -> Option<()>; -} - -struct InMemoryStore; - -impl<K> Store<String, HashMap<K, String>> for InMemoryStore { - fn get_raw(&self, key: &String) -> Option<()> { - None - } -} - -fn main() { - InMemoryStore.get_raw(&String::default()); //~ ERROR type annotations needed -} diff --git a/src/test/ui/inference/ambiguous_type_parameter.stderr b/src/test/ui/inference/ambiguous_type_parameter.stderr deleted file mode 100644 index 9cbe221de..000000000 --- a/src/test/ui/inference/ambiguous_type_parameter.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/ambiguous_type_parameter.rs:16:19 - | -LL | InMemoryStore.get_raw(&String::default()); - | ^^^^^^^ - | -help: try using a fully qualified path to specify the expected types - | -LL | <InMemoryStore as Store<String, HashMap<K, String>>>::get_raw(&InMemoryStore, &String::default()); - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs b/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs deleted file mode 100644 index 04bc0b1a8..000000000 --- a/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs +++ /dev/null @@ -1,35 +0,0 @@ -#![feature(staged_api)] -#![feature(arbitrary_self_types)] - -#![stable(feature = "ipu_iterator", since = "1.0.0")] - -#[stable(feature = "ipu_iterator", since = "1.0.0")] -pub trait IpuIterator { - #[unstable(feature = "ipu_flatten", issue = "99999")] - fn ipu_flatten(&self) -> u32 { - 0 - } - - #[unstable(feature = "ipu_flatten", issue = "99999")] - fn ipu_by_value_vs_by_ref(self) -> u32 where Self: Sized { - 0 - } - - #[unstable(feature = "ipu_flatten", issue = "99999")] - fn ipu_by_ref_vs_by_ref_mut(&self) -> u32 { - 0 - } - - #[unstable(feature = "ipu_flatten", issue = "99999")] - fn ipu_by_mut_ptr_vs_by_const_ptr(self: *mut Self) -> u32 { - 0 - } - - #[unstable(feature = "assoc_const_ipu_iter", issue = "99999")] - const C: i32; -} - -#[stable(feature = "ipu_iterator", since = "1.0.0")] -impl IpuIterator for char { - const C: i32 = 42; -} diff --git a/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs b/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs deleted file mode 100644 index fa1efbcfe..000000000 --- a/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![feature(arbitrary_self_types)] - -pub trait IpuItertools { - fn ipu_flatten(&self) -> u32 { - 1 - } - - fn ipu_by_value_vs_by_ref(&self) -> u32 { - 1 - } - - fn ipu_by_ref_vs_by_ref_mut(&mut self) -> u32 { - 1 - } - - fn ipu_by_mut_ptr_vs_by_const_ptr(self: *const Self) -> u32 { - 1 - } - - const C: i32; -} - -impl IpuItertools for char { - const C: i32 = 1; -} diff --git a/src/test/ui/inference/cannot-infer-async.rs b/src/test/ui/inference/cannot-infer-async.rs deleted file mode 100644 index b5152d04f..000000000 --- a/src/test/ui/inference/cannot-infer-async.rs +++ /dev/null @@ -1,16 +0,0 @@ -// edition:2018 - -use std::io::Error; - -fn make_unit() -> Result<(), Error> { - Ok(()) -} - -fn main() { - let fut = async { - make_unit()?; - - Ok(()) - //~^ ERROR type annotations needed - }; -} diff --git a/src/test/ui/inference/cannot-infer-async.stderr b/src/test/ui/inference/cannot-infer-async.stderr deleted file mode 100644 index 0579cf238..000000000 --- a/src/test/ui/inference/cannot-infer-async.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/cannot-infer-async.rs:13:9 - | -LL | Ok(()) - | ^^ cannot infer type of the type parameter `E` declared on the enum `Result` - | -help: consider specifying the generic arguments - | -LL | Ok::<(), E>(()) - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/cannot-infer-closure-circular.rs b/src/test/ui/inference/cannot-infer-closure-circular.rs deleted file mode 100644 index affb48149..000000000 --- a/src/test/ui/inference/cannot-infer-closure-circular.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn main() { - // Below we call the closure with its own return as the argument, unifying - // its inferred input and return types. We want to make sure that the generated - // error handles this gracefully, and in particular doesn't generate an extra - // note about the `?` operator in the closure body, which isn't relevant to - // the inference. - let x = |r| { //~ ERROR type annotations needed for `Result<(), E>` - let v = r?; - Ok(v) - }; - - let _ = x(x(Ok(()))); -} diff --git a/src/test/ui/inference/cannot-infer-closure-circular.stderr b/src/test/ui/inference/cannot-infer-closure-circular.stderr deleted file mode 100644 index b706cd2bc..000000000 --- a/src/test/ui/inference/cannot-infer-closure-circular.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed for `Result<(), E>` - --> $DIR/cannot-infer-closure-circular.rs:7:14 - | -LL | let x = |r| { - | ^ - | -help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified - | -LL | let x = |r: Result<(), E>| { - | +++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/cannot-infer-closure.rs b/src/test/ui/inference/cannot-infer-closure.rs deleted file mode 100644 index bd5d10b41..000000000 --- a/src/test/ui/inference/cannot-infer-closure.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let x = |a: (), b: ()| { - Err(a)?; - Ok(b) - //~^ ERROR type annotations needed - }; -} diff --git a/src/test/ui/inference/cannot-infer-closure.stderr b/src/test/ui/inference/cannot-infer-closure.stderr deleted file mode 100644 index a4b818e6e..000000000 --- a/src/test/ui/inference/cannot-infer-closure.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/cannot-infer-closure.rs:4:9 - | -LL | Ok(b) - | ^^ cannot infer type of the type parameter `E` declared on the enum `Result` - | -help: consider specifying the generic arguments - | -LL | Ok::<(), E>(b) - | +++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.rs b/src/test/ui/inference/cannot-infer-partial-try-return.rs deleted file mode 100644 index b555697dc..000000000 --- a/src/test/ui/inference/cannot-infer-partial-try-return.rs +++ /dev/null @@ -1,23 +0,0 @@ -struct QualifiedError<E>(E); - -impl<E, T> From<E> for QualifiedError<T> -where - E: std::error::Error, - T: From<E>, -{ - fn from(e: E) -> QualifiedError<T> { - QualifiedError(e.into()) - } -} - -fn infallible() -> Result<(), std::convert::Infallible> { - Ok(()) -} - -fn main() { - let x = || -> Result<_, QualifiedError<_>> { - infallible()?; - Ok(()) - //~^ ERROR type annotations needed - }; -} diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.stderr b/src/test/ui/inference/cannot-infer-partial-try-return.stderr deleted file mode 100644 index 2a56aaa44..000000000 --- a/src/test/ui/inference/cannot-infer-partial-try-return.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/cannot-infer-partial-try-return.rs:20:9 - | -LL | infallible()?; - | ------------- type must be known at this point -LL | Ok(()) - | ^^ cannot infer type of the type parameter `E` declared on the enum `Result` - | -help: consider specifying the generic arguments - | -LL | Ok::<(), QualifiedError<_>>(()) - | +++++++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/char-as-str-multi.rs b/src/test/ui/inference/char-as-str-multi.rs deleted file mode 100644 index c29a15025..000000000 --- a/src/test/ui/inference/char-as-str-multi.rs +++ /dev/null @@ -1,7 +0,0 @@ -// When a MULTI/NO-character string literal is used where a char should be, -// DO NOT suggest changing to single quotes. - -fn main() { - let _: char = "foo"; //~ ERROR mismatched types - let _: char = ""; //~ ERROR mismatched types -} diff --git a/src/test/ui/inference/char-as-str-multi.stderr b/src/test/ui/inference/char-as-str-multi.stderr deleted file mode 100644 index 297ca2b54..000000000 --- a/src/test/ui/inference/char-as-str-multi.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/char-as-str-multi.rs:5:19 - | -LL | let _: char = "foo"; - | ---- ^^^^^ expected `char`, found `&str` - | | - | expected due to this - -error[E0308]: mismatched types - --> $DIR/char-as-str-multi.rs:6:19 - | -LL | let _: char = ""; - | ---- ^^ expected `char`, found `&str` - | | - | expected due to this - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/char-as-str-single.fixed b/src/test/ui/inference/char-as-str-single.fixed deleted file mode 100644 index bab1854dc..000000000 --- a/src/test/ui/inference/char-as-str-single.fixed +++ /dev/null @@ -1,12 +0,0 @@ -// When a SINGLE-character string literal is used where a char should be, -// suggest changing to single quotes. - -// Testing both single-byte and multi-byte characters, as we should handle both. - -// run-rustfix - -fn main() { - let _: char = 'a'; //~ ERROR mismatched types - let _: char = '人'; //~ ERROR mismatched types - let _: char = '\''; //~ ERROR mismatched types -} diff --git a/src/test/ui/inference/char-as-str-single.rs b/src/test/ui/inference/char-as-str-single.rs deleted file mode 100644 index 736920643..000000000 --- a/src/test/ui/inference/char-as-str-single.rs +++ /dev/null @@ -1,12 +0,0 @@ -// When a SINGLE-character string literal is used where a char should be, -// suggest changing to single quotes. - -// Testing both single-byte and multi-byte characters, as we should handle both. - -// run-rustfix - -fn main() { - let _: char = "a"; //~ ERROR mismatched types - let _: char = "人"; //~ ERROR mismatched types - let _: char = "'"; //~ ERROR mismatched types -} diff --git a/src/test/ui/inference/char-as-str-single.stderr b/src/test/ui/inference/char-as-str-single.stderr deleted file mode 100644 index 3375ec6ac..000000000 --- a/src/test/ui/inference/char-as-str-single.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/char-as-str-single.rs:9:19 - | -LL | let _: char = "a"; - | ---- ^^^ expected `char`, found `&str` - | | - | expected due to this - | -help: if you meant to write a `char` literal, use single quotes - | -LL | let _: char = 'a'; - | ~~~ - -error[E0308]: mismatched types - --> $DIR/char-as-str-single.rs:10:19 - | -LL | let _: char = "人"; - | ---- ^^^^ expected `char`, found `&str` - | | - | expected due to this - | -help: if you meant to write a `char` literal, use single quotes - | -LL | let _: char = '人'; - | ~~~~ - -error[E0308]: mismatched types - --> $DIR/char-as-str-single.rs:11:19 - | -LL | let _: char = "'"; - | ---- ^^^ expected `char`, found `&str` - | | - | expected due to this - | -help: if you meant to write a `char` literal, use single quotes - | -LL | let _: char = '\''; - | ~~~~ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/deref-suggestion.rs b/src/test/ui/inference/deref-suggestion.rs deleted file mode 100644 index 0d8e7289d..000000000 --- a/src/test/ui/inference/deref-suggestion.rs +++ /dev/null @@ -1,75 +0,0 @@ -macro_rules! borrow { - ($x:expr) => { &$x } -} - -fn foo(_: String) {} - -fn foo2(s: &String) { - foo(s); - //~^ ERROR mismatched types -} - -fn foo3(_: u32) {} -fn foo4(u: &u32) { - foo3(u); - //~^ ERROR mismatched types -} - -struct S<'a> { - u: &'a u32, -} - -struct R { - i: u32, -} - -fn main() { - let s = String::new(); - let r_s = &s; - foo2(r_s); - foo(&"aaa".to_owned()); - //~^ ERROR mismatched types - foo(&mut "aaa".to_owned()); - //~^ ERROR mismatched types - foo3(borrow!(0)); - //~^ ERROR mismatched types - foo4(&0); - assert_eq!(3i32, &3i32); - //~^ ERROR mismatched types - let u = 3; - let s = S { u }; - //~^ ERROR mismatched types - let s = S { u: u }; - //~^ ERROR mismatched types - let i = &4; - let r = R { i }; - //~^ ERROR mismatched types - let r = R { i: i }; - //~^ ERROR mismatched types - - - let a = &1; - let b = &2; - let val: i32 = if true { - a + 1 - } else { - b - //~^ ERROR mismatched types - }; - let val: i32 = if true { - let _ = 2; - a + 1 - } else { - let _ = 2; - b - //~^ ERROR mismatched types - }; - let val = if true { - *a - } else if true { - //~^ ERROR incompatible types - b - } else { - &0 - }; -} diff --git a/src/test/ui/inference/deref-suggestion.stderr b/src/test/ui/inference/deref-suggestion.stderr deleted file mode 100644 index 034005697..000000000 --- a/src/test/ui/inference/deref-suggestion.stderr +++ /dev/null @@ -1,177 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:8:9 - | -LL | foo(s); - | --- ^- help: try using a conversion method: `.to_string()` - | | | - | | expected struct `String`, found `&String` - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/deref-suggestion.rs:5:4 - | -LL | fn foo(_: String) {} - | ^^^ --------- - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:14:10 - | -LL | foo3(u); - | ---- ^ expected `u32`, found `&u32` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/deref-suggestion.rs:12:4 - | -LL | fn foo3(_: u32) {} - | ^^^^ ------ -help: consider dereferencing the borrow - | -LL | foo3(*u); - | + - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:30:9 - | -LL | foo(&"aaa".to_owned()); - | --- ^^^^^^^^^^^^^^^^^ expected struct `String`, found `&String` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/deref-suggestion.rs:5:4 - | -LL | fn foo(_: String) {} - | ^^^ --------- -help: consider removing the borrow - | -LL - foo(&"aaa".to_owned()); -LL + foo("aaa".to_owned()); - | - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:32:9 - | -LL | foo(&mut "aaa".to_owned()); - | --- ^^^^^^^^^^^^^^^^^^^^^ expected struct `String`, found `&mut String` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/deref-suggestion.rs:5:4 - | -LL | fn foo(_: String) {} - | ^^^ --------- -help: consider removing the borrow - | -LL - foo(&mut "aaa".to_owned()); -LL + foo("aaa".to_owned()); - | - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:34:10 - | -LL | foo3(borrow!(0)); - | ---- ^^^^^^^^^^ expected `u32`, found `&{integer}` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/deref-suggestion.rs:12:4 - | -LL | fn foo3(_: u32) {} - | ^^^^ ------ - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:37:5 - | -LL | assert_eq!(3i32, &3i32); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32` - | - = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:40:17 - | -LL | let s = S { u }; - | ^ - | | - | expected `&u32`, found integer - | help: consider borrowing here: `u: &u` - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:42:20 - | -LL | let s = S { u: u }; - | ^ - | | - | expected `&u32`, found integer - | help: consider borrowing here: `&u` - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:45:17 - | -LL | let r = R { i }; - | ^ expected `u32`, found `&{integer}` - | -help: consider dereferencing the borrow - | -LL | let r = R { i: *i }; - | ++++ - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:47:20 - | -LL | let r = R { i: i }; - | ^ expected `u32`, found `&{integer}` - | -help: consider dereferencing the borrow - | -LL | let r = R { i: *i }; - | + - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:56:9 - | -LL | b - | ^ expected `i32`, found `&{integer}` - | -help: consider dereferencing the borrow - | -LL | *b - | + - -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:64:9 - | -LL | b - | ^ expected `i32`, found `&{integer}` - | -help: consider dereferencing the borrow - | -LL | *b - | + - -error[E0308]: `if` and `else` have incompatible types - --> $DIR/deref-suggestion.rs:69:12 - | -LL | let val = if true { - | ________________- -LL | | *a - | | -- expected because of this -LL | | } else if true { - | | ____________^ -LL | || -LL | || b -LL | || } else { -LL | || &0 -LL | || }; - | || ^ - | ||_____| - | |_____`if` and `else` have incompatible types - | expected `i32`, found `&{integer}` - -error: aborting due to 13 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/erase-type-params-in-label.rs b/src/test/ui/inference/erase-type-params-in-label.rs deleted file mode 100644 index 1fea2da92..000000000 --- a/src/test/ui/inference/erase-type-params-in-label.rs +++ /dev/null @@ -1,27 +0,0 @@ -fn main() { - let foo = foo(1, ""); //~ ERROR E0283 -} -fn baz() { - let bar = bar(1, ""); //~ ERROR E0283 -} - -struct Bar<T, K, N: Default> { - t: T, - k: K, - n: N, -} - -fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { - Bar { t, k, n: Default::default() } -} - -struct Foo<T, K, N: Default, M: Default> { - t: T, - k: K, - n: N, - m: M, -} - -fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> { - Foo { t, k, n: Default::default(), m: Default::default() } -} diff --git a/src/test/ui/inference/erase-type-params-in-label.stderr b/src/test/ui/inference/erase-type-params-in-label.stderr deleted file mode 100644 index 5c52e7bcf..000000000 --- a/src/test/ui/inference/erase-type-params-in-label.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0283]: type annotations needed for `Foo<i32, &str, W, Z>` - --> $DIR/erase-type-params-in-label.rs:2:9 - | -LL | let foo = foo(1, ""); - | ^^^ --- type must be known at this point - | - = note: cannot satisfy `_: Default` -note: required by a bound in `foo` - --> $DIR/erase-type-params-in-label.rs:25:17 - | -LL | fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> { - | ^^^^^^^ required by this bound in `foo` -help: consider specifying the type arguments in the function call - | -LL | let foo = foo::<T, K, W, Z>(1, ""); - | ++++++++++++++ - -error[E0283]: type annotations needed for `Bar<i32, &str, Z>` - --> $DIR/erase-type-params-in-label.rs:5:9 - | -LL | let bar = bar(1, ""); - | ^^^ --- type must be known at this point - | - = note: cannot satisfy `_: Default` -note: required by a bound in `bar` - --> $DIR/erase-type-params-in-label.rs:14:17 - | -LL | fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { - | ^^^^^^^ required by this bound in `bar` -help: consider specifying the type arguments in the function call - | -LL | let bar = bar::<T, K, Z>(1, ""); - | +++++++++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/inference/infer-binary-operand-behind-reference.rs b/src/test/ui/inference/infer-binary-operand-behind-reference.rs deleted file mode 100644 index 0c0a3171e..000000000 --- a/src/test/ui/inference/infer-binary-operand-behind-reference.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-pass - -fn main() { - // Test that we can infer the type of binary operands when - // references are involved, on various types and operators. - let _: u8 = 0 + 0; - let _: u8 = 0 + &0; - let _: u8 = &0 + 0; - let _: u8 = &0 + &0; - - let _: f32 = 0.0 + 0.0; - let _: f32 = 0.0 + &0.0; - let _: f32 = &0.0 + 0.0; - let _: f32 = &0.0 + &0.0; - - let _: u8 = 0 << 0; - let _: u8 = 0 << &0; - let _: u8 = &0 << 0; - let _: u8 = &0 << &0; - - // Test type inference when variable types are indirectly inferred. - let a = 22; - let _: usize = a + &44; - - // When we have no expected type, the types of the operands is the default type. - let _ = 0 + 0; - let _ = 0 + &0; - let _ = &0 + 0; - let _ = &0 + &0; -} diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs deleted file mode 100644 index 6662e46b1..000000000 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass - -// tests that the following code compiles, but produces a future-compatibility warning - -fn main() { - let data = std::ptr::null(); - let _ = &data as *const *const (); - if data.is_null() {} - //~^ WARNING type annotations needed - //~| WARNING this is accepted in the current edition -} diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr deleted file mode 100644 index 3dea09e7f..000000000 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: type annotations needed - --> $DIR/inference-variable-behind-raw-pointer.rs:8:13 - | -LL | if data.is_null() {} - | ^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! - = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906> - = note: `#[warn(tyvar_behind_raw_pointer)]` on by default - -warning: 1 warning emitted - diff --git a/src/test/ui/inference/inference_unstable.rs b/src/test/ui/inference/inference_unstable.rs deleted file mode 100644 index daf0cf042..000000000 --- a/src/test/ui/inference/inference_unstable.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Ensures #[unstable] functions without opting in the corresponding #![feature] -// will not break inference. - -// aux-build:inference_unstable_iterator.rs -// aux-build:inference_unstable_itertools.rs -// run-pass - -extern crate inference_unstable_iterator; -extern crate inference_unstable_itertools; - -#[allow(unused_imports)] -use inference_unstable_iterator::IpuIterator; -use inference_unstable_itertools::IpuItertools; - -fn main() { - assert_eq!('x'.ipu_flatten(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future -//~| WARN once this associated item is added to the standard library, the ambiguity may cause an - assert_eq!('x'.ipu_by_value_vs_by_ref(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future -//~| WARN once this associated item is added to the standard library, the ambiguity may cause an - assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future -//~| WARN once this associated item is added to the standard library, the ambiguity may cause an - assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1); -//~^ WARN an associated function with this name may be added to the standard library in the future -//~| WARN once this associated item is added to the standard library, the ambiguity may cause an - assert_eq!(char::C, 1); -//~^ WARN an associated constant with this name may be added to the standard library in the future -//~| WARN once this associated item is added to the standard library, the ambiguity may cause an -} diff --git a/src/test/ui/inference/inference_unstable.stderr b/src/test/ui/inference/inference_unstable.stderr deleted file mode 100644 index ecbf2641b..000000000 --- a/src/test/ui/inference/inference_unstable.stderr +++ /dev/null @@ -1,57 +0,0 @@ -warning: an associated function with this name may be added to the standard library in the future - --> $DIR/inference_unstable.rs:16:20 - | -LL | assert_eq!('x'.ipu_flatten(), 1); - | ^^^^^^^^^^^ - | - = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! - = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> - = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten` - = note: `#[warn(unstable_name_collisions)]` on by default - -warning: an associated function with this name may be added to the standard library in the future - --> $DIR/inference_unstable.rs:19:20 - | -LL | assert_eq!('x'.ipu_by_value_vs_by_ref(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! - = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> - = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_value_vs_by_ref(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_value_vs_by_ref` - -warning: an associated function with this name may be added to the standard library in the future - --> $DIR/inference_unstable.rs:22:20 - | -LL | assert_eq!('x'.ipu_by_ref_vs_by_ref_mut(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! - = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> - = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_ref_vs_by_ref_mut(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_ref_vs_by_ref_mut` - -warning: an associated function with this name may be added to the standard library in the future - --> $DIR/inference_unstable.rs:25:40 - | -LL | assert_eq!((&mut 'x' as *mut char).ipu_by_mut_ptr_vs_by_const_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! - = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> - = help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_by_mut_ptr_vs_by_const_ptr(...)` to keep using the current method - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_by_mut_ptr_vs_by_const_ptr` - -warning: an associated constant with this name may be added to the standard library in the future - --> $DIR/inference_unstable.rs:28:16 - | -LL | assert_eq!(char::C, 1); - | ^^^^^^^ help: use the fully qualified path to the associated const: `<char as IpuItertools>::C` - | - = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior! - = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> - = help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C` - -warning: 5 warnings emitted - diff --git a/src/test/ui/inference/inference_unstable_featured.rs b/src/test/ui/inference/inference_unstable_featured.rs deleted file mode 100644 index 792b29aaa..000000000 --- a/src/test/ui/inference/inference_unstable_featured.rs +++ /dev/null @@ -1,17 +0,0 @@ -// There should be E0034 "multiple applicable items in scope" if we opt-in for -// the feature. - -// aux-build:inference_unstable_iterator.rs -// aux-build:inference_unstable_itertools.rs - -#![feature(ipu_flatten)] - -extern crate inference_unstable_iterator; -extern crate inference_unstable_itertools; - -use inference_unstable_iterator::IpuIterator; -use inference_unstable_itertools::IpuItertools; - -fn main() { - assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0034 -} diff --git a/src/test/ui/inference/inference_unstable_featured.stderr b/src/test/ui/inference/inference_unstable_featured.stderr deleted file mode 100644 index 4ddede29c..000000000 --- a/src/test/ui/inference/inference_unstable_featured.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0034]: multiple applicable items in scope - --> $DIR/inference_unstable_featured.rs:16:20 - | -LL | assert_eq!('x'.ipu_flatten(), 0); - | ^^^^^^^^^^^ multiple `ipu_flatten` found - | - = note: candidate #1 is defined in an impl of the trait `IpuIterator` for the type `char` - = note: candidate #2 is defined in an impl of the trait `IpuItertools` for the type `char` -help: disambiguate the associated function for candidate #1 - | -LL | assert_eq!(IpuIterator::ipu_flatten(&'x'), 0); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: disambiguate the associated function for candidate #2 - | -LL | assert_eq!(IpuItertools::ipu_flatten(&'x'), 0); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0034`. diff --git a/src/test/ui/inference/inference_unstable_forced.rs b/src/test/ui/inference/inference_unstable_forced.rs deleted file mode 100644 index 649b3ed2a..000000000 --- a/src/test/ui/inference/inference_unstable_forced.rs +++ /dev/null @@ -1,12 +0,0 @@ -// If the unstable API is the only possible solution, -// still emit E0658 "use of unstable library feature". - -// aux-build:inference_unstable_iterator.rs - -extern crate inference_unstable_iterator; - -use inference_unstable_iterator::IpuIterator; - -fn main() { - assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0658 -} diff --git a/src/test/ui/inference/inference_unstable_forced.stderr b/src/test/ui/inference/inference_unstable_forced.stderr deleted file mode 100644 index a1c4cd851..000000000 --- a/src/test/ui/inference/inference_unstable_forced.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: use of unstable library feature 'ipu_flatten' - --> $DIR/inference_unstable_forced.rs:11:20 - | -LL | assert_eq!('x'.ipu_flatten(), 0); - | ^^^^^^^^^^^ - | - = note: see issue #99999 <https://github.com/rust-lang/rust/issues/99999> for more information - = help: add `#![feature(ipu_flatten)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/inference/issue-103587.rs b/src/test/ui/inference/issue-103587.rs deleted file mode 100644 index 11536f9f4..000000000 --- a/src/test/ui/inference/issue-103587.rs +++ /dev/null @@ -1,12 +0,0 @@ -fn main() { - let x = Some(123); - - if let Some(_) == x {} - //~^ ERROR expected `=`, found `==` - - if Some(_) = x {} - //~^ ERROR mismatched types - - if None = x { } - //~^ ERROR mismatched types -} diff --git a/src/test/ui/inference/issue-103587.stderr b/src/test/ui/inference/issue-103587.stderr deleted file mode 100644 index b373fbfbb..000000000 --- a/src/test/ui/inference/issue-103587.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error: expected `=`, found `==` - --> $DIR/issue-103587.rs:4:20 - | -LL | if let Some(_) == x {} - | ^^ - | -help: consider using `=` here - | -LL | if let Some(_) = x {} - | ~ - -error[E0308]: mismatched types - --> $DIR/issue-103587.rs:7:8 - | -LL | if Some(_) = x {} - | ^^^^^^^^^^^ expected `bool`, found `()` - | -help: consider adding `let` - | -LL | if let Some(_) = x {} - | +++ - -error[E0308]: mismatched types - --> $DIR/issue-103587.rs:10:8 - | -LL | if None = x { } - | ^^^^^^^^ expected `bool`, found `()` - | -help: you might have meant to use pattern matching - | -LL | if let None = x { } - | +++ -help: you might have meant to compare for equality - | -LL | if None == x { } - | + - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/issue-104649.rs b/src/test/ui/inference/issue-104649.rs deleted file mode 100644 index 4637b884d..000000000 --- a/src/test/ui/inference/issue-104649.rs +++ /dev/null @@ -1,32 +0,0 @@ -type Result<T, E = Error> = ::std::result::Result<T, E>; -struct Error; - -trait ForEach { - type Input; - fn for_each<F, U>(self, f: F) - where - F: FnOnce(Self::Input) -> U; -} - -impl<T> ForEach for A<T> { - type Input = T; - fn for_each<F, U>(self, f: F) - where - F: FnOnce(Self::Input) -> U, - { - todo!() - } -} - -struct A<T>(T); - -fn main() { - let a = A(Result::Ok(Result::Ok(()))); //~ ERROR type annotations needed - a.for_each(|a: Result<_>| { - let f = || match a { - Ok(Ok(a)) => {} - Ok(Err(a)) => {} - Err(a) => {} - }; - }); -} diff --git a/src/test/ui/inference/issue-104649.stderr b/src/test/ui/inference/issue-104649.stderr deleted file mode 100644 index 4962b21f9..000000000 --- a/src/test/ui/inference/issue-104649.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed for `A<std::result::Result<std::result::Result<(), E>, Error>>` - --> $DIR/issue-104649.rs:24:9 - | -LL | let a = A(Result::Ok(Result::Ok(()))); - | ^ - | -help: consider giving `a` an explicit type, where the type for type parameter `E` is specified - | -LL | let a: A<std::result::Result<std::result::Result<(), E>, Error>> = A(Result::Ok(Result::Ok(()))); - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/issue-28935.rs b/src/test/ui/inference/issue-28935.rs deleted file mode 100644 index 872822dbd..000000000 --- a/src/test/ui/inference/issue-28935.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass - -use std::cell::RefCell; - -pub fn f(v: Vec<RefCell<u8>>) { - let _t = &mut *v[0].borrow_mut(); -} - -fn main() {} diff --git a/src/test/ui/inference/issue-36053.rs b/src/test/ui/inference/issue-36053.rs deleted file mode 100644 index 5c6d07804..000000000 --- a/src/test/ui/inference/issue-36053.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass -// Regression test for #36053. ICE was caused due to obligations being -// added to a special, dedicated fulfillment cx during a -// probe. Problem seems to be related to the particular definition of -// `FusedIterator` in std but I was not able to isolate that into an -// external crate. - -use std::iter::FusedIterator; - -struct Thing<'a>(#[allow(unused_tuple_struct_fields)] &'a str); -impl<'a> Iterator for Thing<'a> { - type Item = &'a str; - fn next(&mut self) -> Option<&'a str> { - None - } -} - -impl<'a> FusedIterator for Thing<'a> {} - -fn main() { - Thing("test").fuse().filter(|_| true).count(); -} diff --git a/src/test/ui/inference/issue-70703.rs b/src/test/ui/inference/issue-70703.rs deleted file mode 100644 index d90498e96..000000000 --- a/src/test/ui/inference/issue-70703.rs +++ /dev/null @@ -1,26 +0,0 @@ -// check-pass - -trait Factory { - type Product; -} - -impl Factory for () { - type Product = (); -} - -trait ProductConsumer<P> { - fn consume(self, product: P); -} - -impl<P> ProductConsumer<P> for () { - fn consume(self, _: P) {} -} - -fn make_product_consumer<F: Factory>(_: F) -> impl ProductConsumer<F::Product> { - () -} - -fn main() { - let consumer = make_product_consumer(()); - consumer.consume(()); -} diff --git a/src/test/ui/inference/issue-71309.rs b/src/test/ui/inference/issue-71309.rs deleted file mode 100644 index c31107d8f..000000000 --- a/src/test/ui/inference/issue-71309.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn foo(x: Result<i32, ()>) -> Result<(), ()> { - let y: u32 = x?; - //~^ ERROR: `?` operator has incompatible types - Ok(()) -} - -fn main() {} diff --git a/src/test/ui/inference/issue-71309.stderr b/src/test/ui/inference/issue-71309.stderr deleted file mode 100644 index af8714f1c..000000000 --- a/src/test/ui/inference/issue-71309.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0308]: `?` operator has incompatible types - --> $DIR/issue-71309.rs:2:18 - | -LL | let y: u32 = x?; - | ^^ expected `u32`, found `i32` - | - = note: `?` operator cannot convert from `i32` to `u32` -help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit - | -LL | let y: u32 = x?.try_into().unwrap(); - | ++++++++++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/issue-71732.rs b/src/test/ui/inference/issue-71732.rs deleted file mode 100644 index 8a9d2b235..000000000 --- a/src/test/ui/inference/issue-71732.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Regression test for #71732, it used to emit incorrect diagnostics, like: -// error[E0283]: type annotations needed -// --> src/main.rs:5:10 -// | -// 5 | .get(&"key".into()) -// | ^^^ cannot infer type for struct `String` -// | -// = note: cannot satisfy `String: Borrow<_>` -// help: consider specifying the type argument in the method call -// | -// 5 | .get::<Q>(&"key".into()) -// | - -use std::collections::hash_map::HashMap; - -fn foo(parameters: &HashMap<String, String>) -> bool { - parameters - .get(&"key".into()) - //~^ ERROR type annotations needed - .and_then(|found: &String| Some(false)) - .unwrap_or(false) -} - -fn main() {} diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr deleted file mode 100644 index 79bee3328..000000000 --- a/src/test/ui/inference/issue-71732.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0283]: type annotations needed - --> $DIR/issue-71732.rs:18:10 - | -LL | .get(&"key".into()) - | ^^^ ------------- type must be known at this point - | | - | cannot infer type of the type parameter `Q` declared on the associated function `get` - | - = note: multiple `impl`s satisfying `String: Borrow<_>` found in the following crates: `alloc`, `core`: - - impl Borrow<str> for String; - - impl<T> Borrow<T> for T - where T: ?Sized; -note: required by a bound in `HashMap::<K, V, S>::get` - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | K: Borrow<Q>, - | ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` -help: consider specifying the generic argument - | -LL | .get::<Q>(&"key".into()) - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/inference/issue-72616.rs b/src/test/ui/inference/issue-72616.rs deleted file mode 100644 index 69ade1a75..000000000 --- a/src/test/ui/inference/issue-72616.rs +++ /dev/null @@ -1,32 +0,0 @@ -// ignore-wasm32 FIXME: ignoring wasm as it suggests slightly different impls - -// Regression test for #72616, it used to emit incorrect diagnostics, like: -// error[E0283]: type annotations needed for `String` -// --> src/main.rs:8:30 -// | -// 5 | let _: String = "".to_owned().try_into().unwrap(); -// | - consider giving this pattern a type -// ... -// 8 | if String::from("a") == "a".try_into().unwrap() {} -// | ^^ cannot infer type for struct `String` -// | -// = note: cannot satisfy `String: PartialEq<_>` - -use std::convert::TryInto; - -pub fn main() { - { - let _: String = "".to_owned().try_into().unwrap(); - } - { - if String::from("a") == "a".try_into().unwrap() {} - //~^ ERROR type annotations needed - //~| ERROR type annotations needed - } - { - let _: String = match "_".try_into() { - Ok(a) => a, - Err(_) => "".into(), - }; - } -} diff --git a/src/test/ui/inference/issue-72616.stderr b/src/test/ui/inference/issue-72616.stderr deleted file mode 100644 index 6ee0626ca..000000000 --- a/src/test/ui/inference/issue-72616.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0283]: type annotations needed - --> $DIR/issue-72616.rs:22:37 - | -LL | if String::from("a") == "a".try_into().unwrap() {} - | -- ^^^^^^^^ - | | - | type must be known at this point - | - = note: multiple `impl`s satisfying `String: PartialEq<_>` found in the `alloc` crate: - - impl PartialEq for String; - - impl<'a, 'b> PartialEq<&'a str> for String; - - impl<'a, 'b> PartialEq<Cow<'a, str>> for String; - - impl<'a, 'b> PartialEq<str> for String; -help: try using a fully qualified path to specify the expected types - | -LL | if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {} - | +++++++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed - --> $DIR/issue-72616.rs:22:37 - | -LL | if String::from("a") == "a".try_into().unwrap() {} - | ^^^^^^^^ - | - = note: multiple `impl`s satisfying `_: TryFrom<&str>` found in the following crates: `core`, `std`: - - impl<> TryFrom<&str> for std::sys_common::net::LookupHost; - - impl<T, U> TryFrom<U> for T - where U: Into<T>; - = note: required for `&str` to implement `TryInto<_>` -help: try using a fully qualified path to specify the expected types - | -LL | if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {} - | +++++++++++++++++++++++++++++++ ~ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/inference/issue-72690.rs b/src/test/ui/inference/issue-72690.rs deleted file mode 100644 index 8c0a0f51a..000000000 --- a/src/test/ui/inference/issue-72690.rs +++ /dev/null @@ -1,70 +0,0 @@ -fn no_err() { - |x: String| x; - let _ = String::from("x"); -} - -fn err() { - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed -} - -fn arg_pat_closure_err() { - |x| String::from("x".as_ref()); //~ ERROR type annotations needed - //~| ERROR type annotations needed -} - -fn local_pat_closure_err() { - let _ = "x".as_ref(); //~ ERROR type annotations needed -} - -fn err_first_arg_pat() { - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed - |x: String| x; -} - -fn err_second_arg_pat() { - |x: String| x; - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed -} - -fn err_mid_arg_pat() { - |x: String| x; - |x: String| x; - |x: String| x; - |x: String| x; - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed - |x: String| x; - |x: String| x; - |x: String| x; - |x: String| x; -} - -fn err_first_local_pat() { - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed - let _ = String::from("x"); -} - -fn err_second_local_pat() { - let _ = String::from("x"); - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed -} - -fn err_mid_local_pat() { - let _ = String::from("x"); - let _ = String::from("x"); - let _ = String::from("x"); - let _ = String::from("x"); - String::from("x".as_ref()); //~ ERROR type annotations needed - //~^ ERROR type annotations needed - let _ = String::from("x"); - let _ = String::from("x"); - let _ = String::from("x"); - let _ = String::from("x"); -} - -fn main() {} diff --git a/src/test/ui/inference/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr deleted file mode 100644 index d4eeda073..000000000 --- a/src/test/ui/inference/issue-72690.stderr +++ /dev/null @@ -1,229 +0,0 @@ -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:7:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:7:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0282]: type annotations needed - --> $DIR/issue-72690.rs:12:6 - | -LL | |x| String::from("x".as_ref()); - | ^ - | -help: consider giving this closure parameter an explicit type - | -LL | |x: _| String::from("x".as_ref()); - | +++ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:12:26 - | -LL | |x| String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | |x| String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed for `&T` - --> $DIR/issue-72690.rs:17:9 - | -LL | let _ = "x".as_ref(); - | ^ ------ type must be known at this point - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: consider giving this pattern a type, where the type for type parameter `T` is specified - | -LL | let _: &T = "x".as_ref(); - | ++++ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:21:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:21:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:28:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:28:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:37:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:37:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:46:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:46:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:53:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:53:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:62:5 - | -LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for reference `&_` - | - = note: multiple `impl`s satisfying `String: From<&_>` found in the `alloc` crate: - - impl<> From<&String> for String; - - impl<> From<&str> for String; - -error[E0283]: type annotations needed - --> $DIR/issue-72690.rs:62:22 - | -LL | String::from("x".as_ref()); - | ^^^^^^ - | - = note: multiple `impl`s satisfying `str: AsRef<_>` found in the following crates: `core`, `std`: - - impl AsRef<OsStr> for str; - - impl AsRef<Path> for str; - - impl AsRef<[u8]> for str; - - impl AsRef<str> for str; -help: try using a fully qualified path to specify the expected types - | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ - -error: aborting due to 17 previous errors - -Some errors have detailed explanations: E0282, E0283. -For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/issue-81522.rs b/src/test/ui/inference/issue-81522.rs deleted file mode 100644 index 902f8fdde..000000000 --- a/src/test/ui/inference/issue-81522.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Regression test for #81522. -// Ensures that `#[allow(unstable_name_collisions)]` appended to things other than function -// suppresses the corresponding diagnostics emitted from inside them. -// But note that this attribute doesn't work for macro invocations if it is appended directly. - -// aux-build:inference_unstable_iterator.rs -// aux-build:inference_unstable_itertools.rs -// run-pass - -extern crate inference_unstable_iterator; -extern crate inference_unstable_itertools; - -#[allow(unused_imports)] -use inference_unstable_iterator::IpuIterator; -use inference_unstable_itertools::IpuItertools; - -fn main() { - // expression statement - #[allow(unstable_name_collisions)] - 'x'.ipu_flatten(); - - // let statement - #[allow(unstable_name_collisions)] - let _ = 'x'.ipu_flatten(); - - // block expression - #[allow(unstable_name_collisions)] - { - 'x'.ipu_flatten(); - } -} diff --git a/src/test/ui/inference/issue-83606.rs b/src/test/ui/inference/issue-83606.rs deleted file mode 100644 index eaaef3463..000000000 --- a/src/test/ui/inference/issue-83606.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Regression test for #83606. - -fn foo<const N: usize>(_: impl std::fmt::Display) -> [usize; N] { - [0; N] -} - -fn main() { - let _ = foo("foo"); - //~^ ERROR: type annotations needed for `[usize; _]` -} diff --git a/src/test/ui/inference/issue-83606.stderr b/src/test/ui/inference/issue-83606.stderr deleted file mode 100644 index f5c84f960..000000000 --- a/src/test/ui/inference/issue-83606.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed for `[usize; _]` - --> $DIR/issue-83606.rs:8:9 - | -LL | let _ = foo("foo"); - | ^ - | -help: consider giving this pattern a type, where the the value of const parameter `N` is specified - | -LL | let _: [usize; _] = foo("foo"); - | ++++++++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/issue-86162-1.rs b/src/test/ui/inference/issue-86162-1.rs deleted file mode 100644 index 5a547eb38..000000000 --- a/src/test/ui/inference/issue-86162-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Regression test of #86162. - -fn foo(x: impl Clone) {} -fn gen<T>() -> T { todo!() } - -fn main() { - foo(gen()); //<- Do not suggest `foo::<impl Clone>()`! - //~^ ERROR: type annotations needed -} diff --git a/src/test/ui/inference/issue-86162-1.stderr b/src/test/ui/inference/issue-86162-1.stderr deleted file mode 100644 index 4f621b82d..000000000 --- a/src/test/ui/inference/issue-86162-1.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0283]: type annotations needed - --> $DIR/issue-86162-1.rs:7:9 - | -LL | foo(gen()); //<- Do not suggest `foo::<impl Clone>()`! - | --- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` - | | - | required by a bound introduced by this call - | - = note: cannot satisfy `_: Clone` -note: required by a bound in `foo` - --> $DIR/issue-86162-1.rs:3:16 - | -LL | fn foo(x: impl Clone) {} - | ^^^^^ required by this bound in `foo` -help: consider specifying the generic argument - | -LL | foo(gen::<T>()); //<- Do not suggest `foo::<impl Clone>()`! - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/inference/issue-86162-2.rs b/src/test/ui/inference/issue-86162-2.rs deleted file mode 100644 index b8c75dd77..000000000 --- a/src/test/ui/inference/issue-86162-2.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Regression test of #86162. - -fn gen<T>() -> T { todo!() } - -struct Foo; - -impl Foo { - fn bar(x: impl Clone) {} -} - -fn main() { - Foo::bar(gen()); //<- Do not suggest `Foo::bar::<impl Clone>()`! - //~^ ERROR: type annotations needed -} diff --git a/src/test/ui/inference/issue-86162-2.stderr b/src/test/ui/inference/issue-86162-2.stderr deleted file mode 100644 index 9aff2cec1..000000000 --- a/src/test/ui/inference/issue-86162-2.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0283]: type annotations needed - --> $DIR/issue-86162-2.rs:12:14 - | -LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::<impl Clone>()`! - | -------- ^^^ cannot infer type of the type parameter `T` declared on the function `gen` - | | - | required by a bound introduced by this call - | - = note: cannot satisfy `_: Clone` -note: required by a bound in `Foo::bar` - --> $DIR/issue-86162-2.rs:8:20 - | -LL | fn bar(x: impl Clone) {} - | ^^^^^ required by this bound in `Foo::bar` -help: consider specifying the generic argument - | -LL | Foo::bar(gen::<T>()); //<- Do not suggest `Foo::bar::<impl Clone>()`! - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/inference/lub-glb-with-unbound-infer-var.rs b/src/test/ui/inference/lub-glb-with-unbound-infer-var.rs deleted file mode 100644 index c9e117089..000000000 --- a/src/test/ui/inference/lub-glb-with-unbound-infer-var.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-pass -// Test for a specific corner case: when we compute the LUB of two fn -// types and their parameters have unbound variables. In that case, we -// wind up relating those two variables. This was causing an ICE in an -// in-progress PR. - -fn main() { - let a_f: fn(_) = |_| (); - let b_f: fn(_) = |_| (); - let c_f = match 22 { - 0 => a_f, - _ => b_f, - }; - c_f(4); -} diff --git a/src/test/ui/inference/need_type_info/channel.rs b/src/test/ui/inference/need_type_info/channel.rs deleted file mode 100644 index e2ba5a941..000000000 --- a/src/test/ui/inference/need_type_info/channel.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Test that we suggest specifying the generic argument of `channel` -// instead of the return type of that function, which is a lot more -// complex. -use std::sync::mpsc::channel; - -fn no_tuple() { - let _data = - channel(); //~ ERROR type annotations needed -} - -fn tuple() { - let (_sender, _receiver) = - channel(); //~ ERROR type annotations needed -} - -fn main() { - no_tuple(); - tuple(); -} diff --git a/src/test/ui/inference/need_type_info/channel.stderr b/src/test/ui/inference/need_type_info/channel.stderr deleted file mode 100644 index e33ace033..000000000 --- a/src/test/ui/inference/need_type_info/channel.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/channel.rs:8:9 - | -LL | channel(); - | ^^^^^^^ cannot infer type of the type parameter `T` declared on the function `channel` - | -help: consider specifying the generic argument - | -LL | channel::<T>(); - | +++++ - -error[E0282]: type annotations needed - --> $DIR/channel.rs:13:9 - | -LL | channel(); - | ^^^^^^^ cannot infer type of the type parameter `T` declared on the function `channel` - | -help: consider specifying the generic argument - | -LL | channel::<T>(); - | +++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/concrete-impl.rs b/src/test/ui/inference/need_type_info/concrete-impl.rs deleted file mode 100644 index 72e0e74f3..000000000 --- a/src/test/ui/inference/need_type_info/concrete-impl.rs +++ /dev/null @@ -1,16 +0,0 @@ -trait Ambiguous<A> { - fn method() {} -} - -struct One; -struct Two; -struct Struct; - -impl Ambiguous<One> for Struct {} -impl Ambiguous<Two> for Struct {} - -fn main() { - <Struct as Ambiguous<_>>::method(); - //~^ ERROR type annotations needed - //~| ERROR type annotations needed -} diff --git a/src/test/ui/inference/need_type_info/concrete-impl.stderr b/src/test/ui/inference/need_type_info/concrete-impl.stderr deleted file mode 100644 index aa3296995..000000000 --- a/src/test/ui/inference/need_type_info/concrete-impl.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/concrete-impl.rs:13:5 - | -LL | <Struct as Ambiguous<_>>::method(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` - -error[E0283]: type annotations needed - --> $DIR/concrete-impl.rs:13:5 - | -LL | <Struct as Ambiguous<_>>::method(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` - | -note: multiple `impl`s satisfying `Struct: Ambiguous<_>` found - --> $DIR/concrete-impl.rs:9:1 - | -LL | impl Ambiguous<One> for Struct {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | impl Ambiguous<Two> for Struct {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0282, E0283. -For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.rs b/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.rs deleted file mode 100644 index 3084f6eac..000000000 --- a/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.rs +++ /dev/null @@ -1,11 +0,0 @@ -enum OhNo<T, U> { - A(T), - B(U), - C, -} - -fn uwu() { - OhNo::C::<u32, _>; //~ ERROR type annotations needed -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.stderr b/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.stderr deleted file mode 100644 index 2ad35ab03..000000000 --- a/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/do-not-suggest-generic-arguments-for-turbofish.rs:8:5 - | -LL | OhNo::C::<u32, _>; - | ^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `U` declared on the enum `OhNo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.rs deleted file mode 100644 index 42af9fa8d..000000000 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.rs +++ /dev/null @@ -1,21 +0,0 @@ -trait Foo { - type Output; - - fn baz() -> Self::Output; -} - -fn needs_infer<T>() {} - -enum Bar { - Variant {} -} - -impl Foo for u8 { - type Output = Bar; - fn baz() -> Self::Output { - needs_infer(); //~ ERROR type annotations needed - Self::Output::Variant {} - } -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.stderr deleted file mode 100644 index 68ecb3813..000000000 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative-enum.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/expr-struct-type-relative-enum.rs:16:9 - | -LL | needs_infer(); - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `needs_infer` - | -help: consider specifying the generic argument - | -LL | needs_infer::<T>(); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs deleted file mode 100644 index b0c0d3397..000000000 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.rs +++ /dev/null @@ -1,19 +0,0 @@ -trait Foo { - type Output<T>; - - fn baz(); -} - -enum Bar<T> { - Simple {}, - Generic(T), -} - -impl Foo for u8 { - type Output<T> = Bar<T>; - fn baz() { - Self::Output::Simple {}; //~ ERROR type annotations needed - } -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr deleted file mode 100644 index cbc2477de..000000000 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative-gat.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/expr-struct-type-relative-gat.rs:15:9 - | -LL | Self::Output::Simple {}; - | ^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the associated type `Output` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative.rs b/src/test/ui/inference/need_type_info/expr-struct-type-relative.rs deleted file mode 100644 index c3ece2b16..000000000 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative.rs +++ /dev/null @@ -1,21 +0,0 @@ -// regression test for #98598 - -trait Foo { - type Output; - - fn baz() -> Self::Output; -} - -fn needs_infer<T>() {} - -struct Bar {} - -impl Foo for u8 { - type Output = Bar; - fn baz() -> Self::Output { - needs_infer(); //~ ERROR type annotations needed - Self::Output {} - } -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/expr-struct-type-relative.stderr b/src/test/ui/inference/need_type_info/expr-struct-type-relative.stderr deleted file mode 100644 index 397d8e7be..000000000 --- a/src/test/ui/inference/need_type_info/expr-struct-type-relative.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/expr-struct-type-relative.rs:16:9 - | -LL | needs_infer(); - | ^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `needs_infer` - | -help: consider specifying the generic argument - | -LL | needs_infer::<T>(); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/issue-103053.rs b/src/test/ui/inference/need_type_info/issue-103053.rs deleted file mode 100644 index 05169666f..000000000 --- a/src/test/ui/inference/need_type_info/issue-103053.rs +++ /dev/null @@ -1,18 +0,0 @@ -trait TypeMapper { - type MapType; -} - -type Mapped<T> = <T as TypeMapper>::MapType; - -struct Test {} - -impl TypeMapper for () { - type MapType = Test; -} - -fn test() { - Mapped::<()> {}; - None; //~ ERROR type annotations needed -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/issue-103053.stderr b/src/test/ui/inference/need_type_info/issue-103053.stderr deleted file mode 100644 index 84f0475d8..000000000 --- a/src/test/ui/inference/need_type_info/issue-103053.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/issue-103053.rs:15:5 - | -LL | None; - | ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option` - | -help: consider specifying the generic argument - | -LL | None::<T>; - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/self-ty-in-path.rs b/src/test/ui/inference/need_type_info/self-ty-in-path.rs deleted file mode 100644 index 768a8cc37..000000000 --- a/src/test/ui/inference/need_type_info/self-ty-in-path.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Test that we don't ICE when encountering a `Self` in a path. -struct TestErr<T>(T); - -impl<T> TestErr<T> { - fn func_a<U>() {} - - fn func_b() { - Self::func_a(); - //~^ ERROR type annotations needed - } -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/self-ty-in-path.stderr b/src/test/ui/inference/need_type_info/self-ty-in-path.stderr deleted file mode 100644 index 04b521dbd..000000000 --- a/src/test/ui/inference/need_type_info/self-ty-in-path.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/self-ty-in-path.rs:8:9 - | -LL | Self::func_a(); - | ^^^^^^^^^^^^ cannot infer type of the type parameter `U` declared on the associated function `func_a` - | -help: consider specifying the generic argument - | -LL | Self::func_a::<U>(); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/type-alias-indirect.rs b/src/test/ui/inference/need_type_info/type-alias-indirect.rs deleted file mode 100644 index 0ed02ddc5..000000000 --- a/src/test/ui/inference/need_type_info/type-alias-indirect.rs +++ /dev/null @@ -1,18 +0,0 @@ -// An addition to the `type-alias.rs` test, -// see the FIXME in that file for why this test -// exists. -// -// If there is none, feel free to remove this test -// again. -struct Ty<T>(T); -impl<T> Ty<T> { - fn new() {} -} - -type IndirectAlias<T> = Ty<Box<T>>; -fn indirect_alias() { - IndirectAlias::new(); - //~^ ERROR type annotations needed -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/type-alias-indirect.stderr b/src/test/ui/inference/need_type_info/type-alias-indirect.stderr deleted file mode 100644 index 6161690df..000000000 --- a/src/test/ui/inference/need_type_info/type-alias-indirect.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/type-alias-indirect.rs:14:5 - | -LL | IndirectAlias::new(); - | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the type alias `IndirectAlias` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/need_type_info/type-alias.rs b/src/test/ui/inference/need_type_info/type-alias.rs deleted file mode 100644 index f921b046b..000000000 --- a/src/test/ui/inference/need_type_info/type-alias.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Test the inference errors in case the relevant path -// uses a type alias. -// -// Regression test for #97698. -struct Ty<T>(T); -impl<T> Ty<T> { - fn new() {} -} - -type DirectAlias<T> = Ty<T>; -fn direct_alias() { - DirectAlias::new() - //~^ ERROR type annotations needed -} - -type IndirectAlias<T> = Ty<Box<T>>; -fn indirect_alias() { - IndirectAlias::new(); - // FIXME: This should also emit an error. - // - // Added it separately as `type-alias-indirect.rs` - // where it does error. -} - -struct TyDefault<T, U = u32>(T, U); -impl<T> TyDefault<T> { - fn new() {} -} - -type DirectButWithDefaultAlias<T> = TyDefault<T>; -fn direct_but_with_default_alias() { - DirectButWithDefaultAlias::new(); - //~^ ERROR type annotations needed -} - -fn main() {} diff --git a/src/test/ui/inference/need_type_info/type-alias.stderr b/src/test/ui/inference/need_type_info/type-alias.stderr deleted file mode 100644 index a33f49baf..000000000 --- a/src/test/ui/inference/need_type_info/type-alias.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/type-alias.rs:12:5 - | -LL | DirectAlias::new() - | ^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` - -error[E0282]: type annotations needed - --> $DIR/type-alias.rs:32:5 - | -LL | DirectButWithDefaultAlias::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/newlambdas-ret-infer.rs b/src/test/ui/inference/newlambdas-ret-infer.rs deleted file mode 100644 index 9b629838f..000000000 --- a/src/test/ui/inference/newlambdas-ret-infer.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// Test that the lambda kind is inferred correctly as a return -// expression - -// pretty-expanded FIXME #23616 - -fn unique() -> Box<dyn FnMut()+'static> { return Box::new(|| ()); } - -pub fn main() { -} diff --git a/src/test/ui/inference/newlambdas-ret-infer2.rs b/src/test/ui/inference/newlambdas-ret-infer2.rs deleted file mode 100644 index abe31a05f..000000000 --- a/src/test/ui/inference/newlambdas-ret-infer2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass - -#![allow(dead_code)] -// Test that the lambda kind is inferred correctly as a return -// expression - -// pretty-expanded FIXME #23616 - -fn unique() -> Box<dyn FnMut()+'static> { Box::new(|| ()) } - -pub fn main() { -} diff --git a/src/test/ui/inference/question-mark-type-infer.rs b/src/test/ui/inference/question-mark-type-infer.rs deleted file mode 100644 index 10560f85e..000000000 --- a/src/test/ui/inference/question-mark-type-infer.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Test that type inference fails where there are multiple possible return types -// for the `?` operator. - -fn f(x: &i32) -> Result<i32, ()> { - Ok(*x) -} - -fn g() -> Result<Vec<i32>, ()> { - let l = [1, 2, 3, 4]; - l.iter().map(f).collect()? - //~^ ERROR type annotations needed -} - -fn main() { - g(); -} diff --git a/src/test/ui/inference/question-mark-type-infer.stderr b/src/test/ui/inference/question-mark-type-infer.stderr deleted file mode 100644 index 9b822714f..000000000 --- a/src/test/ui/inference/question-mark-type-infer.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0282]: type annotations needed - --> $DIR/question-mark-type-infer.rs:10:30 - | -LL | l.iter().map(f).collect()? - | ^ cannot infer type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/inference/range-type-infer.rs b/src/test/ui/inference/range-type-infer.rs deleted file mode 100644 index f07c04171..000000000 --- a/src/test/ui/inference/range-type-infer.rs +++ /dev/null @@ -1,22 +0,0 @@ -// run-pass - -#![allow(unused_must_use)] -// Make sure the type inference for the new range expression work as -// good as the old one. Check out issue #21672, #21595 and #21649 for -// more details. - - -fn main() { - let xs = (0..8).map(|i| i == 1u64).collect::<Vec<_>>(); - assert_eq!(xs[1], true); - let xs = (0..8).map(|i| 1u64 == i).collect::<Vec<_>>(); - assert_eq!(xs[1], true); - let xs: Vec<u8> = (0..10).collect(); - assert_eq!(xs.len(), 10); - - for x in 0..10 { x % 2; } - for x in 0..100 { x as f32; } - - let array = [true, false]; - for i in 0..1 { array[i]; } -} diff --git a/src/test/ui/inference/simple-infer.rs b/src/test/ui/inference/simple-infer.rs deleted file mode 100644 index 561e4fdec..000000000 --- a/src/test/ui/inference/simple-infer.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass - -#![allow(unused_mut)] - - -pub fn main() { let mut n; n = 1; println!("{}", n); } diff --git a/src/test/ui/inference/str-as-char.fixed b/src/test/ui/inference/str-as-char.fixed deleted file mode 100644 index 6aea809cb..000000000 --- a/src/test/ui/inference/str-as-char.fixed +++ /dev/null @@ -1,10 +0,0 @@ -// When a char literal is used where a str should be, -// suggest changing to double quotes. - -// run-rustfix - -fn main() { - let _: &str = "a"; //~ ERROR mismatched types - let _: &str = "\"\"\""; //~ ERROR character literal may only contain one codepoint - let _: &str = "\"\"\""; //~ ERROR character literal may only contain one codepoint -} diff --git a/src/test/ui/inference/str-as-char.rs b/src/test/ui/inference/str-as-char.rs deleted file mode 100644 index eaa8d788c..000000000 --- a/src/test/ui/inference/str-as-char.rs +++ /dev/null @@ -1,10 +0,0 @@ -// When a char literal is used where a str should be, -// suggest changing to double quotes. - -// run-rustfix - -fn main() { - let _: &str = 'a'; //~ ERROR mismatched types - let _: &str = '"""'; //~ ERROR character literal may only contain one codepoint - let _: &str = '\"\"\"'; //~ ERROR character literal may only contain one codepoint -} diff --git a/src/test/ui/inference/str-as-char.stderr b/src/test/ui/inference/str-as-char.stderr deleted file mode 100644 index 2c84dac8e..000000000 --- a/src/test/ui/inference/str-as-char.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: character literal may only contain one codepoint - --> $DIR/str-as-char.rs:8:19 - | -LL | let _: &str = '"""'; - | ^^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let _: &str = "\"\"\""; - | ~~~~~~~~ - -error: character literal may only contain one codepoint - --> $DIR/str-as-char.rs:9:19 - | -LL | let _: &str = '\"\"\"'; - | ^^^^^^^^ - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let _: &str = "\"\"\""; - | ~~~~~~~~ - -error[E0308]: mismatched types - --> $DIR/str-as-char.rs:7:19 - | -LL | let _: &str = 'a'; - | ---- ^^^ expected `&str`, found `char` - | | - | expected due to this - | -help: if you meant to write a `str` literal, use double quotes - | -LL | let _: &str = "a"; - | ~~~ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/tutorial-suffix-inference-test.rs b/src/test/ui/inference/tutorial-suffix-inference-test.rs deleted file mode 100644 index 849adfd53..000000000 --- a/src/test/ui/inference/tutorial-suffix-inference-test.rs +++ /dev/null @@ -1,24 +0,0 @@ -fn main() { - let x = 3; - let y: i32 = 3; - - fn identity_u8(n: u8) -> u8 { n } - fn identity_u16(n: u16) -> u16 { n } - - identity_u8(x); // after this, `x` is assumed to have type `u8` - identity_u16(x); - //~^ ERROR mismatched types - //~| expected `u16`, found `u8` - identity_u16(y); - //~^ ERROR mismatched types - //~| expected `u16`, found `i32` - - let a = 3; - - fn identity_i(n: isize) -> isize { n } - - identity_i(a); // ok - identity_u16(a); - //~^ ERROR mismatched types - //~| expected `u16`, found `isize` -} diff --git a/src/test/ui/inference/tutorial-suffix-inference-test.stderr b/src/test/ui/inference/tutorial-suffix-inference-test.stderr deleted file mode 100644 index d83a1367d..000000000 --- a/src/test/ui/inference/tutorial-suffix-inference-test.stderr +++ /dev/null @@ -1,57 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:9:18 - | -LL | identity_u16(x); - | ------------ ^ expected `u16`, found `u8` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/tutorial-suffix-inference-test.rs:6:8 - | -LL | fn identity_u16(n: u16) -> u16 { n } - | ^^^^^^^^^^^^ ------ -help: you can convert a `u8` to a `u16` - | -LL | identity_u16(x.into()); - | +++++++ - -error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:12:18 - | -LL | identity_u16(y); - | ------------ ^ expected `u16`, found `i32` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/tutorial-suffix-inference-test.rs:6:8 - | -LL | fn identity_u16(n: u16) -> u16 { n } - | ^^^^^^^^^^^^ ------ -help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit - | -LL | identity_u16(y.try_into().unwrap()); - | ++++++++++++++++++++ - -error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:21:18 - | -LL | identity_u16(a); - | ------------ ^ expected `u16`, found `isize` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/tutorial-suffix-inference-test.rs:6:8 - | -LL | fn identity_u16(n: u16) -> u16 { n } - | ^^^^^^^^^^^^ ------ -help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit - | -LL | identity_u16(a.try_into().unwrap()); - | ++++++++++++++++++++ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inference/type-infer-generalize-ty-var.rs b/src/test/ui/inference/type-infer-generalize-ty-var.rs deleted file mode 100644 index a3d6916cb..000000000 --- a/src/test/ui/inference/type-infer-generalize-ty-var.rs +++ /dev/null @@ -1,56 +0,0 @@ -// run-pass - -#![allow(non_upper_case_globals)] -#![allow(dead_code)] -#![allow(unused_assignments)] -#![allow(unused_variables)] -// Test a scenario where we generate a constraint like `?1 <: &?2`. -// In such a case, it is important that we instantiate `?1` with `&?3` -// where `?3 <: ?2`, and not with `&?2`. This is a regression test for -// #18653. The important thing is that we build. - -use std::cell::RefCell; - -enum Wrap<A> { - WrapSome(A), - WrapNone -} - -use Wrap::*; - -struct T; -struct U; - -trait Get<T: ?Sized> { - fn get(&self) -> &T; -} - -impl Get<dyn MyShow + 'static> for Wrap<T> { - fn get(&self) -> &(dyn MyShow + 'static) { - static x: usize = 42; - &x - } -} - -impl Get<usize> for Wrap<U> { - fn get(&self) -> &usize { - static x: usize = 55; - &x - } -} - -trait MyShow { fn dummy(&self) { } } -impl<'a> MyShow for &'a (dyn MyShow + 'a) { } -impl MyShow for usize { } -fn constrain<'a>(rc: RefCell<&'a (dyn MyShow + 'a)>) { } - -fn main() { - let mut collection: Wrap<_> = WrapNone; - - { - let __arg0 = Get::get(&collection); - let __args_cell = RefCell::new(__arg0); - constrain(__args_cell); - } - collection = WrapSome(T); -} |