diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-07-14 14:14:21 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-14 14:14:21 +0530 |
| commit | e5a86d7358520477b816e118200fc7dc664b3f6e (patch) | |
| tree | cc3b8f12948902b3551659742f499570ccce5951 /compiler/rustc_trait_selection/src | |
| parent | 103b8602b7e3cfc8301ab9e0981563bde3789ea7 (diff) | |
| parent | 9aa142b5f1cf85e9941f7f9a35caa604500dab8b (diff) | |
| download | rust-e5a86d7358520477b816e118200fc7dc664b3f6e.tar.gz rust-e5a86d7358520477b816e118200fc7dc664b3f6e.zip | |
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Implement `for<>` lifetime binder for closures
This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following:
```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
// ^^^^^^^^^^^--- new!
```
cc ``@Aaron1011`` ``@cjgillot``
Diffstat (limited to 'compiler/rustc_trait_selection/src')
3 files changed, 3 insertions, 3 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 8d7c6b26ba1..3ab9bc5622d 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1086,7 +1086,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { let hir = self.tcx.hir(); Some(match node { Node::Expr(&hir::Expr { - kind: hir::ExprKind::Closure { body, fn_decl_span, .. }, + kind: hir::ExprKind::Closure(&hir::Closure { body, fn_decl_span, .. }), .. }) => ( sm.guess_head_span(fn_decl_span), diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs index 7c9ee64a0c2..7e8872d9018 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs @@ -103,7 +103,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { }) }), hir::Node::Expr(hir::Expr { - kind: hir::ExprKind::Closure { body, movability, .. }, + kind: hir::ExprKind::Closure(hir::Closure { body, movability, .. }), .. }) => self.describe_generator(*body).or_else(|| { Some(if movability.is_some() { "an async closure" } else { "a closure" }) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index b08fc482186..ff4ef92f42e 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -786,7 +786,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // Get the name of the callable and the arguments to be used in the suggestion. let (snippet, sugg) = match hir.get_if_local(def_id) { Some(hir::Node::Expr(hir::Expr { - kind: hir::ExprKind::Closure { fn_decl, fn_decl_span, .. }, + kind: hir::ExprKind::Closure(hir::Closure { fn_decl, fn_decl_span, .. }), .. })) => { err.span_label(*fn_decl_span, "consider calling this closure"); |
