about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/binop/multiply-is-deref-on-rhs.rs8
-rw-r--r--tests/ui/binop/multiply-is-deref-on-rhs.stderr16
-rw-r--r--tests/ui/inference/untyped-primitives.rs9
3 files changed, 33 insertions, 0 deletions
diff --git a/tests/ui/binop/multiply-is-deref-on-rhs.rs b/tests/ui/binop/multiply-is-deref-on-rhs.rs
new file mode 100644
index 00000000000..7c24e1b4d57
--- /dev/null
+++ b/tests/ui/binop/multiply-is-deref-on-rhs.rs
@@ -0,0 +1,8 @@
+pub fn test(y: &i32) {
+    let x;
+    x = ()
+    *y
+    //~^ ERROR cannot multiply `()` by `&i32`
+}
+
+fn main() {}
diff --git a/tests/ui/binop/multiply-is-deref-on-rhs.stderr b/tests/ui/binop/multiply-is-deref-on-rhs.stderr
new file mode 100644
index 00000000000..e157f4f58ca
--- /dev/null
+++ b/tests/ui/binop/multiply-is-deref-on-rhs.stderr
@@ -0,0 +1,16 @@
+error[E0369]: cannot multiply `()` by `&i32`
+  --> $DIR/multiply-is-deref-on-rhs.rs:4:5
+   |
+LL |     x = ()
+   |         -- ()
+LL |     *y
+   |     ^- &i32
+   |
+help: you might have meant to write a semicolon here
+   |
+LL |     x = ();
+   |           +
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/tests/ui/inference/untyped-primitives.rs b/tests/ui/inference/untyped-primitives.rs
new file mode 100644
index 00000000000..8515ca79903
--- /dev/null
+++ b/tests/ui/inference/untyped-primitives.rs
@@ -0,0 +1,9 @@
+//@ check-pass
+// issue: rust-lang/rust#123824
+// This test is a sanity check and does not enforce any stable API, so may be
+// removed at a future point.
+
+fn main() {
+    let x = f32::from(3.14);
+    let y = f64::from(3.14);
+}