File tree 4 files changed +43
-15
lines changed
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> {
1721
1721
where_predicates : Vec :: new ( )
1722
1722
} ,
1723
1723
decl : ( cx. map . local_def_id ( 0 ) , & fty. sig ) . clean ( cx) ,
1724
- abi : fty. abi . to_string ( ) ,
1724
+ abi : fty. abi ,
1725
1725
} ) ,
1726
1726
ty:: TyStruct ( def, substs) |
1727
1727
ty:: TyEnum ( def, substs) => {
@@ -2143,7 +2143,7 @@ pub struct BareFunctionDecl {
2143
2143
pub unsafety : hir:: Unsafety ,
2144
2144
pub generics : Generics ,
2145
2145
pub decl : FnDecl ,
2146
- pub abi : String ,
2146
+ pub abi : Abi ,
2147
2147
}
2148
2148
2149
2149
impl Clean < BareFunctionDecl > for hir:: BareFnTy {
@@ -2156,7 +2156,7 @@ impl Clean<BareFunctionDecl> for hir::BareFnTy {
2156
2156
where_predicates : Vec :: new ( )
2157
2157
} ,
2158
2158
decl : self . decl . clean ( cx) ,
2159
- abi : self . abi . to_string ( ) ,
2159
+ abi : self . abi ,
2160
2160
}
2161
2161
}
2162
2162
}
Original file line number Diff line number Diff line change @@ -468,11 +468,7 @@ impl fmt::Display for clean::Type {
468
468
clean:: BareFunction ( ref decl) => {
469
469
write ! ( f, "{}{}fn{}{}" ,
470
470
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) ,
476
472
decl. generics,
477
473
decl. decl)
478
474
}
@@ -788,7 +784,7 @@ impl fmt::Display for AbiSpace {
788
784
match self . 0 {
789
785
Abi :: Rust => Ok ( ( ) ) ,
790
786
Abi :: C => write ! ( f, "extern " ) ,
791
- abi => write ! ( f, "extern {} " , abi) ,
787
+ abi => write ! ( f, "extern "{}" " , abi. name ( ) ) ,
792
788
}
793
789
}
794
790
}
Original file line number Diff line number Diff line change @@ -2158,8 +2158,6 @@ fn render_assoc_item(w: &mut fmt::Formatter,
2158
2158
d : & clean:: FnDecl ,
2159
2159
link : AssocItemLink )
2160
2160
-> fmt:: Result {
2161
- use syntax:: abi:: Abi ;
2162
-
2163
2161
let name = meth. name . as_ref ( ) . unwrap ( ) ;
2164
2162
let anchor = format ! ( "#{}.{}" , shortty( meth) , name) ;
2165
2163
let href = match link {
@@ -2186,10 +2184,7 @@ fn render_assoc_item(w: &mut fmt::Formatter,
2186
2184
{generics}{decl}{where_clause}",
2187
2185
ConstnessSpace ( vis_constness) ,
2188
2186
UnsafetySpace ( unsafety) ,
2189
- match abi {
2190
- Abi :: Rust => String :: new( ) ,
2191
- a => format!( "extern {} " , a. to_string( ) )
2192
- } ,
2187
+ AbiSpace ( abi) ,
2193
2188
href = href,
2194
2189
name = name,
2195
2190
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