forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This supports finalizer elision by implementing DropMethodFinalizerElidable on the backing table.
- Loading branch information
1 parent
75a0931
commit 429a592
Showing
6 changed files
with
84 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//@ run-pass | ||
// ignore-tidy-linelength | ||
#![feature(gc)] | ||
#![allow(dead_code)] | ||
include!{"./auxiliary/types.rs"} | ||
|
||
use std::mem::needs_finalizer; | ||
use std::collections::HashMap; | ||
use std::gc::Gc; | ||
|
||
static HM_TRIVIAL: bool = needs_finalizer::<HashMap<usize, usize>>(); | ||
static HM_FIN_KEY: bool = needs_finalizer::<HashMap<HasDrop, HasDropNoFinalize>>(); | ||
static HM_FIN_VAL: bool = needs_finalizer::<HashMap<HasDropNoFinalize, HasDrop>>(); | ||
static HM_FIN_BOTH: bool = needs_finalizer::<HashMap<HasDrop, HasDrop>>(); | ||
static HM_FIN_GC_KEY: bool = needs_finalizer::<HashMap<Gc<HasDropNoFinalize>, Gc<HasDrop>>>(); | ||
static HM_FIN_GC_VAL: bool = needs_finalizer::<HashMap<Gc<HasDropNoFinalize>, Gc<HasDrop>>>(); | ||
static HM_FIN_GC_BOTH: bool = needs_finalizer::<HashMap<Gc<HasDrop>, Gc<HasDrop>>>(); | ||
|
||
fn main() { | ||
assert!(!HM_TRIVIAL); | ||
assert!(HM_FIN_KEY); | ||
assert!(HM_FIN_VAL); | ||
assert!(HM_FIN_BOTH); | ||
assert!(!HM_FIN_GC_KEY); | ||
assert!(!HM_FIN_GC_VAL); | ||
assert!(!HM_FIN_GC_BOTH); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//@ run-pass | ||
// ignore-tidy-linelength | ||
#![feature(gc)] | ||
#![allow(dead_code)] | ||
include!{"./auxiliary/types.rs"} | ||
|
||
use std::mem::needs_finalizer; | ||
use std::collections::HashSet; | ||
use std::gc::Gc; | ||
|
||
static HS_TRIVIAL: bool = needs_finalizer::<HashSet<usize>>(); | ||
static HS_FINALIZABLE: bool = needs_finalizer::<HashSet<HasDrop>>(); | ||
static HS_UNFINALIZABLE: bool = needs_finalizer::<HashSet<HasDropNoFinalize>>(); | ||
static HS_TUPLE_UNFINALIZABLE: bool = needs_finalizer::<HashSet<(HasDropNoFinalize, usize)>>(); | ||
static HS_TUPLE_FINALIZABLE: bool = needs_finalizer::<HashSet<(HasDrop, HasDrop)>>(); | ||
static HS_TUPLE_CONTAINS_FINALIZABLE: bool = needs_finalizer::<HashSet<(HasDrop, usize)>>(); | ||
static HS_HS_FINALIZABLE: bool = needs_finalizer::<HashSet<HashSet<HasDrop>>>(); | ||
static HS_HS_UNFINALIZABLE: bool = needs_finalizer::<HashSet<HashSet<HasDropNoFinalize>>>(); | ||
static HS_STRING: bool = needs_finalizer::<HashSet<String>>(); | ||
static HS_BOX_FINALIZABLE: bool = needs_finalizer::<HashSet<Box<HasDrop>>>(); | ||
static HS_BOX_UNFINALIZABLE: bool = needs_finalizer::<HashSet<Box<HasDropNoFinalize>>>(); | ||
static HS_TUPLE_GC_UNFINALIZABLE: bool = needs_finalizer::<HashSet<(HasDropNoFinalize, Gc<HasDrop>)>>(); | ||
static HS_TUPLE_GC_FINALIZABLE: bool = needs_finalizer::<HashSet<(HasDrop, Gc<HasDrop>)>>(); | ||
static HS_COLLECTABLE_NO_DROP_ELEMENT: bool = needs_finalizer::<HashSet<NonAnnotated>>(); | ||
|
||
fn main() { | ||
assert!(!HS_TRIVIAL); | ||
assert!(HS_FINALIZABLE); | ||
assert!(!HS_UNFINALIZABLE); | ||
assert!(!HS_TUPLE_UNFINALIZABLE); | ||
assert!(HS_TUPLE_FINALIZABLE); | ||
assert!(HS_TUPLE_CONTAINS_FINALIZABLE); | ||
assert!(HS_HS_FINALIZABLE); | ||
assert!(!HS_HS_UNFINALIZABLE); | ||
assert!(!HS_STRING); | ||
assert!(HS_BOX_FINALIZABLE); | ||
assert!(!HS_BOX_UNFINALIZABLE); | ||
assert!(!HS_TUPLE_GC_UNFINALIZABLE); | ||
assert!(HS_TUPLE_GC_FINALIZABLE); | ||
assert!(!HS_COLLECTABLE_NO_DROP_ELEMENT); | ||
} |