Skip to content

Commit 7031f90

Browse files
author
bors-servo
authored
Auto merge of #167 - servo:rustup, r=nox
Drop flags are dead, long live MIR! <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/string-cache/167) <!-- Reviewable:end -->
2 parents 9abce78 + 4c0ee07 commit 7031f90

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "string_cache"
4-
version = "0.2.24"
4+
version = "0.2.25"
55
authors = [ "The Servo Project Developers" ]
66
description = "A string interning library for Rust, developed as part of the Servo project."
77
license = "MIT / Apache-2.0"

src/atom/mod.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ impl StringCache {
169169

170170
// NOTE: Deriving Eq here implies that a given string must always
171171
// be interned the same way.
172-
#[cfg_attr(feature = "unstable", unsafe_no_drop_flag)] // See tests::atom_drop_is_idempotent
173172
#[derive(Eq, Hash, PartialEq)]
174173
pub struct Atom {
175174
/// This field is public so that the `atom!()` macro can use it.
@@ -714,9 +713,16 @@ mod tests {
714713

715714
#[test]
716715
fn assert_sizes() {
717-
// Guard against accidental changes to the sizes of things.
718716
use std::mem;
719-
assert_eq!(if cfg!(feature = "unstable") { 8 } else { 16 }, mem::size_of::<super::Atom>());
717+
struct EmptyWithDrop;
718+
impl Drop for EmptyWithDrop {
719+
fn drop(&mut self) {}
720+
}
721+
let compiler_uses_inline_drop_flags = mem::size_of::<EmptyWithDrop>() > 0;
722+
723+
// Guard against accidental changes to the sizes of things.
724+
assert_eq!(mem::size_of::<super::Atom>(),
725+
if compiler_uses_inline_drop_flags { 16 } else { 8 });
720726
assert_eq!(40, mem::size_of::<super::StringCacheEntry>());
721727
}
722728

@@ -771,18 +777,6 @@ mod tests {
771777
let _: &str = atom.as_ref();
772778
}
773779

774-
/// Atom uses #[unsafe_no_drop_flag] to stay small, so drop() may be called more than once.
775-
/// In calls after the first one, the atom will be filled with a POST_DROP value.
776-
/// drop() must be a no-op in this case.
777-
#[cfg(feature = "unstable")]
778-
#[test]
779-
fn atom_drop_is_idempotent() {
780-
use super::from_packed_dynamic;
781-
unsafe {
782-
assert_eq!(from_packed_dynamic(mem::POST_DROP_U64), None);
783-
}
784-
}
785-
786780
#[test]
787781
fn string_cache_entry_alignment_is_sufficient() {
788782
assert!(mem::align_of::<StringCacheEntry>() >= ENTRY_ALIGNMENT);

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#![crate_type = "rlib"]
1212

1313
#![cfg_attr(test, deny(warnings))]
14-
#![cfg_attr(all(test, feature = "unstable"), feature(test, filling_drop))]
15-
#![cfg_attr(feature = "unstable", feature(unsafe_no_drop_flag))]
14+
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
1615

1716
#[cfg(all(test, feature = "unstable"))] extern crate test;
1817
#[cfg(feature = "log-events")] extern crate rustc_serialize;

0 commit comments

Comments
 (0)