@@ -16,51 +16,14 @@ use std;
16
16
17
17
use llvm;
18
18
use llvm:: { ValueRef } ;
19
- use rustc:: traits;
20
- use rustc:: ty:: { self , Ty , TypeFoldable } ;
19
+ use rustc:: ty:: { self , Ty } ;
21
20
use rustc:: ty:: layout:: LayoutTyper ;
22
21
use common:: * ;
23
22
use meth;
24
23
use monomorphize;
25
24
use value:: Value ;
26
25
use builder:: Builder ;
27
26
28
- pub fn needs_drop_glue < ' a , ' tcx > ( scx : & SharedCrateContext < ' a , ' tcx > , t : Ty < ' tcx > ) -> bool {
29
- assert ! ( t. is_normalized_for_trans( ) ) ;
30
-
31
- let t = scx. tcx ( ) . erase_regions ( & t) ;
32
-
33
- // FIXME (#22815): note that type_needs_drop conservatively
34
- // approximates in some cases and may say a type expression
35
- // requires drop glue when it actually does not.
36
- //
37
- // (In this case it is not clear whether any harm is done, i.e.
38
- // erroneously returning `true` in some cases where we could have
39
- // returned `false` does not appear unsound. The impact on
40
- // code quality is unknown at this time.)
41
-
42
- if !scx. type_needs_drop ( t) {
43
- return false ;
44
- }
45
- match t. sty {
46
- ty:: TyAdt ( def, _) if def. is_box ( ) => {
47
- let typ = t. boxed_ty ( ) ;
48
- if !scx. type_needs_drop ( typ) && scx. type_is_sized ( typ) {
49
- let layout = t. layout ( scx. tcx ( ) , ty:: ParamEnv :: empty ( traits:: Reveal :: All ) ) . unwrap ( ) ;
50
- if layout. size ( scx) . bytes ( ) == 0 {
51
- // `Box<ZeroSizeType>` does not allocate.
52
- false
53
- } else {
54
- true
55
- }
56
- } else {
57
- true
58
- }
59
- }
60
- _ => true
61
- }
62
- }
63
-
64
27
pub fn size_and_align_of_dst < ' a , ' tcx > ( bcx : & Builder < ' a , ' tcx > , t : Ty < ' tcx > , info : ValueRef )
65
28
-> ( ValueRef , ValueRef ) {
66
29
debug ! ( "calculate size of DST: {}; with lost info: {:?}" ,
0 commit comments