Skip to content

Commit 8d90d3f

Browse files
committed
Remove all unstable deprecated functionality
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
1 parent d07d465 commit 8d90d3f

File tree

125 files changed

+1684
-15529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1684
-15529
lines changed

src/etc/unicode.py

-163
Original file line numberDiff line numberDiff line change
@@ -395,46 +395,6 @@ def emit_conversions_module(f, to_upper, to_lower, to_title):
395395
is_pub=False, t_type = t_type, pfun=pfun)
396396
f.write("}\n\n")
397397

398-
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
399-
f.write("""pub mod grapheme {
400-
use core::slice::SliceExt;
401-
pub use self::GraphemeCat::*;
402-
use core::result::Result::{Ok, Err};
403-
404-
#[allow(non_camel_case_types)]
405-
#[derive(Clone, Copy)]
406-
pub enum GraphemeCat {
407-
""")
408-
for cat in grapheme_cats + ["Any"]:
409-
f.write(" GC_" + cat + ",\n")
410-
f.write(""" }
411-
412-
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
413-
use core::cmp::Ordering::{Equal, Less, Greater};
414-
match r.binary_search_by(|&(lo, hi, _)| {
415-
if lo <= c && c <= hi { Equal }
416-
else if hi < c { Less }
417-
else { Greater }
418-
}) {
419-
Ok(idx) => {
420-
let (_, _, cat) = r[idx];
421-
cat
422-
}
423-
Err(_) => GC_Any
424-
}
425-
}
426-
427-
pub fn grapheme_category(c: char) -> GraphemeCat {
428-
bsearch_range_value_table(c, grapheme_cat_table)
429-
}
430-
431-
""")
432-
433-
emit_table(f, "grapheme_cat_table", grapheme_table, "&'static [(char, char, GraphemeCat)]",
434-
pfun=lambda x: "(%s,%s,GC_%s)" % (escape_char(x[0]), escape_char(x[1]), x[2]),
435-
is_pub=False)
436-
f.write("}\n")
437-
438398
def emit_charwidth_module(f, width_table):
439399
f.write("pub mod charwidth {\n")
440400
f.write(" use core::option::Option;\n")
@@ -497,79 +457,6 @@ def emit_norm_module(f, canon, compat, combine, norm_props):
497457
canon_comp_keys = canon_comp.keys()
498458
canon_comp_keys.sort()
499459

500-
f.write("pub mod normalization {\n")
501-
502-
def mkdata_fun(table):
503-
def f(char):
504-
data = "(%s,&[" % escape_char(char)
505-
first = True
506-
for d in table[char]:
507-
if not first:
508-
data += ","
509-
first = False
510-
data += escape_char(d)
511-
data += "])"
512-
return data
513-
return f
514-
515-
f.write(" // Canonical decompositions\n")
516-
emit_table(f, "canonical_table", canon_keys, "&'static [(char, &'static [char])]",
517-
pfun=mkdata_fun(canon))
518-
519-
f.write(" // Compatibility decompositions\n")
520-
emit_table(f, "compatibility_table", compat_keys, "&'static [(char, &'static [char])]",
521-
pfun=mkdata_fun(compat))
522-
523-
def comp_pfun(char):
524-
data = "(%s,&[" % escape_char(char)
525-
canon_comp[char].sort(lambda x, y: x[0] - y[0])
526-
first = True
527-
for pair in canon_comp[char]:
528-
if not first:
529-
data += ","
530-
first = False
531-
data += "(%s,%s)" % (escape_char(pair[0]), escape_char(pair[1]))
532-
data += "])"
533-
return data
534-
535-
f.write(" // Canonical compositions\n")
536-
emit_table(f, "composition_table", canon_comp_keys,
537-
"&'static [(char, &'static [(char, char)])]", pfun=comp_pfun)
538-
539-
f.write("""
540-
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
541-
use core::cmp::Ordering::{Equal, Less, Greater};
542-
use core::slice::SliceExt;
543-
use core::result::Result::{Ok, Err};
544-
match r.binary_search_by(|&(lo, hi, _)| {
545-
if lo <= c && c <= hi { Equal }
546-
else if hi < c { Less }
547-
else { Greater }
548-
}) {
549-
Ok(idx) => {
550-
let (_, _, result) = r[idx];
551-
result
552-
}
553-
Err(_) => 0
554-
}
555-
}\n
556-
""")
557-
558-
emit_table(f, "combining_class_table", combine, "&'static [(char, char, u8)]", is_pub=False,
559-
pfun=lambda x: "(%s,%s,%s)" % (escape_char(x[0]), escape_char(x[1]), x[2]))
560-
561-
f.write(""" #[deprecated(reason = "use the crates.io `unicode-normalization` lib instead",
562-
since = "1.0.0")]
563-
#[unstable(feature = "unicode",
564-
reason = "this functionality will be moved to crates.io")]
565-
pub fn canonical_combining_class(c: char) -> u8 {
566-
bsearch_range_value_table(c, combining_class_table)
567-
}
568-
569-
}
570-
571-
""")
572-
573460
def remove_from_wtable(wtable, val):
574461
wtable_out = []
575462
while wtable:
@@ -649,53 +536,3 @@ def optimize_width_table(wtable):
649536
# normalizations and conversions module
650537
emit_norm_module(rf, canon_decomp, compat_decomp, combines, norm_props)
651538
emit_conversions_module(rf, to_upper, to_lower, to_title)
652-
653-
### character width module
654-
width_table = []
655-
for zwcat in ["Me", "Mn", "Cf"]:
656-
width_table.extend(map(lambda (lo, hi): (lo, hi, 0, 0), gencats[zwcat]))
657-
width_table.append((4448, 4607, 0, 0))
658-
659-
# get widths, except those that are explicitly marked zero-width above
660-
ea_widths = load_east_asian_width(["W", "F", "A"], ["Me", "Mn", "Cf"])
661-
# these are doublewidth
662-
for dwcat in ["W", "F"]:
663-
width_table.extend(map(lambda (lo, hi): (lo, hi, 2, 2), ea_widths[dwcat]))
664-
width_table.extend(map(lambda (lo, hi): (lo, hi, 1, 2), ea_widths["A"]))
665-
666-
width_table.sort(key=lambda w: w[0])
667-
668-
# soft hyphen is not zero width in preformatted text; it's used to indicate
669-
# a hyphen inserted to facilitate a linebreak.
670-
width_table = remove_from_wtable(width_table, 173)
671-
672-
# optimize the width table by collapsing adjacent entities when possible
673-
width_table = optimize_width_table(width_table)
674-
emit_charwidth_module(rf, width_table)
675-
676-
### grapheme cluster module
677-
# from http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Break_Property_Values
678-
grapheme_cats = load_properties("auxiliary/GraphemeBreakProperty.txt", [])
679-
680-
# Control
681-
# Note 1:
682-
# This category also includes Cs (surrogate codepoints), but Rust's `char`s are
683-
# Unicode Scalar Values only, and surrogates are thus invalid `char`s.
684-
# Thus, we have to remove Cs from the Control category
685-
# Note 2:
686-
# 0x0a and 0x0d (CR and LF) are not in the Control category for Graphemes.
687-
# However, the Graphemes iterator treats these as a special case, so they
688-
# should be included in grapheme_cats["Control"] for our implementation.
689-
grapheme_cats["Control"] = group_cat(list(
690-
(set(ungroup_cat(grapheme_cats["Control"]))
691-
| set(ungroup_cat(grapheme_cats["CR"]))
692-
| set(ungroup_cat(grapheme_cats["LF"])))
693-
- set(ungroup_cat([surrogate_codepoints]))))
694-
del(grapheme_cats["CR"])
695-
del(grapheme_cats["LF"])
696-
697-
grapheme_table = []
698-
for cat in grapheme_cats:
699-
grapheme_table.extend([(x, y, cat) for (x, y) in grapheme_cats[cat]])
700-
grapheme_table.sort(key=lambda w: w[0])
701-
emit_grapheme_module(rf, grapheme_table, grapheme_cats.keys())

src/liballoc/arc.rs

+50-77
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,6 @@ impl<T: ?Sized> Arc<T> {
272272
}
273273
}
274274

275-
/// Get the number of weak references to this value.
276-
#[inline]
277-
#[unstable(feature = "arc_counts")]
278-
#[deprecated(since = "1.2.0", reason = "renamed to Arc::weak_count")]
279-
pub fn weak_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::weak_count(this) }
280-
281-
/// Get the number of strong references to this value.
282-
#[inline]
283-
#[unstable(feature = "arc_counts")]
284-
#[deprecated(since = "1.2.0", reason = "renamed to Arc::strong_count")]
285-
pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::strong_count(this) }
286-
287275
#[stable(feature = "rust1", since = "1.0.0")]
288276
impl<T: ?Sized> Clone for Arc<T> {
289277
/// Makes a clone of the `Arc<T>`.
@@ -484,13 +472,6 @@ impl<T: ?Sized> Arc<T> {
484472
}
485473
}
486474

487-
#[inline]
488-
#[unstable(feature = "arc_unique")]
489-
#[deprecated(since = "1.2", reason = "use Arc::get_mut instead")]
490-
pub fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
491-
Arc::get_mut(this)
492-
}
493-
494475
#[stable(feature = "rust1", since = "1.0.0")]
495476
impl<T: ?Sized> Drop for Arc<T> {
496477
/// Drops the `Arc<T>`.
@@ -860,7 +841,7 @@ mod tests {
860841
use std::sync::atomic::Ordering::{Acquire, SeqCst};
861842
use std::thread;
862843
use std::vec::Vec;
863-
use super::{Arc, Weak, get_mut, weak_count, strong_count};
844+
use super::{Arc, Weak};
864845
use std::sync::Mutex;
865846

866847
struct Canary(*mut atomic::AtomicUsize);
@@ -898,43 +879,39 @@ mod tests {
898879

899880
#[test]
900881
fn test_arc_get_mut() {
901-
unsafe {
902-
let mut x = Arc::new(3);
903-
*get_mut(&mut x).unwrap() = 4;
904-
assert_eq!(*x, 4);
905-
let y = x.clone();
906-
assert!(get_mut(&mut x).is_none());
907-
drop(y);
908-
assert!(get_mut(&mut x).is_some());
909-
let _w = x.downgrade();
910-
assert!(get_mut(&mut x).is_none());
911-
}
882+
let mut x = Arc::new(3);
883+
*Arc::get_mut(&mut x).unwrap() = 4;
884+
assert_eq!(*x, 4);
885+
let y = x.clone();
886+
assert!(Arc::get_mut(&mut x).is_none());
887+
drop(y);
888+
assert!(Arc::get_mut(&mut x).is_some());
889+
let _w = x.downgrade();
890+
assert!(Arc::get_mut(&mut x).is_none());
912891
}
913892

914893
#[test]
915894
fn test_cowarc_clone_make_unique() {
916-
unsafe {
917-
let mut cow0 = Arc::new(75);
918-
let mut cow1 = cow0.clone();
919-
let mut cow2 = cow1.clone();
920-
921-
assert!(75 == *Arc::make_unique(&mut cow0));
922-
assert!(75 == *Arc::make_unique(&mut cow1));
923-
assert!(75 == *Arc::make_unique(&mut cow2));
924-
925-
*Arc::make_unique(&mut cow0) += 1;
926-
*Arc::make_unique(&mut cow1) += 2;
927-
*Arc::make_unique(&mut cow2) += 3;
928-
929-
assert!(76 == *cow0);
930-
assert!(77 == *cow1);
931-
assert!(78 == *cow2);
932-
933-
// none should point to the same backing memory
934-
assert!(*cow0 != *cow1);
935-
assert!(*cow0 != *cow2);
936-
assert!(*cow1 != *cow2);
937-
}
895+
let mut cow0 = Arc::new(75);
896+
let mut cow1 = cow0.clone();
897+
let mut cow2 = cow1.clone();
898+
899+
assert!(75 == *Arc::make_unique(&mut cow0));
900+
assert!(75 == *Arc::make_unique(&mut cow1));
901+
assert!(75 == *Arc::make_unique(&mut cow2));
902+
903+
*Arc::make_unique(&mut cow0) += 1;
904+
*Arc::make_unique(&mut cow1) += 2;
905+
*Arc::make_unique(&mut cow2) += 3;
906+
907+
assert!(76 == *cow0);
908+
assert!(77 == *cow1);
909+
assert!(78 == *cow2);
910+
911+
// none should point to the same backing memory
912+
assert!(*cow0 != *cow1);
913+
assert!(*cow0 != *cow2);
914+
assert!(*cow1 != *cow2);
938915
}
939916

940917
#[test]
@@ -947,9 +924,7 @@ mod tests {
947924
assert!(75 == *cow1);
948925
assert!(75 == *cow2);
949926

950-
unsafe {
951-
*Arc::make_unique(&mut cow0) += 1;
952-
}
927+
*Arc::make_unique(&mut cow0) += 1;
953928

954929
assert!(76 == *cow0);
955930
assert!(75 == *cow1);
@@ -970,9 +945,7 @@ mod tests {
970945
assert!(75 == *cow0);
971946
assert!(75 == *cow1_weak.upgrade().unwrap());
972947

973-
unsafe {
974-
*Arc::make_unique(&mut cow0) += 1;
975-
}
948+
*Arc::make_unique(&mut cow0) += 1;
976949

977950
assert!(76 == *cow0);
978951
assert!(cow1_weak.upgrade().is_none());
@@ -1028,40 +1001,40 @@ mod tests {
10281001
#[test]
10291002
fn test_strong_count() {
10301003
let a = Arc::new(0u32);
1031-
assert!(strong_count(&a) == 1);
1004+
assert!(Arc::strong_count(&a) == 1);
10321005
let w = a.downgrade();
1033-
assert!(strong_count(&a) == 1);
1006+
assert!(Arc::strong_count(&a) == 1);
10341007
let b = w.upgrade().expect("");
1035-
assert!(strong_count(&b) == 2);
1036-
assert!(strong_count(&a) == 2);
1008+
assert!(Arc::strong_count(&b) == 2);
1009+
assert!(Arc::strong_count(&a) == 2);
10371010
drop(w);
10381011
drop(a);
1039-
assert!(strong_count(&b) == 1);
1012+
assert!(Arc::strong_count(&b) == 1);
10401013
let c = b.clone();
1041-
assert!(strong_count(&b) == 2);
1042-
assert!(strong_count(&c) == 2);
1014+
assert!(Arc::strong_count(&b) == 2);
1015+
assert!(Arc::strong_count(&c) == 2);
10431016
}
10441017

10451018
#[test]
10461019
fn test_weak_count() {
10471020
let a = Arc::new(0u32);
1048-
assert!(strong_count(&a) == 1);
1049-
assert!(weak_count(&a) == 0);
1021+
assert!(Arc::strong_count(&a) == 1);
1022+
assert!(Arc::weak_count(&a) == 0);
10501023
let w = a.downgrade();
1051-
assert!(strong_count(&a) == 1);
1052-
assert!(weak_count(&a) == 1);
1024+
assert!(Arc::strong_count(&a) == 1);
1025+
assert!(Arc::weak_count(&a) == 1);
10531026
let x = w.clone();
1054-
assert!(weak_count(&a) == 2);
1027+
assert!(Arc::weak_count(&a) == 2);
10551028
drop(w);
10561029
drop(x);
1057-
assert!(strong_count(&a) == 1);
1058-
assert!(weak_count(&a) == 0);
1030+
assert!(Arc::strong_count(&a) == 1);
1031+
assert!(Arc::weak_count(&a) == 0);
10591032
let c = a.clone();
1060-
assert!(strong_count(&a) == 2);
1061-
assert!(weak_count(&a) == 0);
1033+
assert!(Arc::strong_count(&a) == 2);
1034+
assert!(Arc::weak_count(&a) == 0);
10621035
let d = c.downgrade();
1063-
assert!(weak_count(&c) == 1);
1064-
assert!(strong_count(&c) == 2);
1036+
assert!(Arc::weak_count(&c) == 1);
1037+
assert!(Arc::strong_count(&c) == 2);
10651038

10661039
drop(a);
10671040
drop(c);

0 commit comments

Comments
 (0)