diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /src/test/ui/inference | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/inference/char-as-str-single.fixed | 1 | ||||
-rw-r--r-- | src/test/ui/inference/char-as-str-single.rs | 1 | ||||
-rw-r--r-- | src/test/ui/inference/char-as-str-single.stderr | 15 | ||||
-rw-r--r-- | src/test/ui/inference/inference-variable-behind-raw-pointer.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/inference/inference_unstable.stderr | 2 | ||||
-rw-r--r-- | src/test/ui/inference/issue-36053.rs (renamed from src/test/ui/issues/issue-36053.rs) | 0 | ||||
-rw-r--r-- | src/test/ui/inference/need_type_info/concrete-impl.stderr | 9 | ||||
-rw-r--r-- | src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.rs | 11 | ||||
-rw-r--r-- | src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.stderr | 9 | ||||
-rw-r--r-- | src/test/ui/inference/need_type_info/issue-103053.rs | 18 | ||||
-rw-r--r-- | src/test/ui/inference/need_type_info/issue-103053.stderr | 14 | ||||
-rw-r--r-- | src/test/ui/inference/str-as-char.fixed | 4 | ||||
-rw-r--r-- | src/test/ui/inference/str-as-char.rs | 4 | ||||
-rw-r--r-- | src/test/ui/inference/str-as-char.stderr | 24 |
14 files changed, 99 insertions, 15 deletions
diff --git a/src/test/ui/inference/char-as-str-single.fixed b/src/test/ui/inference/char-as-str-single.fixed index e401492a8..bab1854dc 100644 --- a/src/test/ui/inference/char-as-str-single.fixed +++ b/src/test/ui/inference/char-as-str-single.fixed @@ -8,4 +8,5 @@ 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 index 4f23cea53..736920643 100644 --- a/src/test/ui/inference/char-as-str-single.rs +++ b/src/test/ui/inference/char-as-str-single.rs @@ -8,4 +8,5 @@ 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 index 29075c154..3375ec6ac 100644 --- a/src/test/ui/inference/char-as-str-single.stderr +++ b/src/test/ui/inference/char-as-str-single.stderr @@ -24,6 +24,19 @@ help: if you meant to write a `char` literal, use single quotes LL | let _: char = '人'; | ~~~~ -error: aborting due to 2 previous errors +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/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr index c38f57912..3dea09e7f 100644 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr +++ b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr @@ -4,9 +4,9 @@ warning: type annotations needed LL | if data.is_null() {} | ^^^^^^^ | - = note: `#[warn(tyvar_behind_raw_pointer)]` on by default = 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.stderr b/src/test/ui/inference/inference_unstable.stderr index df7a09686..ecbf2641b 100644 --- a/src/test/ui/inference/inference_unstable.stderr +++ b/src/test/ui/inference/inference_unstable.stderr @@ -4,11 +4,11 @@ warning: an associated function with this name may be added to the standard libr LL | assert_eq!('x'.ipu_flatten(), 1); | ^^^^^^^^^^^ | - = note: `#[warn(unstable_name_collisions)]` on by default = 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 diff --git a/src/test/ui/issues/issue-36053.rs b/src/test/ui/inference/issue-36053.rs index 5c6d07804..5c6d07804 100644 --- a/src/test/ui/issues/issue-36053.rs +++ b/src/test/ui/inference/issue-36053.rs diff --git a/src/test/ui/inference/need_type_info/concrete-impl.stderr b/src/test/ui/inference/need_type_info/concrete-impl.stderr index b79d34aff..aa3296995 100644 --- a/src/test/ui/inference/need_type_info/concrete-impl.stderr +++ b/src/test/ui/inference/need_type_info/concrete-impl.stderr @@ -3,11 +3,6 @@ error[E0282]: type annotations needed | LL | <Struct as Ambiguous<_>>::method(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `Self` declared on the trait `Ambiguous` - | -help: consider specifying the generic argument - | -LL | <Struct as Ambiguous::<_>>::method(); - | ~~~~~ error[E0283]: type annotations needed --> $DIR/concrete-impl.rs:13:5 @@ -22,10 +17,6 @@ LL | impl Ambiguous<One> for Struct {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | impl Ambiguous<Two> for Struct {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: consider specifying the generic argument - | -LL | <Struct as Ambiguous::<_>>::method(); - | ~~~~~ error: aborting due to 2 previous errors 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 new file mode 100644 index 000000000..3084f6eac --- /dev/null +++ b/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.rs @@ -0,0 +1,11 @@ +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 new file mode 100644 index 000000000..2ad35ab03 --- /dev/null +++ b/src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.stderr @@ -0,0 +1,9 @@ +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/issue-103053.rs b/src/test/ui/inference/need_type_info/issue-103053.rs new file mode 100644 index 000000000..05169666f --- /dev/null +++ b/src/test/ui/inference/need_type_info/issue-103053.rs @@ -0,0 +1,18 @@ +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 new file mode 100644 index 000000000..84f0475d8 --- /dev/null +++ b/src/test/ui/inference/need_type_info/issue-103053.stderr @@ -0,0 +1,14 @@ +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/str-as-char.fixed b/src/test/ui/inference/str-as-char.fixed index 09f3dec5a..6aea809cb 100644 --- a/src/test/ui/inference/str-as-char.fixed +++ b/src/test/ui/inference/str-as-char.fixed @@ -4,5 +4,7 @@ // run-rustfix fn main() { - let _: &str = "a"; //~ ERROR mismatched types + 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 index 7092a6124..eaa8d788c 100644 --- a/src/test/ui/inference/str-as-char.rs +++ b/src/test/ui/inference/str-as-char.rs @@ -4,5 +4,7 @@ // run-rustfix fn main() { - let _: &str = 'a'; //~ ERROR mismatched types + 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 index ebbe7c80f..2c84dac8e 100644 --- a/src/test/ui/inference/str-as-char.stderr +++ b/src/test/ui/inference/str-as-char.stderr @@ -1,3 +1,25 @@ +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 | @@ -11,6 +33,6 @@ help: if you meant to write a `str` literal, use double quotes LL | let _: &str = "a"; | ~~~ -error: aborting due to previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. |