File tree Expand file tree Collapse file tree 3 files changed +48
-5
lines changed Expand file tree Collapse file tree 3 files changed +48
-5
lines changed Original file line number Diff line number Diff line change @@ -521,16 +521,23 @@ pub fn get_res_dtor(ccx: @mut CrateContext,
521
521
substs: &[ty::t])
522
522
-> ValueRef {
523
523
let _icx = push_ctxt(" trans_res_dtor") ;
524
+ let did = if did. crate != ast:: LOCAL_CRATE {
525
+ inline:: maybe_instantiate_inline ( ccx, did)
526
+ } else {
527
+ did
528
+ } ;
524
529
if !substs. is_empty ( ) {
525
- let did = if did. crate != ast:: LOCAL_CRATE {
526
- inline:: maybe_instantiate_inline ( ccx, did)
527
- } else {
528
- did
529
- } ;
530
530
assert_eq ! ( did. crate , ast:: LOCAL_CRATE ) ;
531
531
let tsubsts = ty:: substs { regions : ty:: ErasedRegions ,
532
532
self_ty : None ,
533
533
tps : /*bad*/ substs. to_owned ( ) } ;
534
+
535
+ // FIXME: #4252: Generic destructors with type bounds are broken.
536
+ //
537
+ // Since the vtables aren't passed to `monomorphic_fn` here, generic destructors with type
538
+ // bounds are broken. Sadly, the `typeck` pass isn't outputting the necessary metadata
539
+ // because it does so based on method calls present in the AST. Destructor calls are not yet
540
+ // known about at that stage of compilation, since `trans` handles cleanups.
534
541
let ( val, _) = monomorphize:: monomorphic_fn ( ccx,
535
542
did,
536
543
& tsubsts,
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ #[ link( name="inline_dtor" , vers="0.1" ) ] ;
12
+
13
+ pub struct Foo ;
14
+
15
+ impl Drop for Foo {
16
+ #[ inline]
17
+ fn drop ( & mut self ) { }
18
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+ // aux-build:inline_dtor.rs
12
+ // xfail-fast
13
+
14
+ extern mod inline_dtor;
15
+
16
+ fn main ( ) {
17
+ let _x = inline_dtor:: Foo ;
18
+ }
You can’t perform that action at this time.
0 commit comments