@@ -16,51 +16,14 @@ use std;
1616
1717use llvm;
1818use llvm:: { ValueRef } ;
19- use rustc:: traits;
20- use rustc:: ty:: { self , Ty , TypeFoldable } ;
19+ use rustc:: ty:: { self , Ty } ;
2120use rustc:: ty:: layout:: LayoutTyper ;
2221use common:: * ;
2322use meth;
2423use monomorphize;
2524use value:: Value ;
2625use builder:: Builder ;
2726
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-
6427pub fn size_and_align_of_dst < ' a , ' tcx > ( bcx : & Builder < ' a , ' tcx > , t : Ty < ' tcx > , info : ValueRef )
6528 -> ( ValueRef , ValueRef ) {
6629 debug ! ( "calculate size of DST: {}; with lost info: {:?}" ,
0 commit comments