File tree 2 files changed +35
-2
lines changed
2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -676,15 +676,23 @@ impl Item {
676
676
}
677
677
let header = match * self . kind {
678
678
ItemKind :: ForeignFunctionItem ( _) => {
679
- let abi = tcx. fn_sig ( self . item_id . as_def_id ( ) . unwrap ( ) ) . abi ( ) ;
679
+ let def_id = self . item_id . as_def_id ( ) . unwrap ( ) ;
680
+ let abi = tcx. fn_sig ( def_id) . abi ( ) ;
680
681
hir:: FnHeader {
681
682
unsafety : if abi == Abi :: RustIntrinsic {
682
683
intrinsic_operation_unsafety ( tcx, self . item_id . as_def_id ( ) . unwrap ( ) )
683
684
} else {
684
685
hir:: Unsafety :: Unsafe
685
686
} ,
686
687
abi,
687
- constness : hir:: Constness :: NotConst ,
688
+ constness : if abi == Abi :: RustIntrinsic
689
+ && tcx. is_const_fn ( def_id)
690
+ && is_unstable_const_fn ( tcx, def_id) . is_none ( )
691
+ {
692
+ hir:: Constness :: Const
693
+ } else {
694
+ hir:: Constness :: NotConst
695
+ } ,
688
696
asyncness : hir:: IsAsync :: NotAsync ,
689
697
}
690
698
}
Original file line number Diff line number Diff line change
1
+ #![ feature( intrinsics) ]
2
+ #![ feature( staged_api) ]
3
+
4
+ #![ crate_name = "foo" ]
5
+ #![ stable( since="1.0.0" , feature="rust1" ) ]
6
+
7
+ extern "rust-intrinsic" {
8
+ // @has 'foo/fn.transmute.html'
9
+ // @has - '//pre[@class="rust fn"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U'
10
+ #[ stable( since="1.0.0" , feature="rust1" ) ]
11
+ #[ rustc_const_stable( feature = "const_transmute" , since = "1.56.0" ) ]
12
+ pub fn transmute < T , U > ( _: T ) -> U ;
13
+
14
+ // @has 'foo/fn.unreachable.html'
15
+ // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !'
16
+ #[ stable( since="1.0.0" , feature="rust1" ) ]
17
+ pub fn unreachable ( ) -> !;
18
+ }
19
+
20
+ extern "C" {
21
+ // @has 'foo/fn.needs_drop.html'
22
+ // @has - '//pre[@class="rust fn"]' 'pub unsafe extern "C" fn needs_drop() -> !'
23
+ #[ stable( since="1.0.0" , feature="rust1" ) ]
24
+ pub fn needs_drop ( ) -> !;
25
+ }
You can’t perform that action at this time.
0 commit comments