about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-26 04:28:41 +0000
committerbors <bors@rust-lang.org>2022-07-26 04:28:41 +0000
commitb629c85bd74dfb730a3e9308312b007c0bf027cb (patch)
treefd1af610fe65c0dff7fb3ead05b43937e2b635a7 /src/test
parentdaaae25022cedcd7ded230170cdf48cfb799f9a2 (diff)
parenta572f061c7a8c58aab67335f6b63a74cfc6e4973 (diff)
downloadrust-b629c85bd74dfb730a3e9308312b007c0bf027cb.tar.gz
rust-b629c85bd74dfb730a3e9308312b007c0bf027cb.zip
Auto merge of #99745 - JohnTitor:rollup-lvrie64, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #98211 (Implement `fs::get_path` for FreeBSD.)
 - #99353 (Slightly improve mismatched GAT where clause error)
 - #99593 (Suggest removing the tuple struct field for the unwrapped value)
 - #99615 (Remove some explicit `self.infcx` for `FnCtxt`, which already derefs into `InferCtxt`)
 - #99711 (Remove reachable coverage without counters)
 - #99718 (Avoid `&str`/`Symbol` to `String` conversions)
 - #99720 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt39
-rw-r--r--src/test/run-make-fulldeps/coverage/inline-dead.rs9
-rw-r--r--src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs2
-rw-r--r--src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr2
-rw-r--r--src/test/ui/generic-associated-types/generic-associated-types-where.stderr4
-rw-r--r--src/test/ui/generic-associated-types/impl_bounds.rs4
-rw-r--r--src/test/ui/generic-associated-types/impl_bounds.stderr34
-rw-r--r--src/test/ui/generic-associated-types/issue-47206-where-clause.stderr4
-rw-r--r--src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs2
-rw-r--r--src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr9
-rw-r--r--src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.fixed17
-rw-r--r--src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.rs17
-rw-r--r--src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.stderr41
-rw-r--r--src/test/ui/nll/trait-associated-constant.rs2
-rw-r--r--src/test/ui/nll/trait-associated-constant.stderr2
15 files changed, 139 insertions, 49 deletions
diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt
index d102d9ecf7d..effdef80e8e 100644
--- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt
+++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt
@@ -1,21 +1,28 @@
     1|       |// Regression test for issue #98833.
-    2|       |// compile-flags: -Zinline-mir
+    2|       |// compile-flags: -Zinline-mir -Cdebug-assertions=off
     3|       |
     4|      1|fn main() {
     5|      1|    println!("{}", live::<false>());
-    6|      1|}
-    7|       |
-    8|       |#[inline]
-    9|      1|fn live<const B: bool>() -> u32 {
-   10|      1|    if B {
-   11|      0|        dead()
-   12|       |    } else {
-   13|      1|        0
-   14|       |    }
-   15|      1|}
-   16|       |
-   17|       |#[inline]
-   18|      0|fn dead() -> u32 {
-   19|      0|    42
-   20|      0|}
+    6|      1|
+    7|      1|    let f = |x: bool| {
+    8|       |        debug_assert!(
+    9|       |            x
+   10|       |        );
+   11|      1|    };
+   12|      1|    f(false);
+   13|      1|}
+   14|       |
+   15|       |#[inline]
+   16|      1|fn live<const B: bool>() -> u32 {
+   17|      1|    if B {
+   18|      0|        dead()
+   19|       |    } else {
+   20|      1|        0
+   21|       |    }
+   22|      1|}
+   23|       |
+   24|       |#[inline]
+   25|      0|fn dead() -> u32 {
+   26|      0|    42
+   27|      0|}
 
diff --git a/src/test/run-make-fulldeps/coverage/inline-dead.rs b/src/test/run-make-fulldeps/coverage/inline-dead.rs
index cd1ae911a5f..854fa062967 100644
--- a/src/test/run-make-fulldeps/coverage/inline-dead.rs
+++ b/src/test/run-make-fulldeps/coverage/inline-dead.rs
@@ -1,8 +1,15 @@
 // Regression test for issue #98833.
-// compile-flags: -Zinline-mir
+// compile-flags: -Zinline-mir -Cdebug-assertions=off
 
 fn main() {
     println!("{}", live::<false>());
+
+    let f = |x: bool| {
+        debug_assert!(
+            x
+        );
+    };
+    f(false);
 }
 
 #[inline]
diff --git a/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs
index 08260ec8f4d..63bac96135b 100644
--- a/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs
+++ b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs
@@ -5,7 +5,7 @@ trait Foo {
 
 impl<'a> Foo for &'a () {
     const NAME: &'a str = "unit";
-    //~^ ERROR mismatched types [E0308]
+    //~^ ERROR const not compatible with trait
 }
 
 fn main() {}
diff --git a/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr
index f71fb2ee18a..de1d9589e99 100644
--- a/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr
+++ b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr
@@ -1,4 +1,4 @@
-error[E0308]: mismatched types
+error[E0308]: const not compatible with trait
   --> $DIR/associated-const-impl-wrong-lifetime.rs:7:5
    |
 LL |     const NAME: &'a str = "unit";
diff --git a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr
index c7ebb9880f7..e866b3bab79 100644
--- a/src/test/ui/generic-associated-types/generic-associated-types-where.stderr
+++ b/src/test/ui/generic-associated-types/generic-associated-types-where.stderr
@@ -11,13 +11,13 @@ LL |     type Assoc2<T: std::fmt::Display> = Vec<T>;
    |                  +++++++++++++++++++
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/generic-associated-types-where.rs:22:5
+  --> $DIR/generic-associated-types-where.rs:22:38
    |
 LL |     type Assoc3<T>;
    |     -------------- definition of `Assoc3` from trait
 ...
 LL |     type Assoc3<T> = Vec<T> where T: Iterator;
-   |     ^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
+   |                                      ^^^^^^^^ impl has extra requirement `T: Iterator`
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/generic-associated-types/impl_bounds.rs b/src/test/ui/generic-associated-types/impl_bounds.rs
index bb5992c88f0..ec1d171c044 100644
--- a/src/test/ui/generic-associated-types/impl_bounds.rs
+++ b/src/test/ui/generic-associated-types/impl_bounds.rs
@@ -13,9 +13,9 @@ struct Fooy<T>(T);
 
 impl<T> Foo for Fooy<T> {
     type A<'a> = (&'a ()) where Self: 'static;
-    //~^ ERROR `impl` associated type
+    //~^ ERROR impl has stricter requirements than trait
     type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
-    //~^ ERROR `impl` associated type
+    //~^ ERROR impl has stricter requirements than trait
     //~| ERROR lifetime bound not satisfied
     type C = String where Self: Copy;
     //~^ ERROR the trait bound `T: Copy` is not satisfied
diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr
index 6aa52b179a3..ce79c635add 100644
--- a/src/test/ui/generic-associated-types/impl_bounds.stderr
+++ b/src/test/ui/generic-associated-types/impl_bounds.stderr
@@ -1,20 +1,20 @@
-error: `impl` associated type signature for `A` doesn't match `trait` associated type signature
-  --> $DIR/impl_bounds.rs:15:5
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/impl_bounds.rs:15:39
    |
 LL |     type A<'a> where Self: 'a;
-   |     ---------- expected
+   |     ---------- definition of `A` from trait
 ...
 LL |     type A<'a> = (&'a ()) where Self: 'static;
-   |     ^^^^^^^^^^ found
+   |                                       ^^^^^^^ impl has extra requirement `T: 'static`
 
-error: `impl` associated type signature for `B` doesn't match `trait` associated type signature
-  --> $DIR/impl_bounds.rs:17:5
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/impl_bounds.rs:17:48
    |
 LL |     type B<'a, 'b> where 'a: 'b;
-   |     -------------- expected
+   |     -------------- definition of `B` from trait
 ...
 LL |     type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
-   |     ^^^^^^^^^^^^^^ found
+   |                                                ^^ impl has extra requirement `'b: 'a`
 
 error[E0478]: lifetime bound not satisfied
   --> $DIR/impl_bounds.rs:17:22
@@ -37,24 +37,24 @@ LL |     type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
    |                ^^
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/impl_bounds.rs:20:5
+  --> $DIR/impl_bounds.rs:20:33
    |
 LL |     type C = String where Self: Copy;
-   |     ^^^^^^ the trait `Copy` is not implemented for `T`
+   |                                 ^^^^ the trait `Copy` is not implemented for `T`
    |
 note: required because of the requirements on the impl of `Copy` for `Fooy<T>`
   --> $DIR/impl_bounds.rs:11:10
    |
 LL | #[derive(Copy, Clone)]
    |          ^^^^
-note: the requirement `Fooy<T>: Copy` appears on the associated impl type `C` but not on the corresponding associated trait type
-  --> $DIR/impl_bounds.rs:7:5
+note: the requirement `Fooy<T>: Copy` appears on the `impl`'s associated type `C` but not on the corresponding trait's associated type
+  --> $DIR/impl_bounds.rs:7:10
    |
 LL | trait Foo {
    |       --- in this trait
 ...
 LL |     type C where Self: Clone;
-   |     ^^^^^^ this trait associated type doesn't have the requirement `Fooy<T>: Copy`
+   |          ^ this trait's associated type doesn't have the requirement `Fooy<T>: Copy`
    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T`
    |
@@ -72,14 +72,14 @@ note: required because of the requirements on the impl of `Copy` for `Fooy<T>`
    |
 LL | #[derive(Copy, Clone)]
    |          ^^^^
-note: the requirement `Fooy<T>: Copy` appears on the impl method `d` but not on the corresponding trait method
+note: the requirement `Fooy<T>: Copy` appears on the `impl`'s method `d` but not on the corresponding trait's method
   --> $DIR/impl_bounds.rs:8:8
    |
 LL | trait Foo {
    |       --- in this trait
 ...
 LL |     fn d() where Self: Clone;
-   |        ^ this trait method doesn't have the requirement `Fooy<T>: Copy`
+   |        ^ this trait's method doesn't have the requirement `Fooy<T>: Copy`
    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider restricting type parameter `T`
    |
@@ -88,5 +88,5 @@ LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
 
 error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0277, E0478.
-For more information about an error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0276, E0277, E0478.
+For more information about an error, try `rustc --explain E0276`.
diff --git a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr
index c560e2405d5..31948a878ed 100644
--- a/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr
+++ b/src/test/ui/generic-associated-types/issue-47206-where-clause.stderr
@@ -1,11 +1,11 @@
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/issue-47206-where-clause.rs:12:5
+  --> $DIR/issue-47206-where-clause.rs:12:38
    |
 LL |     type Assoc3<T>;
    |     -------------- definition of `Assoc3` from trait
 ...
 LL |     type Assoc3<T> = Vec<T> where T: Iterator;
-   |     ^^^^^^^^^^^^^^ impl has extra requirement `T: Iterator`
+   |                                      ^^^^^^^^ impl has extra requirement `T: Iterator`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs
index 5fb8f7a4773..8171dc0ae28 100644
--- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs
+++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.rs
@@ -7,7 +7,7 @@ trait Foo {
 }
 impl Foo for () {
     type Assoc<'a, 'b> = () where 'a: 'b;
-    //~^ `impl` associated type
+    //~^ impl has stricter requirements than trait
 }
 
 fn main() {}
diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
index 0256d2f20fc..edd1f9367d1 100644
--- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
+++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
@@ -1,11 +1,12 @@
-error: `impl` associated type signature for `Assoc` doesn't match `trait` associated type signature
-  --> $DIR/missing-where-clause-on-trait.rs:9:5
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/missing-where-clause-on-trait.rs:9:39
    |
 LL |     type Assoc<'a, 'b>;
-   |     ------------------ expected
+   |     ------------------ definition of `Assoc` from trait
 ...
 LL |     type Assoc<'a, 'b> = () where 'a: 'b;
-   |     ^^^^^^^^^^^^^^^^^^ found
+   |                                       ^^ impl has extra requirement `'a: 'b`
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0276`.
diff --git a/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.fixed b/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.fixed
new file mode 100644
index 00000000000..63b65ab20fe
--- /dev/null
+++ b/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.fixed
@@ -0,0 +1,17 @@
+// run-rustfix
+
+macro_rules! my_wrapper {
+    ($expr:expr) => { MyWrapper($expr) }
+}
+
+pub struct MyWrapper(u32);
+
+fn main() {
+    let value = MyWrapper(123);
+    some_fn(value); //~ ERROR mismatched types
+    some_fn(my_wrapper!(123)); //~ ERROR mismatched types
+}
+
+fn some_fn(wrapped: MyWrapper) {
+    drop(wrapped);
+}
diff --git a/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.rs b/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.rs
new file mode 100644
index 00000000000..2ab4e3955f3
--- /dev/null
+++ b/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.rs
@@ -0,0 +1,17 @@
+// run-rustfix
+
+macro_rules! my_wrapper {
+    ($expr:expr) => { MyWrapper($expr) }
+}
+
+pub struct MyWrapper(u32);
+
+fn main() {
+    let value = MyWrapper(123);
+    some_fn(value.0); //~ ERROR mismatched types
+    some_fn(my_wrapper!(123).0); //~ ERROR mismatched types
+}
+
+fn some_fn(wrapped: MyWrapper) {
+    drop(wrapped);
+}
diff --git a/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.stderr b/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.stderr
new file mode 100644
index 00000000000..82a7f276372
--- /dev/null
+++ b/src/test/ui/mismatched_types/suggest-removing-tulpe-struct-field.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+  --> $DIR/suggest-removing-tulpe-struct-field.rs:11:13
+   |
+LL |     some_fn(value.0);
+   |     ------- ^^^^^^^ expected struct `MyWrapper`, found `u32`
+   |     |
+   |     arguments to this function are incorrect
+   |
+note: function defined here
+  --> $DIR/suggest-removing-tulpe-struct-field.rs:15:4
+   |
+LL | fn some_fn(wrapped: MyWrapper) {
+   |    ^^^^^^^ ------------------
+help: consider removing the tuple struct field `0`
+   |
+LL -     some_fn(value.0);
+LL +     some_fn(value);
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/suggest-removing-tulpe-struct-field.rs:12:13
+   |
+LL |     some_fn(my_wrapper!(123).0);
+   |     ------- ^^^^^^^^^^^^^^^^^^ expected struct `MyWrapper`, found `u32`
+   |     |
+   |     arguments to this function are incorrect
+   |
+note: function defined here
+  --> $DIR/suggest-removing-tulpe-struct-field.rs:15:4
+   |
+LL | fn some_fn(wrapped: MyWrapper) {
+   |    ^^^^^^^ ------------------
+help: consider removing the tuple struct field `0`
+   |
+LL -     some_fn(my_wrapper!(123).0);
+LL +     some_fn(my_wrapper!(123));
+   |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/nll/trait-associated-constant.rs b/src/test/ui/nll/trait-associated-constant.rs
index 31dc58185e9..e13ae80f918 100644
--- a/src/test/ui/nll/trait-associated-constant.rs
+++ b/src/test/ui/nll/trait-associated-constant.rs
@@ -19,7 +19,7 @@ struct FailStruct { }
 
 impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct {
     const AC: Option<&'c str> = None;
-    //~^ ERROR: mismatched types
+    //~^ ERROR: const not compatible with trait
 }
 
 struct OKStruct2 { }
diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr
index 000ebc71657..ae0ffd904e7 100644
--- a/src/test/ui/nll/trait-associated-constant.stderr
+++ b/src/test/ui/nll/trait-associated-constant.stderr
@@ -1,4 +1,4 @@
-error[E0308]: mismatched types
+error[E0308]: const not compatible with trait
   --> $DIR/trait-associated-constant.rs:21:5
    |
 LL |     const AC: Option<&'c str> = None;