about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs3
-rw-r--r--src/test/ui/closure_context/issue-26046-fn-mut.stderr2
-rw-r--r--src/test/ui/closure_context/issue-26046-fn-once.stderr2
-rw-r--r--src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr10
-rw-r--r--src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr10
-rw-r--r--src/test/ui/closures/closure-wrong-kind.stderr10
-rw-r--r--src/test/ui/issues/issue-34349.stderr10
-rw-r--r--src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr30
-rw-r--r--src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr12
9 files changed, 79 insertions, 10 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index ab445afe6d6..70fac83325a 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -860,8 +860,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
                             }
                         }
 
-                        err.emit();
-                        return;
+                        err
                     }
 
                     ty::PredicateKind::WellFormed(ty) => {
diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr
index 74d3c4977ee..f744b71c284 100644
--- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr
+++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr
@@ -8,6 +8,8 @@ LL |         num += 1;
 ...
 LL |     Box::new(closure)
    |     ----------------- the requirement to implement `Fn` derives from here
+   |
+   = note: required for the cast from `[closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21]` to the object type `dyn Fn()`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr
index 473e8e8417e..34f94f9dca6 100644
--- a/src/test/ui/closure_context/issue-26046-fn-once.stderr
+++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr
@@ -8,6 +8,8 @@ LL |         vec
 ...
 LL |     Box::new(closure)
    |     ----------------- the requirement to implement `Fn` derives from here
+   |
+   = note: required for the cast from `[closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26]` to the object type `dyn Fn() -> Vec<u8>`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr
index b5f06e38f6d..309c63e5293 100644
--- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr
+++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr
@@ -7,7 +7,15 @@ LL |         let [_, _s] = s;
    |                       - closure is `FnOnce` because it moves the variable `s` out of its environment
 LL |     };
 LL |     expect_fn(c);
-   |               - the requirement to implement `Fn` derives from here
+   |     --------- - the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `expect_fn`
+  --> $DIR/closure-origin-array-diagnostics.rs:5:17
+   |
+LL | fn expect_fn<F: Fn()>(_f: F) {}
+   |                 ^^^^ required by this bound in `expect_fn`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr
index 66cd847db50..3e77635f9e0 100644
--- a/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr
+++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/closure-origin-tuple-diagnostics.stderr
@@ -7,7 +7,15 @@ LL |         let s = s.1;
    |                 --- closure is `FnOnce` because it moves the variable `s.1` out of its environment
 LL |     };
 LL |     expect_fn(c);
-   |               - the requirement to implement `Fn` derives from here
+   |     --------- - the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `expect_fn`
+  --> $DIR/closure-origin-tuple-diagnostics.rs:5:17
+   |
+LL | fn expect_fn<F: Fn()>(_f: F) {}
+   |                 ^^^^ required by this bound in `expect_fn`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr
index 421be56d917..9ea55d764f3 100644
--- a/src/test/ui/closures/closure-wrong-kind.stderr
+++ b/src/test/ui/closures/closure-wrong-kind.stderr
@@ -6,7 +6,15 @@ LL |     let closure = |_| foo(x);
    |                   |
    |                   this closure implements `FnOnce`, not `Fn`
 LL |     bar(closure);
-   |         ------- the requirement to implement `Fn` derives from here
+   |     --- ------- the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `bar`
+  --> $DIR/closure-wrong-kind.rs:6:11
+   |
+LL | fn bar<T: Fn(u32)>(_: T) {}
+   |           ^^^^^^^ required by this bound in `bar`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr
index 272feb1e379..8e9a16619f3 100644
--- a/src/test/ui/issues/issue-34349.stderr
+++ b/src/test/ui/issues/issue-34349.stderr
@@ -7,7 +7,15 @@ LL |         farewell.push_str("!!!");
    |         -------- closure is `FnMut` because it mutates the variable `farewell` here
 ...
 LL |     apply(diary);
-   |           ----- the requirement to implement `Fn` derives from here
+   |     ----- ----- the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `apply`
+  --> $DIR/issue-34349.rs:11:32
+   |
+LL |     fn apply<F>(f: F) where F: Fn() {
+   |                                ^^^^ required by this bound in `apply`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr
index 683162a5dae..eba65a61803 100644
--- a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr
+++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr
@@ -8,7 +8,15 @@ LL |         drop::<U>(_x1);
    |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
 ...
 LL |     accept_fn_mut(&c1);
-   |                   --- the requirement to implement `FnMut` derives from here
+   |     ------------- --- the requirement to implement `FnMut` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `accept_fn_mut`
+  --> $DIR/move-ref-patterns-closure-captures.rs:4:31
+   |
+LL |     fn accept_fn_mut(_: &impl FnMut()) {}
+   |                               ^^^^^^^ required by this bound in `accept_fn_mut`
 
 error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
   --> $DIR/move-ref-patterns-closure-captures.rs:9:14
@@ -20,7 +28,15 @@ LL |         drop::<U>(_x1);
    |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
 ...
 LL |     accept_fn(&c1);
-   |               --- the requirement to implement `Fn` derives from here
+   |     --------- --- the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `accept_fn`
+  --> $DIR/move-ref-patterns-closure-captures.rs:5:27
+   |
+LL |     fn accept_fn(_: &impl Fn()) {}
+   |                           ^^^^ required by this bound in `accept_fn`
 
 error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
   --> $DIR/move-ref-patterns-closure-captures.rs:20:14
@@ -32,7 +48,15 @@ LL |         drop::<&mut U>(_x2);
    |                        --- closure is `FnMut` because it mutates the variable `_x2` here
 ...
 LL |     accept_fn(&c2);
-   |               --- the requirement to implement `Fn` derives from here
+   |     --------- --- the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `accept_fn`
+  --> $DIR/move-ref-patterns-closure-captures.rs:5:27
+   |
+LL |     fn accept_fn(_: &impl Fn()) {}
+   |                           ^^^^ required by this bound in `accept_fn`
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr
index 4ea1ee3c37a..635ebbb71d0 100644
--- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr
@@ -6,7 +6,17 @@ LL |     let c = || drop(y.0);
    |             |
    |             this closure implements `FnOnce`, not `Fn`
 LL |     foo(c);
-   |         - the requirement to implement `Fn` derives from here
+   |     --- - the requirement to implement `Fn` derives from here
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `foo`
+  --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:4:14
+   |
+LL | fn foo<F>(f: F)
+   |    --- required by a bound in this
+LL |     where F: Fn()
+   |              ^^^^ required by this bound in `foo`
 
 error: aborting due to previous error