about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/enum-match.rs7
-rw-r--r--tests/ui/enum-discriminant/issue-104519.rs10
-rw-r--r--tests/ui/enum-discriminant/issue-61696.rs (renamed from tests/ui/issues/issue-61696.rs)21
-rw-r--r--tests/ui/hygiene/panic-location.run.stderr2
-rw-r--r--tests/ui/type/type-check/assignment-in-if.stderr9
-rw-r--r--tests/ui/type/type-check/point-at-inference-3.fixed3
-rw-r--r--tests/ui/type/type-check/point-at-inference-3.rs3
-rw-r--r--tests/ui/type/type-check/point-at-inference-3.stderr6
-rw-r--r--tests/ui/type/type-check/point-at-inference-4.rs3
-rw-r--r--tests/ui/type/type-check/point-at-inference-4.stderr11
-rw-r--r--tests/ui/type/type-check/point-at-inference.stderr4
-rw-r--r--tests/ui/typeck/bad-type-in-vec-contains.stderr1
-rw-r--r--tests/ui/typeck/bad-type-in-vec-push.stderr2
-rw-r--r--tests/ui/typeck/issue-107775.stderr6
14 files changed, 49 insertions, 39 deletions
diff --git a/tests/codegen/enum-match.rs b/tests/codegen/enum-match.rs
index 5f8063a27f7..36c6be19012 100644
--- a/tests/codegen/enum-match.rs
+++ b/tests/codegen/enum-match.rs
@@ -34,8 +34,11 @@ pub enum Enum1 {
 
 // CHECK: define noundef i8 @match1{{.*}}
 // CHECK-NEXT: start:
-// CHECK-NEXT: [[DISCR:%.*]] = {{.*}}call i8 @llvm.usub.sat.i8(i8 %0, i8 1)
-// CHECK-NEXT: switch i8 [[DISCR]], label {{.*}} [
+// CHECK-NEXT: %1 = add i8 %0, -2
+// CHECK-NEXT: %2 = zext i8 %1 to i64
+// CHECK-NEXT: %3 = icmp ult i8 %1, 2
+// CHECK-NEXT: %4 = add nuw nsw i64 %2, 1
+// CHECK-NEXT: %_2 = select i1 %3, i64 %4, i64 0
 #[no_mangle]
 pub fn match1(e: Enum1) -> u8 {
     use Enum1::*;
diff --git a/tests/ui/enum-discriminant/issue-104519.rs b/tests/ui/enum-discriminant/issue-104519.rs
index c4630f76b3a..507c0988fcc 100644
--- a/tests/ui/enum-discriminant/issue-104519.rs
+++ b/tests/ui/enum-discriminant/issue-104519.rs
@@ -23,14 +23,4 @@ fn some_match(result: OpenResult) -> u8 {
 fn main() {
     let result = OpenResult::Ok(());
     assert_eq!(some_match(result), 0);
-
-    let result = OpenResult::Ok(());
-    match result {
-        OpenResult::Ok(()) => (),
-        _ => unreachable!("message a"),
-    }
-    match result {
-        OpenResult::Ok(()) => (),
-        _ => unreachable!("message b"),
-    }
 }
diff --git a/tests/ui/issues/issue-61696.rs b/tests/ui/enum-discriminant/issue-61696.rs
index dca52927fd7..8a633a916c8 100644
--- a/tests/ui/issues/issue-61696.rs
+++ b/tests/ui/enum-discriminant/issue-61696.rs
@@ -55,12 +55,23 @@ pub enum E2<X> {
     V4,
 }
 
-fn main() {
-    if let E1::V2 { .. } = (E1::V1 { f: true }) {
-        unreachable!()
+#[inline(never)]
+fn match_e1(y: E1) -> u8 {
+    match y {
+        E1::V2 { .. } => 1,
+        _ => 0,
     }
+}
 
-    if let E2::V1 { .. } = E2::V3::<Infallible> {
-        unreachable!()
+#[inline(never)]
+fn match_e2(y: E2<Infallible>) -> u8 {
+    match y {
+        E2::V1 { .. } => 1,
+        _ => 0,
     }
 }
+
+fn main() {
+    assert_eq!(match_e1(E1::V1 { f: true }), 0);
+    assert_eq!(match_e2(E2::V3), 0);
+}
diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr
index 1c6a7b02f8e..a7252a40027 100644
--- a/tests/ui/hygiene/panic-location.run.stderr
+++ b/tests/ui/hygiene/panic-location.run.stderr
@@ -1,2 +1,2 @@
-thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:525:5
+thread 'main' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:524:5
 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
diff --git a/tests/ui/type/type-check/assignment-in-if.stderr b/tests/ui/type/type-check/assignment-in-if.stderr
index de133e5599c..9f4558adab1 100644
--- a/tests/ui/type/type-check/assignment-in-if.stderr
+++ b/tests/ui/type/type-check/assignment-in-if.stderr
@@ -67,9 +67,6 @@ LL |             x == 5
 error[E0308]: mismatched types
   --> $DIR/assignment-in-if.rs:44:18
    |
-LL |     if y = (Foo { foo: x }) {
-   |                        - here the type of `x` is inferred to be `usize`
-...
 LL |     if x == x && x = x && x == x {
    |        ------    ^ expected `bool`, found `usize`
    |        |
@@ -78,9 +75,6 @@ LL |     if x == x && x = x && x == x {
 error[E0308]: mismatched types
   --> $DIR/assignment-in-if.rs:44:22
    |
-LL |     if y = (Foo { foo: x }) {
-   |                        - here the type of `x` is inferred to be `usize`
-...
 LL |     if x == x && x = x && x == x {
    |                      ^ expected `bool`, found `usize`
 
@@ -98,9 +92,6 @@ LL |     if x == x && x == x && x == x {
 error[E0308]: mismatched types
   --> $DIR/assignment-in-if.rs:51:28
    |
-LL |     if y = (Foo { foo: x }) {
-   |                        - here the type of `x` is inferred to be `usize`
-...
 LL |     if x == x && x == x && x = x {
    |        ----------------    ^ expected `bool`, found `usize`
    |        |
diff --git a/tests/ui/type/type-check/point-at-inference-3.fixed b/tests/ui/type/type-check/point-at-inference-3.fixed
index edd4adf8bd2..15a3b580568 100644
--- a/tests/ui/type/type-check/point-at-inference-3.fixed
+++ b/tests/ui/type/type-check/point-at-inference-3.fixed
@@ -2,7 +2,8 @@
 fn main() {
     let mut v = Vec::new();
     v.push(0i32);
-    //~^ NOTE this is of type `i32`, which causes `v` to be inferred as `Vec<i32>`
+    //~^ NOTE this argument has type `i32`...
+    //~| NOTE ... which causes `v` to have type `Vec<i32>`
     v.push(0);
     v.push(1i32); //~ ERROR mismatched types
     //~^ NOTE expected `i32`, found `u32`
diff --git a/tests/ui/type/type-check/point-at-inference-3.rs b/tests/ui/type/type-check/point-at-inference-3.rs
index 49d7b50075b..a48c4f9862f 100644
--- a/tests/ui/type/type-check/point-at-inference-3.rs
+++ b/tests/ui/type/type-check/point-at-inference-3.rs
@@ -2,7 +2,8 @@
 fn main() {
     let mut v = Vec::new();
     v.push(0i32);
-    //~^ NOTE this is of type `i32`, which causes `v` to be inferred as `Vec<i32>`
+    //~^ NOTE this argument has type `i32`...
+    //~| NOTE ... which causes `v` to have type `Vec<i32>`
     v.push(0);
     v.push(1u32); //~ ERROR mismatched types
     //~^ NOTE expected `i32`, found `u32`
diff --git a/tests/ui/type/type-check/point-at-inference-3.stderr b/tests/ui/type/type-check/point-at-inference-3.stderr
index 2c4907ed263..23876481236 100644
--- a/tests/ui/type/type-check/point-at-inference-3.stderr
+++ b/tests/ui/type/type-check/point-at-inference-3.stderr
@@ -1,8 +1,10 @@
 error[E0308]: mismatched types
-  --> $DIR/point-at-inference-3.rs:7:12
+  --> $DIR/point-at-inference-3.rs:8:12
    |
 LL |     v.push(0i32);
-   |            ---- this is of type `i32`, which causes `v` to be inferred as `Vec<i32>`
+   |     -      ---- this argument has type `i32`...
+   |     |
+   |     ... which causes `v` to have type `Vec<i32>`
 ...
 LL |     v.push(1u32);
    |       ---- ^^^^ expected `i32`, found `u32`
diff --git a/tests/ui/type/type-check/point-at-inference-4.rs b/tests/ui/type/type-check/point-at-inference-4.rs
index aea9b2c6c14..3deb234c275 100644
--- a/tests/ui/type/type-check/point-at-inference-4.rs
+++ b/tests/ui/type/type-check/point-at-inference-4.rs
@@ -11,8 +11,11 @@ fn main() {
     let s = S(None);
     s.infer(0i32);
     //~^ ERROR this method takes 2 arguments but 1 argument was supplied
+    //~| NOTE this argument has type `i32`...
+    //~| NOTE ... which causes `s` to have type `S<i32, _>`
     //~| NOTE an argument is missing
     //~| HELP provide the argument
+    //~| HELP change the type of the numeric literal from `i32` to `u32`
     let t: S<u32, _> = s;
     //~^ ERROR mismatched types
     //~| NOTE expected `S<u32, _>`, found `S<i32, _>`
diff --git a/tests/ui/type/type-check/point-at-inference-4.stderr b/tests/ui/type/type-check/point-at-inference-4.stderr
index 28833d2ed1c..5f7bb8b9367 100644
--- a/tests/ui/type/type-check/point-at-inference-4.stderr
+++ b/tests/ui/type/type-check/point-at-inference-4.stderr
@@ -15,8 +15,13 @@ LL |     s.infer(0i32, /* b */);
    |            ~~~~~~~~~~~~~~~
 
 error[E0308]: mismatched types
-  --> $DIR/point-at-inference-4.rs:16:24
+  --> $DIR/point-at-inference-4.rs:19:24
    |
+LL |     s.infer(0i32);
+   |     -       ---- this argument has type `i32`...
+   |     |
+   |     ... which causes `s` to have type `S<i32, _>`
+...
 LL |     let t: S<u32, _> = s;
    |            ---------   ^ expected `S<u32, _>`, found `S<i32, _>`
    |            |
@@ -24,6 +29,10 @@ LL |     let t: S<u32, _> = s;
    |
    = note: expected struct `S<u32, _>`
               found struct `S<i32, _>`
+help: change the type of the numeric literal from `i32` to `u32`
+   |
+LL |     s.infer(0u32);
+   |              ~~~
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/type/type-check/point-at-inference.stderr b/tests/ui/type/type-check/point-at-inference.stderr
index a76b4f90c73..5fc94d4d1b6 100644
--- a/tests/ui/type/type-check/point-at-inference.stderr
+++ b/tests/ui/type/type-check/point-at-inference.stderr
@@ -2,7 +2,9 @@ error[E0308]: mismatched types
   --> $DIR/point-at-inference.rs:12:9
    |
 LL |         foo.push(i);
-   |                  - this is of type `&{integer}`, which causes `foo` to be inferred as `Vec<&{integer}>`
+   |         ---      - this argument has type `&{integer}`...
+   |         |
+   |         ... which causes `foo` to have type `Vec<&{integer}>`
 ...
 LL |     bar(foo);
    |     --- ^^^ expected `Vec<i32>`, found `Vec<&{integer}>`
diff --git a/tests/ui/typeck/bad-type-in-vec-contains.stderr b/tests/ui/typeck/bad-type-in-vec-contains.stderr
index 0e03388d2d5..72533ab1fa3 100644
--- a/tests/ui/typeck/bad-type-in-vec-contains.stderr
+++ b/tests/ui/typeck/bad-type-in-vec-contains.stderr
@@ -7,7 +7,6 @@ LL |     primes.contains(3);
    |            |        expected `&_`, found integer
    |            |        help: consider borrowing here: `&3`
    |            arguments to this method are incorrect
-   |            here the type of `primes` is inferred to be `[_]`
    |
    = note: expected reference `&_`
                    found type `{integer}`
diff --git a/tests/ui/typeck/bad-type-in-vec-push.stderr b/tests/ui/typeck/bad-type-in-vec-push.stderr
index ae46050c91b..1d5337260fa 100644
--- a/tests/ui/typeck/bad-type-in-vec-push.stderr
+++ b/tests/ui/typeck/bad-type-in-vec-push.stderr
@@ -1,8 +1,6 @@
 error[E0308]: mismatched types
   --> $DIR/bad-type-in-vec-push.rs:11:17
    |
-LL |     vector.sort();
-   |     ------ here the type of `vector` is inferred to be `Vec<_>`
 LL |     result.push(vector);
    |            ---- ^^^^^^ expected integer, found `Vec<_>`
    |            |
diff --git a/tests/ui/typeck/issue-107775.stderr b/tests/ui/typeck/issue-107775.stderr
index 9ee9c022c6e..b97e74b7e53 100644
--- a/tests/ui/typeck/issue-107775.stderr
+++ b/tests/ui/typeck/issue-107775.stderr
@@ -2,9 +2,9 @@ error[E0308]: mismatched types
   --> $DIR/issue-107775.rs:35:16
    |
 LL |         map.insert(1, Struct::do_something);
-   |                    -  -------------------- this is of type `fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>`
-   |                    |
-   |                    this is of type `{integer}`, which causes `map` to be inferred as `HashMap<{integer}, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>`
+   |         ---           -------------------- this argument has type `fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}`...
+   |         |
+   |         ... which causes `map` to have type `HashMap<{integer}, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>`
 LL |         Self { map }
    |                ^^^ expected `HashMap<u16, fn(u8) -> Pin<...>>`, found `HashMap<{integer}, ...>`
    |