Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dd4851d

Browse files
committedFeb 13, 2021
Auto merge of #82053 - JohnTitor:rollup-ymi9q0g, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #81811 (Fix doc test for Vec::retain(), now passes clippy::eval_order_dependence) - #81900 (Organize trait test files) - #81995 (Fix suggestion to introduce explicit lifetime) - #82031 (Drop an unnecessary intermediate variable) - #82033 (Refactor `get_word_attr` to return only `Option`) - #82040 (Add test to prevent src link regression) - #82041 (Add docs for shared_from_slice From impls) - #82050 (Added tests to drain an empty vec) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 21cbbdc + 0ca5fd7 commit dd4851d

File tree

300 files changed

+491
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+491
-309
lines changed
 

‎compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,13 +2248,18 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
22482248
"...",
22492249
);
22502250
if let Some(infer::RelateParamBound(_, t)) = origin {
2251+
let return_impl_trait = self
2252+
.in_progress_typeck_results
2253+
.map(|typeck_results| typeck_results.borrow().hir_owner)
2254+
.and_then(|owner| self.tcx.return_type_impl_trait(owner))
2255+
.is_some();
22512256
let t = self.resolve_vars_if_possible(t);
22522257
match t.kind() {
22532258
// We've got:
22542259
// fn get_later<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
22552260
// suggest:
22562261
// fn get_later<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
2257-
ty::Closure(_, _substs) | ty::Opaque(_, _substs) => {
2262+
ty::Closure(_, _substs) | ty::Opaque(_, _substs) if return_impl_trait => {
22582263
new_binding_suggestion(&mut err, type_param_span, bound_kind);
22592264
}
22602265
_ => {

‎compiler/rustc_typeck/src/check/upvar.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
260260
// local crate or were inlined into it along with some function.
261261
// This may change if abstract return types of some sort are
262262
// implemented.
263-
let tcx = self.tcx;
264-
265263
self.typeck_results
266264
.borrow()
267265
.closure_min_captures_flattened(closure_id)
@@ -276,7 +274,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
276274

277275
match capture {
278276
ty::UpvarCapture::ByValue(_) => upvar_ty,
279-
ty::UpvarCapture::ByRef(borrow) => tcx.mk_ref(
277+
ty::UpvarCapture::ByRef(borrow) => self.tcx.mk_ref(
280278
borrow.region,
281279
ty::TypeAndMut { ty: upvar_ty, mutbl: borrow.kind.to_mutbl_lossy() },
282280
),

0 commit comments

Comments
 (0)
Please sign in to comment.