Skip to content

Commit 038c022

Browse files
Auto merge of #144841 - cjgillot:typeck-no-attrs, r=<try>
Access less HIR attributes from typeck
2 parents f34ba77 + bf644e9 commit 038c022

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ use rustc_data_structures::unord::UnordSet;
4646
use rustc_errors::codes::*;
4747
use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
4848
use rustc_hir as hir;
49-
use rustc_hir::attrs::AttributeKind;
5049
use rustc_hir::def::{DefKind, Res};
51-
use rustc_hir::{HirId, HirIdMap, Node, find_attr};
50+
use rustc_hir::{HirId, HirIdMap, Node};
5251
use rustc_hir_analysis::check::{check_abi, check_custom_abi};
5352
use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer;
5453
use rustc_infer::traits::{ObligationCauseCode, ObligationInspector, WellFormedLoc};
54+
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
5555
use rustc_middle::query::Providers;
5656
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
5757
use rustc_middle::{bug, span_bug};
@@ -174,7 +174,7 @@ fn typeck_with_inspect<'tcx>(
174174
.map(|(idx, ty)| fcx.normalize(arg_span(idx), ty)),
175175
);
176176

177-
if find_attr!(tcx.get_all_attrs(def_id), AttributeKind::Naked(..)) {
177+
if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NAKED) {
178178
naked_functions::typeck_naked_fn(tcx, def_id, body);
179179
}
180180

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,17 +2373,14 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
23732373
if !self.is_relevant_kind_for_mode(x.kind) {
23742374
return false;
23752375
}
2376-
if self.matches_by_doc_alias(x.def_id) {
2377-
return true;
2378-
}
2379-
match edit_distance_with_substrings(
2376+
if let Some(d) = edit_distance_with_substrings(
23802377
name.as_str(),
23812378
x.name().as_str(),
23822379
max_dist,
23832380
) {
2384-
Some(d) => d > 0,
2385-
None => false,
2381+
return d > 0;
23862382
}
2383+
self.matches_by_doc_alias(x.def_id)
23872384
})
23882385
.copied()
23892386
.collect()

0 commit comments

Comments
 (0)