Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitor
Rollup of 11 pull requests Successful merges: - #96240 (Stabilize `const_ptr_offset_from`.) - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default) - #100811 (Fix wrong compiletest filters on Windows) - #100924 (Smaller improvements of tidy and the unicode generator) - #100953 (Update documentation for `write!` and `writeln!`) - #101018 (rustdoc: omit start/end tags for empty item description blocks) - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`) - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`) - #101057 (Merge implementations of HIR fn_decl and fn_sig.) - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script) - #101063 (Merge duplicated CSS rules) Failed merges: - #101055 (Use smaller span for suggestions) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
d0e1491ecd
29 changed files with 132 additions and 147 deletions
|
@ -17,28 +17,6 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
|||
use rustc_span::Span;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
fn fn_decl<'hir>(node: Node<'hir>) -> Option<&'hir FnDecl<'hir>> {
|
||||
match node {
|
||||
Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. })
|
||||
| Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(sig, _), .. })
|
||||
| Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(sig, _), .. }) => Some(&sig.decl),
|
||||
Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. })
|
||||
| Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_decl, ..), .. }) => {
|
||||
Some(fn_decl)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fn_sig<'hir>(node: Node<'hir>) -> Option<&'hir FnSig<'hir>> {
|
||||
match &node {
|
||||
Node::Item(Item { kind: ItemKind::Fn(sig, _, _), .. })
|
||||
| Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(sig, _), .. })
|
||||
| Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(sig, _), .. }) => Some(sig),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
|
||||
match node {
|
||||
|
@ -389,7 +367,7 @@ impl<'hir> Map<'hir> {
|
|||
|
||||
pub fn fn_decl_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnDecl<'hir>> {
|
||||
if let Some(node) = self.find(hir_id) {
|
||||
fn_decl(node)
|
||||
node.fn_decl()
|
||||
} else {
|
||||
bug!("no node for hir_id `{}`", hir_id)
|
||||
}
|
||||
|
@ -397,7 +375,7 @@ impl<'hir> Map<'hir> {
|
|||
|
||||
pub fn fn_sig_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnSig<'hir>> {
|
||||
if let Some(node) = self.find(hir_id) {
|
||||
fn_sig(node)
|
||||
node.fn_sig()
|
||||
} else {
|
||||
bug!("no node for hir_id `{}`", hir_id)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue