summaryrefslogtreecommitdiffstats
path: root/src/test/ui/inference
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/inference')
-rw-r--r--src/test/ui/inference/char-as-str-single.fixed1
-rw-r--r--src/test/ui/inference/char-as-str-single.rs1
-rw-r--r--src/test/ui/inference/char-as-str-single.stderr15
-rw-r--r--src/test/ui/inference/inference-variable-behind-raw-pointer.stderr2
-rw-r--r--src/test/ui/inference/inference_unstable.stderr2
-rw-r--r--src/test/ui/inference/issue-36053.rs22
-rw-r--r--src/test/ui/inference/need_type_info/concrete-impl.stderr9
-rw-r--r--src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.rs11
-rw-r--r--src/test/ui/inference/need_type_info/do-not-suggest-generic-arguments-for-turbofish.stderr9
-rw-r--r--src/test/ui/inference/need_type_info/issue-103053.rs18
-rw-r--r--src/test/ui/inference/need_type_info/issue-103053.stderr14
-rw-r--r--src/test/ui/inference/str-as-char.fixed4
-rw-r--r--src/test/ui/inference/str-as-char.rs4
-rw-r--r--src/test/ui/inference/str-as-char.stderr24
14 files changed, 121 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/inference/issue-36053.rs b/src/test/ui/inference/issue-36053.rs
new file mode 100644
index 000000000..5c6d07804
--- /dev/null
+++ b/src/test/ui/inference/issue-36053.rs
@@ -0,0 +1,22 @@
+// 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/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`.