File tree Expand file tree Collapse file tree 4 files changed +43
-15
lines changed Expand file tree Collapse file tree 4 files changed +43
-15
lines changed Original file line number Diff line number Diff line change @@ -1721,7 +1721,7 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
17211721 where_predicates : Vec :: new ( )
17221722 } ,
17231723 decl : ( cx. map . local_def_id ( 0 ) , & fty. sig ) . clean ( cx) ,
1724- abi : fty. abi . to_string ( ) ,
1724+ abi : fty. abi ,
17251725 } ) ,
17261726 ty:: TyStruct ( def, substs) |
17271727 ty:: TyEnum ( def, substs) => {
@@ -2143,7 +2143,7 @@ pub struct BareFunctionDecl {
21432143 pub unsafety : hir:: Unsafety ,
21442144 pub generics : Generics ,
21452145 pub decl : FnDecl ,
2146- pub abi : String ,
2146+ pub abi : Abi ,
21472147}
21482148
21492149impl Clean < BareFunctionDecl > for hir:: BareFnTy {
@@ -2156,7 +2156,7 @@ impl Clean<BareFunctionDecl> for hir::BareFnTy {
21562156 where_predicates : Vec :: new ( )
21572157 } ,
21582158 decl : self . decl . clean ( cx) ,
2159- abi : self . abi . to_string ( ) ,
2159+ abi : self . abi ,
21602160 }
21612161 }
21622162}
Original file line number Diff line number Diff line change @@ -468,11 +468,7 @@ impl fmt::Display for clean::Type {
468468 clean:: BareFunction ( ref decl) => {
469469 write ! ( f, "{}{}fn{}{}" ,
470470 UnsafetySpace ( decl. unsafety) ,
471- match & * decl. abi {
472- "" => " extern " . to_string( ) ,
473- "\" Rust\" " => "" . to_string( ) ,
474- s => format!( " extern {} " , s)
475- } ,
471+ AbiSpace ( decl. abi) ,
476472 decl. generics,
477473 decl. decl)
478474 }
@@ -788,7 +784,7 @@ impl fmt::Display for AbiSpace {
788784 match self . 0 {
789785 Abi :: Rust => Ok ( ( ) ) ,
790786 Abi :: C => write ! ( f, "extern " ) ,
791- abi => write ! ( f, "extern {} " , abi) ,
787+ abi => write ! ( f, "extern "{}" " , abi. name ( ) ) ,
792788 }
793789 }
794790}
Original file line number Diff line number Diff line change @@ -2158,8 +2158,6 @@ fn render_assoc_item(w: &mut fmt::Formatter,
21582158 d : & clean:: FnDecl ,
21592159 link : AssocItemLink )
21602160 -> fmt:: Result {
2161- use syntax:: abi:: Abi ;
2162-
21632161 let name = meth. name . as_ref ( ) . unwrap ( ) ;
21642162 let anchor = format ! ( "#{}.{}" , shortty( meth) , name) ;
21652163 let href = match link {
@@ -2186,10 +2184,7 @@ fn render_assoc_item(w: &mut fmt::Formatter,
21862184 {generics}{decl}{where_clause}",
21872185 ConstnessSpace ( vis_constness) ,
21882186 UnsafetySpace ( unsafety) ,
2189- match abi {
2190- Abi :: Rust => String :: new( ) ,
2191- a => format!( "extern {} " , a. to_string( ) )
2192- } ,
2187+ AbiSpace ( abi) ,
21932188 href = href,
21942189 name = name,
21952190 generics = * g,
Original file line number Diff line number Diff line change 1+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ #![ crate_name = "foo" ]
12+
13+ // @has foo/struct.Foo.html
14+ pub struct Foo ;
15+
16+ impl Foo {
17+ // @has - '//code' 'fn rust0()'
18+ pub fn rust0 ( ) { }
19+ // @has - '//code' 'fn rust1()'
20+ pub extern "Rust" fn rust1 ( ) { }
21+ // @has - '//code' 'extern fn c0()'
22+ pub extern fn c0 ( ) { }
23+ // @has - '//code' 'extern fn c1()'
24+ pub extern "C" fn c1 ( ) { }
25+ // @has - '//code' 'extern "system" fn system0()'
26+ pub extern "system" fn system0 ( ) { }
27+ }
28+
29+ // @has foo/trait.Bar.html
30+ pub trait Bar { }
31+
32+ // @has - '//code' 'impl Bar for fn()'
33+ impl Bar for fn ( ) { }
34+ // @has - '//code' 'impl Bar for extern fn()'
35+ impl Bar for extern fn ( ) { }
36+ // @has - '//code' 'impl Bar for extern "system" fn()'
37+ impl Bar for extern "system" fn ( ) { }
You can’t perform that action at this time.
0 commit comments