summaryrefslogtreecommitdiffstats
path: root/src/test/ui/typeck
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/typeck')
-rw-r--r--src/test/ui/typeck/assign-non-lval-derefmut.stderr4
-rw-r--r--src/test/ui/typeck/assign-non-lval-mut-ref.stderr4
-rw-r--r--src/test/ui/typeck/assign-non-lval-needs-deref.rs19
-rw-r--r--src/test/ui/typeck/assign-non-lval-needs-deref.stderr16
-rw-r--r--src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs8
-rw-r--r--src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr20
-rw-r--r--src/test/ui/typeck/issue-100164.fixed9
-rw-r--r--src/test/ui/typeck/issue-100164.rs9
-rw-r--r--src/test/ui/typeck/issue-100164.stderr14
-rw-r--r--src/test/ui/typeck/issue-100246.rs30
-rw-r--r--src/test/ui/typeck/issue-100246.stderr13
-rw-r--r--src/test/ui/typeck/issue-100285.rs22
-rw-r--r--src/test/ui/typeck/issue-100285.stderr34
-rw-r--r--src/test/ui/typeck/issue-29124.stderr8
-rw-r--r--src/test/ui/typeck/issue-79040.stderr4
-rw-r--r--src/test/ui/typeck/issue-87181/empty-tuple-method.rs2
-rw-r--r--src/test/ui/typeck/issue-87181/empty-tuple-method.stderr6
-rw-r--r--src/test/ui/typeck/issue-87181/enum-variant.rs2
-rw-r--r--src/test/ui/typeck/issue-87181/enum-variant.stderr6
-rw-r--r--src/test/ui/typeck/issue-87181/tuple-field.stderr10
-rw-r--r--src/test/ui/typeck/issue-87181/tuple-method.stderr9
-rw-r--r--src/test/ui/typeck/issue-90101.stderr2
-rw-r--r--src/test/ui/typeck/issue-91210-ptr-method.stderr9
-rw-r--r--src/test/ui/typeck/issue-91633.rs8
-rw-r--r--src/test/ui/typeck/issue-96738.stderr18
-rw-r--r--src/test/ui/typeck/issue-98982.rs9
-rw-r--r--src/test/ui/typeck/issue-98982.stderr24
-rw-r--r--src/test/ui/typeck/point-at-type-param-in-path-expr.rs6
-rw-r--r--src/test/ui/typeck/point-at-type-param-in-path-expr.stderr17
-rw-r--r--src/test/ui/typeck/remove-extra-argument.stderr2
-rw-r--r--src/test/ui/typeck/struct-enum-wrong-args.stderr16
-rw-r--r--src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr14
-rw-r--r--src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr8
-rw-r--r--src/test/ui/typeck/typeck_type_placeholder_item.stderr4
34 files changed, 308 insertions, 78 deletions
diff --git a/src/test/ui/typeck/assign-non-lval-derefmut.stderr b/src/test/ui/typeck/assign-non-lval-derefmut.stderr
index a6fcdfe21..e394cf820 100644
--- a/src/test/ui/typeck/assign-non-lval-derefmut.stderr
+++ b/src/test/ui/typeck/assign-non-lval-derefmut.stderr
@@ -19,7 +19,7 @@ LL | x.lock().unwrap() += 1;
| |
| cannot use `+=` on type `MutexGuard<'_, usize>`
|
-help: `+=` can be used on `usize`, you can dereference `x.lock().unwrap()`
+help: `+=` can be used on `usize` if you dereference the left-hand side
|
LL | *x.lock().unwrap() += 1;
| +
@@ -47,7 +47,7 @@ LL | y += 1;
| |
| cannot use `+=` on type `MutexGuard<'_, usize>`
|
-help: `+=` can be used on `usize`, you can dereference `y`
+help: `+=` can be used on `usize` if you dereference the left-hand side
|
LL | *y += 1;
| +
diff --git a/src/test/ui/typeck/assign-non-lval-mut-ref.stderr b/src/test/ui/typeck/assign-non-lval-mut-ref.stderr
index be2e9fe95..cbdc960ba 100644
--- a/src/test/ui/typeck/assign-non-lval-mut-ref.stderr
+++ b/src/test/ui/typeck/assign-non-lval-mut-ref.stderr
@@ -19,7 +19,7 @@ LL | x.last_mut().unwrap() += 1;
| |
| cannot use `+=` on type `&mut usize`
|
-help: `+=` can be used on `usize`, you can dereference `x.last_mut().unwrap()`
+help: `+=` can be used on `usize` if you dereference the left-hand side
|
LL | *x.last_mut().unwrap() += 1;
| +
@@ -45,7 +45,7 @@ LL | y += 1;
| |
| cannot use `+=` on type `&mut usize`
|
-help: `+=` can be used on `usize`, you can dereference `y`
+help: `+=` can be used on `usize` if you dereference the left-hand side
|
LL | *y += 1;
| +
diff --git a/src/test/ui/typeck/assign-non-lval-needs-deref.rs b/src/test/ui/typeck/assign-non-lval-needs-deref.rs
new file mode 100644
index 000000000..c979d76b4
--- /dev/null
+++ b/src/test/ui/typeck/assign-non-lval-needs-deref.rs
@@ -0,0 +1,19 @@
+// issue #101376
+
+use std::ops::AddAssign;
+struct Foo;
+
+impl AddAssign<()> for Foo {
+ fn add_assign(&mut self, _: ()) {}
+}
+
+impl AddAssign<()> for &mut Foo {
+ fn add_assign(&mut self, _: ()) {}
+}
+
+fn main() {
+ (&mut Foo) += ();
+ //~^ ERROR invalid left-hand side of assignment
+ //~| NOTE cannot assign to this expression
+ //~| HELP consider dereferencing the left-hand side of this operation
+}
diff --git a/src/test/ui/typeck/assign-non-lval-needs-deref.stderr b/src/test/ui/typeck/assign-non-lval-needs-deref.stderr
new file mode 100644
index 000000000..ee83b1453
--- /dev/null
+++ b/src/test/ui/typeck/assign-non-lval-needs-deref.stderr
@@ -0,0 +1,16 @@
+error[E0067]: invalid left-hand side of assignment
+ --> $DIR/assign-non-lval-needs-deref.rs:15:16
+ |
+LL | (&mut Foo) += ();
+ | ---------- ^^
+ | |
+ | cannot assign to this expression
+ |
+help: consider dereferencing the left-hand side of this operation
+ |
+LL | *(&mut Foo) += ();
+ | +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0067`.
diff --git a/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs
new file mode 100644
index 000000000..97e0b213f
--- /dev/null
+++ b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.rs
@@ -0,0 +1,8 @@
+trait Foo {
+ const A; //~ ERROR missing type for `const` item
+ static B;
+ //~^ ERROR associated `static` items are not allowed
+ //~| ERROR missing type for `static` item
+}
+
+fn main() {}
diff --git a/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr
new file mode 100644
index 000000000..8982d6285
--- /dev/null
+++ b/src/test/ui/typeck/do-not-suggest-placeholder-to-const-static-without-type.stderr
@@ -0,0 +1,20 @@
+error: associated `static` items are not allowed
+ --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:5
+ |
+LL | static B;
+ | ^^^^^^^^^
+
+error: missing type for `const` item
+ --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:2:12
+ |
+LL | const A;
+ | ^ help: provide a type for the item: `: <type>`
+
+error: missing type for `static` item
+ --> $DIR/do-not-suggest-placeholder-to-const-static-without-type.rs:3:13
+ |
+LL | static B;
+ | ^ help: provide a type for the item: `: <type>`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/typeck/issue-100164.fixed b/src/test/ui/typeck/issue-100164.fixed
new file mode 100644
index 000000000..a5f68beb1
--- /dev/null
+++ b/src/test/ui/typeck/issue-100164.fixed
@@ -0,0 +1,9 @@
+// run-rustfix
+
+const _A: i32 = 123;
+//~^ ERROR: missing type for `const` item
+
+fn main() {
+ const _B: i32 = 123;
+ //~^ ERROR: missing type for `const` item
+}
diff --git a/src/test/ui/typeck/issue-100164.rs b/src/test/ui/typeck/issue-100164.rs
new file mode 100644
index 000000000..7efb9ac62
--- /dev/null
+++ b/src/test/ui/typeck/issue-100164.rs
@@ -0,0 +1,9 @@
+// run-rustfix
+
+const _A: = 123;
+//~^ ERROR: missing type for `const` item
+
+fn main() {
+ const _B: = 123;
+ //~^ ERROR: missing type for `const` item
+}
diff --git a/src/test/ui/typeck/issue-100164.stderr b/src/test/ui/typeck/issue-100164.stderr
new file mode 100644
index 000000000..06a132d65
--- /dev/null
+++ b/src/test/ui/typeck/issue-100164.stderr
@@ -0,0 +1,14 @@
+error: missing type for `const` item
+ --> $DIR/issue-100164.rs:3:10
+ |
+LL | const _A: = 123;
+ | ^ help: provide a type for the constant: `i32`
+
+error: missing type for `const` item
+ --> $DIR/issue-100164.rs:7:14
+ |
+LL | const _B: = 123;
+ | ^ help: provide a type for the constant: `i32`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/typeck/issue-100246.rs b/src/test/ui/typeck/issue-100246.rs
new file mode 100644
index 000000000..8f0b34bab
--- /dev/null
+++ b/src/test/ui/typeck/issue-100246.rs
@@ -0,0 +1,30 @@
+#![recursion_limit = "5"] // To reduce noise
+
+//expect incompatible type error when ambiguous traits are in scope
+//and not an overflow error on the span in the main function.
+
+struct Ratio<T>(T);
+
+pub trait Pow {
+ fn pow(self) -> Self;
+}
+
+impl<'a, T> Pow for &'a Ratio<T>
+where
+ &'a T: Pow,
+{
+ fn pow(self) -> Self {
+ self
+ }
+}
+
+fn downcast<'a, W: ?Sized>() -> std::io::Result<&'a W> {
+ todo!()
+}
+
+struct Other;
+
+fn main() -> std::io::Result<()> {
+ let other: Other = downcast()?;//~ERROR 28:24: 28:35: `?` operator has incompatible types
+ Ok(())
+}
diff --git a/src/test/ui/typeck/issue-100246.stderr b/src/test/ui/typeck/issue-100246.stderr
new file mode 100644
index 000000000..8b77de94e
--- /dev/null
+++ b/src/test/ui/typeck/issue-100246.stderr
@@ -0,0 +1,13 @@
+error[E0308]: `?` operator has incompatible types
+ --> $DIR/issue-100246.rs:28:24
+ |
+LL | let other: Other = downcast()?;
+ | ^^^^^^^^^^^ expected struct `Other`, found reference
+ |
+ = note: `?` operator cannot convert from `&_` to `Other`
+ = note: expected struct `Other`
+ found reference `&_`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/typeck/issue-100285.rs b/src/test/ui/typeck/issue-100285.rs
new file mode 100644
index 000000000..e206469b8
--- /dev/null
+++ b/src/test/ui/typeck/issue-100285.rs
@@ -0,0 +1,22 @@
+fn foo(n: i32) -> i32 {
+ for i in 0..0 {
+ //~^ ERROR: mismatched types [E0308]
+ if n < 0 {
+ return i;
+ } else if n < 10 {
+ return 1;
+ } else if n < 20 {
+ return 2;
+ } else if n < 30 {
+ return 3;
+ } else if n < 40 {
+ return 4;
+ } else {
+ return 5;
+ }
+
+ }
+ //~| help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility
+}
+
+fn main() {}
diff --git a/src/test/ui/typeck/issue-100285.stderr b/src/test/ui/typeck/issue-100285.stderr
new file mode 100644
index 000000000..42c64b039
--- /dev/null
+++ b/src/test/ui/typeck/issue-100285.stderr
@@ -0,0 +1,34 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-100285.rs:2:5
+ |
+LL | fn foo(n: i32) -> i32 {
+ | --- expected `i32` because of return type
+LL | / for i in 0..0 {
+LL | |
+LL | | if n < 0 {
+LL | | return i;
+... |
+LL | |
+LL | | }
+ | |_____^ expected `i32`, found `()`
+ |
+note: the function expects a value to always be returned, but loops might run zero times
+ --> $DIR/issue-100285.rs:2:5
+ |
+LL | for i in 0..0 {
+ | ^^^^^^^^^^^^^ this might have zero elements to iterate on
+...
+LL | return i;
+ | -------- if the loop doesn't execute, this value would never get returned
+LL | } else if n < 10 {
+LL | return 1;
+ | -------- if the loop doesn't execute, this value would never get returned
+LL | } else if n < 20 {
+LL | return 2;
+ | -------- if the loop doesn't execute, this value would never get returned
+ = note: if the loop doesn't execute, 3 other values would never get returned
+ = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/typeck/issue-29124.stderr b/src/test/ui/typeck/issue-29124.stderr
index c5d2ec084..a837a7d2d 100644
--- a/src/test/ui/typeck/issue-29124.stderr
+++ b/src/test/ui/typeck/issue-29124.stderr
@@ -2,17 +2,13 @@ error[E0599]: no method named `x` found for fn item `fn() -> Ret {Obj::func}` in
--> $DIR/issue-29124.rs:15:15
|
LL | Obj::func.x();
- | --------- ^ method not found in `fn() -> Ret {Obj::func}`
- | |
- | this is a function, perhaps you wish to call it
+ | ^ method not found in `fn() -> Ret {Obj::func}`
error[E0599]: no method named `x` found for fn item `fn() -> Ret {func}` in the current scope
--> $DIR/issue-29124.rs:17:10
|
LL | func.x();
- | ---- ^ method not found in `fn() -> Ret {func}`
- | |
- | this is a function, perhaps you wish to call it
+ | ^ method not found in `fn() -> Ret {func}`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/typeck/issue-79040.stderr b/src/test/ui/typeck/issue-79040.stderr
index aec2e1ec9..c820d1e08 100644
--- a/src/test/ui/typeck/issue-79040.stderr
+++ b/src/test/ui/typeck/issue-79040.stderr
@@ -7,10 +7,10 @@ LL | const FOO = "hello" + 1;
| &str
error: missing type for `const` item
- --> $DIR/issue-79040.rs:2:11
+ --> $DIR/issue-79040.rs:2:14
|
LL | const FOO = "hello" + 1;
- | ^^^ help: provide a type for the item: `FOO: <type>`
+ | ^ help: provide a type for the item: `: <type>`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/typeck/issue-87181/empty-tuple-method.rs b/src/test/ui/typeck/issue-87181/empty-tuple-method.rs
index 1875d8280..be68ad32a 100644
--- a/src/test/ui/typeck/issue-87181/empty-tuple-method.rs
+++ b/src/test/ui/typeck/issue-87181/empty-tuple-method.rs
@@ -4,7 +4,7 @@ struct Bar<T> {
struct Foo();
impl Foo {
- fn foo() { }
+ fn foo(&self) { }
}
fn main() {
diff --git a/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr b/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr
index 6ed70b301..a18c54a29 100644
--- a/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr
+++ b/src/test/ui/typeck/issue-87181/empty-tuple-method.stderr
@@ -2,11 +2,9 @@ error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo}` in the
--> $DIR/empty-tuple-method.rs:12:15
|
LL | thing.bar.foo();
- | --------- ^^^ method not found in `fn() -> Foo {Foo}`
- | |
- | this is the constructor of a struct
+ | ^^^ method not found in `fn() -> Foo {Foo}`
|
-help: call the constructor
+help: use parentheses to instantiate this tuple struct
|
LL | (thing.bar)().foo();
| + +++
diff --git a/src/test/ui/typeck/issue-87181/enum-variant.rs b/src/test/ui/typeck/issue-87181/enum-variant.rs
index 3b926b90f..d87f99c3c 100644
--- a/src/test/ui/typeck/issue-87181/enum-variant.rs
+++ b/src/test/ui/typeck/issue-87181/enum-variant.rs
@@ -6,7 +6,7 @@ enum Foo{
Tup()
}
impl Foo {
- fn foo() { }
+ fn foo(&self) { }
}
fn main() {
diff --git a/src/test/ui/typeck/issue-87181/enum-variant.stderr b/src/test/ui/typeck/issue-87181/enum-variant.stderr
index a3a818696..90641410d 100644
--- a/src/test/ui/typeck/issue-87181/enum-variant.stderr
+++ b/src/test/ui/typeck/issue-87181/enum-variant.stderr
@@ -2,11 +2,9 @@ error[E0599]: no method named `foo` found for fn item `fn() -> Foo {Foo::Tup}` i
--> $DIR/enum-variant.rs:14:15
|
LL | thing.bar.foo();
- | --------- ^^^ method not found in `fn() -> Foo {Foo::Tup}`
- | |
- | this is the constructor of an enum variant
+ | ^^^ method not found in `fn() -> Foo {Foo::Tup}`
|
-help: call the constructor
+help: use parentheses to instantiate this tuple variant
|
LL | (thing.bar)().foo();
| + +++
diff --git a/src/test/ui/typeck/issue-87181/tuple-field.stderr b/src/test/ui/typeck/issue-87181/tuple-field.stderr
index 4d22ada02..c1ca26ee9 100644
--- a/src/test/ui/typeck/issue-87181/tuple-field.stderr
+++ b/src/test/ui/typeck/issue-87181/tuple-field.stderr
@@ -2,14 +2,12 @@ error[E0609]: no field `0` on type `fn(char, u16) -> Foo {Foo}`
--> $DIR/tuple-field.rs:12:15
|
LL | thing.bar.0;
- | --------- ^
- | |
- | this is the constructor of a struct
+ | ^
|
-help: call the constructor
+help: use parentheses to instantiate this tuple struct
|
-LL | (thing.bar)(_, _).0;
- | + +++++++
+LL | (thing.bar)(/* char */, /* u16 */).0;
+ | + ++++++++++++++++++++++++
error: aborting due to previous error
diff --git a/src/test/ui/typeck/issue-87181/tuple-method.stderr b/src/test/ui/typeck/issue-87181/tuple-method.stderr
index 1e392e179..e27c41858 100644
--- a/src/test/ui/typeck/issue-87181/tuple-method.stderr
+++ b/src/test/ui/typeck/issue-87181/tuple-method.stderr
@@ -2,14 +2,7 @@ error[E0599]: no method named `foo` found for fn item `fn(u8, i32) -> Foo {Foo}`
--> $DIR/tuple-method.rs:12:15
|
LL | thing.bar.foo();
- | --------- ^^^ method not found in `fn(u8, i32) -> Foo {Foo}`
- | |
- | this is the constructor of a struct
- |
-help: call the constructor
- |
-LL | (thing.bar)(_, _).foo();
- | + +++++++
+ | ^^^ method not found in `fn(u8, i32) -> Foo {Foo}`
error: aborting due to previous error
diff --git a/src/test/ui/typeck/issue-90101.stderr b/src/test/ui/typeck/issue-90101.stderr
index ab9a72edf..d2729d853 100644
--- a/src/test/ui/typeck/issue-90101.stderr
+++ b/src/test/ui/typeck/issue-90101.stderr
@@ -12,7 +12,7 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world")
<PathBuf as From<Cow<'a, Path>>>
<PathBuf as From<OsString>>
<PathBuf as From<String>>
- = note: required because of the requirements on the impl of `Into<PathBuf>` for `Cow<'_, str>`
+ = note: required for `Cow<'_, str>` to implement `Into<PathBuf>`
note: required by a bound in `func`
--> $DIR/issue-90101.rs:3:20
|
diff --git a/src/test/ui/typeck/issue-91210-ptr-method.stderr b/src/test/ui/typeck/issue-91210-ptr-method.stderr
index 503a32373..7a0cfb2cf 100644
--- a/src/test/ui/typeck/issue-91210-ptr-method.stderr
+++ b/src/test/ui/typeck/issue-91210-ptr-method.stderr
@@ -2,9 +2,12 @@ error[E0615]: attempted to take value of method `read` on type `*mut Foo`
--> $DIR/issue-91210-ptr-method.rs:10:7
|
LL | x.read = 4;
- | - ^^^^ method, not a field
- | |
- | help: to access the field, dereference first: `(*x)`
+ | ^^^^ method, not a field
+ |
+help: to access the field, dereference first
+ |
+LL | (*x).read = 4;
+ | ++ +
error: aborting due to previous error
diff --git a/src/test/ui/typeck/issue-91633.rs b/src/test/ui/typeck/issue-91633.rs
new file mode 100644
index 000000000..331a798dd
--- /dev/null
+++ b/src/test/ui/typeck/issue-91633.rs
@@ -0,0 +1,8 @@
+// check-pass
+fn f<T> (it: &[T])
+where
+ [T] : std::ops::Index<usize>,
+{
+ let _ = &it[0];
+}
+fn main(){}
diff --git a/src/test/ui/typeck/issue-96738.stderr b/src/test/ui/typeck/issue-96738.stderr
index 32f538498..0d4d87ef4 100644
--- a/src/test/ui/typeck/issue-96738.stderr
+++ b/src/test/ui/typeck/issue-96738.stderr
@@ -2,27 +2,13 @@ error[E0599]: no method named `nonexistent_method` found for fn item `fn(_) -> O
--> $DIR/issue-96738.rs:2:10
|
LL | Some.nonexistent_method();
- | ---- ^^^^^^^^^^^^^^^^^^ method not found in `fn(_) -> Option<_> {Option::<_>::Some}`
- | |
- | this is the constructor of an enum variant
- |
-help: call the constructor
- |
-LL | (Some)(_).nonexistent_method();
- | + ++++
+ | ^^^^^^^^^^^^^^^^^^ method not found in `fn(_) -> Option<_> {Option::<_>::Some}`
error[E0609]: no field `nonexistent_field` on type `fn(_) -> Option<_> {Option::<_>::Some}`
--> $DIR/issue-96738.rs:3:10
|
LL | Some.nonexistent_field;
- | ---- ^^^^^^^^^^^^^^^^^
- | |
- | this is the constructor of an enum variant
- |
-help: call the constructor
- |
-LL | (Some)(_).nonexistent_field;
- | + ++++
+ | ^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
diff --git a/src/test/ui/typeck/issue-98982.rs b/src/test/ui/typeck/issue-98982.rs
new file mode 100644
index 000000000..2553824bb
--- /dev/null
+++ b/src/test/ui/typeck/issue-98982.rs
@@ -0,0 +1,9 @@
+fn foo() -> i32 {
+ for i in 0..0 {
+ //~^ ERROR: mismatched types [E0308]
+ return i;
+ }
+ //~| help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility
+}
+
+fn main() {}
diff --git a/src/test/ui/typeck/issue-98982.stderr b/src/test/ui/typeck/issue-98982.stderr
new file mode 100644
index 000000000..3c9806ac9
--- /dev/null
+++ b/src/test/ui/typeck/issue-98982.stderr
@@ -0,0 +1,24 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-98982.rs:2:5
+ |
+LL | fn foo() -> i32 {
+ | --- expected `i32` because of return type
+LL | / for i in 0..0 {
+LL | |
+LL | | return i;
+LL | | }
+ | |_____^ expected `i32`, found `()`
+ |
+note: the function expects a value to always be returned, but loops might run zero times
+ --> $DIR/issue-98982.rs:2:5
+ |
+LL | for i in 0..0 {
+ | ^^^^^^^^^^^^^ this might have zero elements to iterate on
+LL |
+LL | return i;
+ | -------- if the loop doesn't execute, this value would never get returned
+ = help: return a value for the case when the loop has zero elements to iterate on, or consider changing the return type to account for that possibility
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/typeck/point-at-type-param-in-path-expr.rs b/src/test/ui/typeck/point-at-type-param-in-path-expr.rs
new file mode 100644
index 000000000..9a21536f9
--- /dev/null
+++ b/src/test/ui/typeck/point-at-type-param-in-path-expr.rs
@@ -0,0 +1,6 @@
+fn foo<T: std::fmt::Display>() {}
+
+fn main() {
+ let x = foo::<()>;
+ //~^ ERROR `()` doesn't implement `std::fmt::Display`
+}
diff --git a/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr b/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr
new file mode 100644
index 000000000..1feaa0508
--- /dev/null
+++ b/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `()` doesn't implement `std::fmt::Display`
+ --> $DIR/point-at-type-param-in-path-expr.rs:4:19
+ |
+LL | let x = foo::<()>;
+ | ^^ `()` cannot be formatted with the default formatter
+ |
+ = help: the trait `std::fmt::Display` is not implemented for `()`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
+note: required by a bound in `foo`
+ --> $DIR/point-at-type-param-in-path-expr.rs:1:11
+ |
+LL | fn foo<T: std::fmt::Display>() {}
+ | ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/typeck/remove-extra-argument.stderr b/src/test/ui/typeck/remove-extra-argument.stderr
index 703032a83..b734bcd4e 100644
--- a/src/test/ui/typeck/remove-extra-argument.stderr
+++ b/src/test/ui/typeck/remove-extra-argument.stderr
@@ -12,7 +12,7 @@ LL | fn l(_a: Vec<u8>) {}
help: remove the extra argument
|
LL | l(vec![])
- |
+ | ~~~~~~~~
error: aborting due to previous error
diff --git a/src/test/ui/typeck/struct-enum-wrong-args.stderr b/src/test/ui/typeck/struct-enum-wrong-args.stderr
index f72082d53..ea94bcbc2 100644
--- a/src/test/ui/typeck/struct-enum-wrong-args.stderr
+++ b/src/test/ui/typeck/struct-enum-wrong-args.stderr
@@ -12,7 +12,7 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
help: remove the extra argument
|
LL | let _ = Some(3);
- | ~~~~~~~
+ | ~~~
error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:7:13
@@ -30,7 +30,7 @@ LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
help: remove the extra arguments
|
LL | let _ = Ok(3);
- | ~~~~~
+ | ~~~
error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:8:13
@@ -46,7 +46,7 @@ LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
help: provide the argument
|
LL | let _ = Ok(/* value */);
- | ~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~
error[E0061]: this struct takes 1 argument but 0 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:9:13
@@ -62,7 +62,7 @@ LL | struct Wrapper(i32);
help: provide the argument
|
LL | let _ = Wrapper(/* i32 */);
- | ~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~
error[E0061]: this struct takes 1 argument but 2 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:10:13
@@ -78,7 +78,7 @@ LL | struct Wrapper(i32);
help: remove the extra argument
|
LL | let _ = Wrapper(5);
- | ~~~~~~~~~~
+ | ~~~
error[E0061]: this struct takes 2 arguments but 0 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:11:13
@@ -94,7 +94,7 @@ LL | struct DoubleWrapper(i32, i32);
help: provide the arguments
|
LL | let _ = DoubleWrapper(/* i32 */, /* i32 */);
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~~~~~~~~~
error[E0061]: this struct takes 2 arguments but 1 argument was supplied
--> $DIR/struct-enum-wrong-args.rs:12:13
@@ -110,7 +110,7 @@ LL | struct DoubleWrapper(i32, i32);
help: provide the argument
|
LL | let _ = DoubleWrapper(5, /* i32 */);
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~~~~~~~~~
error[E0061]: this struct takes 2 arguments but 3 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:13:13
@@ -126,7 +126,7 @@ LL | struct DoubleWrapper(i32, i32);
help: remove the extra argument
|
LL | let _ = DoubleWrapper(5, 2);
- | ~~~~~~~~~~~~~~~~~~~
+ | ~~~~~~
error: aborting due to 8 previous errors
diff --git a/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr b/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr
index e8e069708..503015f3b 100644
--- a/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr
+++ b/src/test/ui/typeck/suggest-adding-missing-zero-to-floating-point-number.stderr
@@ -4,7 +4,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.e1;
| ^^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0e1;
| +
@@ -15,7 +15,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.E1;
| ^^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0E1;
| +
@@ -26,7 +26,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.f32;
| ^^^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0f32;
| +
@@ -37,7 +37,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.f64;
| ^^^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0f64;
| +
@@ -48,7 +48,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.e+12;
| ^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0e+12;
| +
@@ -59,7 +59,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.e-12;
| ^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0e-12;
| +
@@ -70,7 +70,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
LL | 2.e1f32;
| ^^^^^
|
-help: If the number is meant to be a floating point number, consider adding a `0` after the period
+help: if intended to be a floating point literal, consider adding a `0` after the period
|
LL | 2.0e1f32;
| +
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr
index 6bb5e1f54..b9fca1a1b 100644
--- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr
+++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr
@@ -12,10 +12,10 @@ LL | fn is_sync<T: Sync>() {}
| ^^^^ required by this bound in `is_sync`
error[E0277]: `UnsafeCell<u8>` cannot be shared between threads safely
- --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:5
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:36:15
|
LL | is_sync::<MyTypeWUnsafe>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<u8>` cannot be shared between threads safely
+ | ^^^^^^^^^^^^^ `UnsafeCell<u8>` cannot be shared between threads safely
|
= help: within `MyTypeWUnsafe`, the trait `Sync` is not implemented for `UnsafeCell<u8>`
note: required because it appears within the type `MyTypeWUnsafe`
@@ -30,10 +30,10 @@ LL | fn is_sync<T: Sync>() {}
| ^^^^ required by this bound in `is_sync`
error[E0277]: `Managed` cannot be shared between threads safely
- --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:5
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:39:15
|
LL | is_sync::<MyTypeManaged>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely
+ | ^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely
|
= help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed`
note: required because it appears within the type `MyTypeManaged`
diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
index 3ea317dfb..c57f71b80 100644
--- a/src/test/ui/typeck/typeck_type_placeholder_item.stderr
+++ b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
@@ -189,10 +189,10 @@ LL ~ b: (T, T),
|
error: missing type for `static` item
- --> $DIR/typeck_type_placeholder_item.rs:73:12
+ --> $DIR/typeck_type_placeholder_item.rs:73:13
|
LL | static A = 42;
- | ^ help: provide a type for the static variable: `A: i32`
+ | ^ help: provide a type for the static variable: `: i32`
error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
--> $DIR/typeck_type_placeholder_item.rs:75:15