diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-01-29 14:16:31 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-02-02 11:52:34 -0800 |
| commit | 8d48597b76ef656a1a1f600c96176d1aaeab32ff (patch) | |
| tree | 13434e4338607616874e9b83a9f71cdcf2bc07b8 /src | |
| parent | 972ae5afe5c38cbf80552179fc9051d78f983ca1 (diff) | |
| download | rust-8d48597b76ef656a1a1f600c96176d1aaeab32ff.tar.gz rust-8d48597b76ef656a1a1f600c96176d1aaeab32ff.zip | |
Point at return type obligations instead of at `fn` ident
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/check/wfcheck.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 214e7d066ea..3a4a015c14a 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -530,7 +530,7 @@ fn check_where_clauses<'tcx, 'fcx>( fcx: &FnCtxt<'fcx, 'tcx>, span: Span, def_id: DefId, - return_ty: Option<Ty<'tcx>>, + return_ty: Option<(Ty<'tcx>, Span)>, ) { debug!("check_where_clauses(def_id={:?}, return_ty={:?})", def_id, return_ty); @@ -664,7 +664,7 @@ fn check_where_clauses<'tcx, 'fcx>( let mut predicates = predicates.instantiate_identity(fcx.tcx); - if let Some(return_ty) = return_ty { + if let Some((return_ty, span)) = return_ty { predicates.predicates.extend(check_opaque_types(tcx, fcx, def_id, span, return_ty)); } @@ -708,7 +708,7 @@ fn check_fn_or_method<'fcx, 'tcx>( // FIXME(#25759) return types should not be implied bounds implied_bounds.push(sig.output()); - check_where_clauses(tcx, fcx, span, def_id, Some(sig.output())); + check_where_clauses(tcx, fcx, span, def_id, Some((sig.output(), hir_sig.decl.output.span()))); } /// Checks "defining uses" of opaque `impl Trait` types to ensure that they meet the restrictions diff --git a/src/test/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr b/src/test/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr index 8cc6f7c3037..08b26b8fc13 100644 --- a/src/test/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr @@ -1,8 +1,8 @@ error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_lifetime_param.rs:7:4 + --> $DIR/generic_duplicate_lifetime_param.rs:7:26 | LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> { - | ^^^ + | ^^^^^^^^^^^ | note: lifetime used multiple times --> $DIR/generic_duplicate_lifetime_param.rs:5:10 |
