diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index b99a4a03de9..5e41c51abd9 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2024,17 +2024,6 @@ pub struct FnHeader { pub abi: Abi, } -impl Default for FnHeader { - fn default() -> FnHeader { - FnHeader { - unsafety: Unsafety::Normal, - constness: Constness::NotConst, - asyncness: IsAsync::NotAsync, - abi: Abi::Rust, - } - } -} - #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Item_ { /// An `extern crate` item, with optional *original* crate name if the crate was renamed. diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 4db2247103e..51a7504efcf 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -459,7 +459,12 @@ impl<'a> State<'a> { hir::ForeignItemFn(ref decl, ref arg_names, ref generics) => { self.head("")?; self.print_fn(decl, - hir::FnHeader::default(), + hir::FnHeader { + unsafety: hir::Unsafety::Normal, + constness: hir::Constness::NotConst, + abi: Abi::Rust, + asyncness: hir::IsAsync::NotAsync, + }, Some(item.name), generics, &item.vis, @@ -2253,8 +2258,10 @@ impl<'a> State<'a> { }; self.print_fn(decl, hir::FnHeader { - unsafety, abi, - ..hir::FnHeader::default() + unsafety, + abi, + constness: hir::Constness::NotConst, + asyncness: hir::IsAsync::NotAsync, }, name, &generics, diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 0021ceac315..ad7389db729 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -202,7 +202,7 @@ fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function { unsafety: sig.unsafety(), abi: sig.abi(), constness, - ..hir::FnHeader::default() + asyncness: hir::IsAsync::NotAsync, } } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7bebefc41f9..057e7f3ab84 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2457,7 +2457,7 @@ impl<'tcx> Clean for ty::AssociatedItem { unsafety: sig.unsafety(), abi: sig.abi(), constness, - ..hir::FnHeader::default() + asyncness: hir::IsAsync::NotAsync, } }) } else { @@ -2467,7 +2467,8 @@ impl<'tcx> Clean for ty::AssociatedItem { header: hir::FnHeader { unsafety: sig.unsafety(), abi: sig.abi(), - ..hir::FnHeader::default() + constness: hir::Constness::NotConst, + asyncness: hir::IsAsync::NotAsync, } }) } @@ -4007,7 +4008,12 @@ impl Clean for hir::ForeignItem { ForeignFunctionItem(Function { decl, generics, - header: hir::FnHeader::default(), + header: hir::FnHeader { + unsafety: hir::Unsafety::Unsafe, + abi: Abi::Rust, + constness: hir::Constness::NotConst, + asyncness: hir::IsAsync::NotAsync, + }, }) } hir::ForeignItemStatic(ref ty, mutbl) => { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index a0f29f5918e..f7be4f58dfb 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2577,20 +2577,20 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, let name_len = format!("{}{}{}{}{:#}fn {}{:#}", VisSpace(&it.visibility), ConstnessSpace(f.header.constness), - AsyncSpace(f.header.asyncness), UnsafetySpace(f.header.unsafety), + AsyncSpace(f.header.asyncness), AbiSpace(f.header.abi), it.name.as_ref().unwrap(), f.generics).len(); write!(w, "{}
", render_spotlight_traits(it)?)?;
     render_attributes(w, it)?;
     write!(w,
-           "{vis}{constness}{asyncness}{unsafety}{abi}fn \
+           "{vis}{constness}{unsafety}{asyncness}{abi}fn \
            {name}{generics}{decl}{where_clause}
", vis = VisSpace(&it.visibility), constness = ConstnessSpace(f.header.constness), - asyncness = AsyncSpace(f.header.asyncness), unsafety = UnsafetySpace(f.header.unsafety), + asyncness = AsyncSpace(f.header.asyncness), abi = AbiSpace(f.header.abi), name = it.name.as_ref().unwrap(), generics = f.generics, @@ -3024,10 +3024,11 @@ fn render_assoc_item(w: &mut fmt::Formatter, href(did).map(|p| format!("{}#{}.{}", p.0, ty, name)).unwrap_or(anchor) } }; - let mut head_len = format!("{}{}{}{:#}fn {}{:#}", + let mut head_len = format!("{}{}{}{}{:#}fn {}{:#}", VisSpace(&meth.visibility), ConstnessSpace(header.constness), UnsafetySpace(header.unsafety), + AsyncSpace(header.asyncness), AbiSpace(header.abi), name, *g).len(); @@ -3038,11 +3039,12 @@ fn render_assoc_item(w: &mut fmt::Formatter, (0, true) }; render_attributes(w, meth)?; - write!(w, "{}{}{}{}fn {name}\ + write!(w, "{}{}{}{}{}fn {name}\ {generics}{decl}{where_clause}", VisSpace(&meth.visibility), ConstnessSpace(header.constness), UnsafetySpace(header.unsafety), + AsyncSpace(header.asyncness), AbiSpace(header.abi), href = href, name = name,