diff options
| author | Adam Perry <adam.n.perry@gmail.com> | 2019-10-05 08:28:38 -0700 |
|---|---|---|
| committer | Adam Perry <adam.n.perry@gmail.com> | 2019-10-07 08:05:33 -0700 |
| commit | c49966bb1bc66cb14d66e2c116d187e781ee6776 (patch) | |
| tree | 6fefd830846c79dd138eedab7f4fbc2029ec4ca0 | |
| parent | 190212c6bf1588fb4349a16caa9c2796f9a795f4 (diff) | |
| download | rust-c49966bb1bc66cb14d66e2c116d187e781ee6776.tar.gz rust-c49966bb1bc66cb14d66e2c116d187e781ee6776.zip | |
Clarify variable names when checking track_caller methods.
| -rw-r--r-- | src/librustc_typeck/check/wfcheck.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 051bd671d44..fa283904fe4 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -196,19 +196,18 @@ pub fn check_impl_item(tcx: TyCtxt<'_>, def_id: DefId) { }; // Prohibits applying `#[track_caller]` to trait impls - if method_sig.is_some() { + if method_sig.is_some() { let track_caller_attr = impl_item.attrs.iter() .find(|a| a.check_name(sym::track_caller)); if let Some(tc_attr) = track_caller_attr { let parent_hir_id = tcx.hir().get_parent_item(hir_id); let containing_item = tcx.hir().expect_item(parent_hir_id); - let containing_impl_trait_ref = match &containing_item.kind { - hir::ItemKind::Impl(_, _, _, _, tr, _, _) => tr, + let containing_impl_is_for_trait = match &containing_item.kind { + hir::ItemKind::Impl(_, _, _, _, tr, _, _) => tr.is_some(), _ => bug!("parent of an ImplItem must be an Impl"), }; - // if the impl block this item is within is for a trait... - if containing_impl_trait_ref.is_some() { + if containing_impl_is_for_trait { struct_span_err!( tcx.sess, tc_attr.span, |
