Skip to content

Commit

Permalink
Add inline directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Mar 17, 2021
1 parent 97008d4 commit 4a5468b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_middle/src/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,21 @@ mod sealed {
use sealed::IntoQueryParam;

impl TyCtxt<'tcx> {
#[inline]
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
let def_id = def_id.into_query_param();
self.opt_def_kind(def_id)
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", def_id))
}

#[inline]
pub fn fn_sig(self, def_id: impl IntoQueryParam<DefId>) -> ty::PolyFnSig<'tcx> {
let def_id = def_id.into_query_param();
self.try_fn_sig(def_id)
.unwrap_or_else(|s| span_bug!(self.def_span(def_id), "fn_sig: {}", s))
}

#[inline]
pub fn type_of(self, def_id: impl IntoQueryParam<DefId>) -> Ty<'tcx> {
let def_id = def_id.into_query_param();
self.try_type_of(def_id).unwrap_or_else(|msg| {
Expand All @@ -329,18 +332,21 @@ impl TyCtxt<'tcx> {
}

impl TyCtxtAt<'tcx> {
#[inline]
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
let def_id = def_id.into_query_param();
self.opt_def_kind(def_id)
.unwrap_or_else(|| bug!("def_kind: unsupported node: {:?}", def_id))
}

#[inline]
pub fn fn_sig(self, def_id: impl IntoQueryParam<DefId>) -> ty::PolyFnSig<'tcx> {
let def_id = def_id.into_query_param();
self.try_fn_sig(def_id)
.unwrap_or_else(|s| span_bug!(self.def_span(def_id), "fn_sig: {}", s))
}

#[inline]
pub fn type_of(self, def_id: impl IntoQueryParam<DefId>) -> Ty<'tcx> {
let def_id = def_id.into_query_param();
self.try_type_of(def_id).unwrap_or_else(|msg| {
Expand Down

0 comments on commit 4a5468b

Please sign in to comment.