Skip to content

Commit 7ca9b1b

Browse files
committed
---
yaml --- r: 212302 b: refs/heads/auto c: f0fed83 h: refs/heads/master v: v3
1 parent 0140d2b commit 7ca9b1b

File tree

38 files changed

+196
-243
lines changed

38 files changed

+196
-243
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 115121de3d4669a798e99aa69dfdbc7012b4181c
13+
refs/heads/auto: f0fed8388690ea4f94efda53880a5441da3c0c85
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ use core::raw::{TraitObject};
8181
#[lang = "exchange_heap"]
8282
#[unstable(feature = "alloc",
8383
reason = "may be renamed; uncertain about custom allocator design")]
84-
pub const HEAP: () = ();
84+
pub static HEAP: () = ();
8585

8686
/// A pointer type for heap allocation.
8787
///

branches/auto/src/libcollections/bit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ fn match_words <'a,'b>(a: &'a BitVec, b: &'b BitVec) -> (MatchWords<'a>, MatchWo
125125
}
126126
}
127127

128-
const TRUE: &'static bool = &true;
129-
const FALSE: &'static bool = &false;
128+
static TRUE: bool = true;
129+
static FALSE: bool = false;
130130

131131
/// The bitvector type.
132132
///
@@ -172,9 +172,9 @@ impl Index<usize> for BitVec {
172172
#[inline]
173173
fn index(&self, i: usize) -> &bool {
174174
if self.get(i).expect("index out of bounds") {
175-
TRUE
175+
&TRUE
176176
} else {
177-
FALSE
177+
&FALSE
178178
}
179179
}
180180
}

branches/auto/src/libcollections/str.rs

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -640,19 +640,16 @@ impl str {
640640
///
641641
/// let v: Vec<&str> = "lion::tiger::leopard".split("::").collect();
642642
/// assert_eq!(v, ["lion", "tiger", "leopard"]);
643-
///
644-
/// let v: Vec<&str> = "abc1def2ghi".split(char::is_numeric).collect();
645-
/// assert_eq!(v, ["abc", "def", "ghi"]);
646-
///
647-
/// let v: Vec<&str> = "lionXtigerXleopard".split(char::is_uppercase).collect();
648-
/// assert_eq!(v, ["lion", "tiger", "leopard"]);
649643
/// ```
650644
///
651-
/// A more complex pattern, using a closure:
645+
/// More complex patterns with closures:
652646
///
653647
/// ```
654-
/// let v: Vec<&str> = "abc1defXghi".split(|c| c == '1' || c == 'X').collect();
648+
/// let v: Vec<&str> = "abc1def2ghi".split(|c: char| c.is_numeric()).collect();
655649
/// assert_eq!(v, ["abc", "def", "ghi"]);
650+
///
651+
/// let v: Vec<&str> = "lionXtigerXleopard".split(char::is_uppercase).collect();
652+
/// assert_eq!(v, ["lion", "tiger", "leopard"]);
656653
/// ```
657654
#[stable(feature = "rust1", since = "1.0.0")]
658655
pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> {
@@ -694,11 +691,14 @@ impl str {
694691
/// assert_eq!(v, ["leopard", "tiger", "lion"]);
695692
/// ```
696693
///
697-
/// A more complex pattern, using a closure:
694+
/// More complex patterns with closures:
698695
///
699-
/// ```
700-
/// let v: Vec<&str> = "abc1defXghi".rsplit(|c| c == '1' || c == 'X').collect();
696+
/// ```rust
697+
/// let v: Vec<&str> = "abc1def2ghi".rsplit(|c: char| c.is_numeric()).collect();
701698
/// assert_eq!(v, ["ghi", "def", "abc"]);
699+
///
700+
/// let v: Vec<&str> = "lionXtigerXleopard".rsplit(char::is_uppercase).collect();
701+
/// assert_eq!(v, ["leopard", "tiger", "lion"]);
702702
/// ```
703703
#[stable(feature = "rust1", since = "1.0.0")]
704704
pub fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P>
@@ -733,13 +733,22 @@ impl str {
733733
///
734734
/// # Examples
735735
///
736+
/// Simple patterns:
737+
///
736738
/// ```
737739
/// let v: Vec<&str> = "A.B.".split_terminator('.').collect();
738740
/// assert_eq!(v, ["A", "B"]);
739741
///
740742
/// let v: Vec<&str> = "A..B..".split_terminator(".").collect();
741743
/// assert_eq!(v, ["A", "", "B", ""]);
742744
/// ```
745+
///
746+
/// More complex patterns with closures:
747+
///
748+
/// ```
749+
/// let v: Vec<&str> = "abc1def2ghi3".split_terminator(|c: char| c.is_numeric()).collect();
750+
/// assert_eq!(v, ["abc", "def", "ghi"]);
751+
/// ```
743752
#[stable(feature = "rust1", since = "1.0.0")]
744753
pub fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator<'a, P> {
745754
core_str::StrExt::split_terminator(&self[..], pat)
@@ -769,13 +778,22 @@ impl str {
769778
///
770779
/// # Examples
771780
///
781+
/// Simple patterns:
782+
///
772783
/// ```
773784
/// let v: Vec<&str> = "A.B.".rsplit_terminator('.').collect();
774785
/// assert_eq!(v, ["B", "A"]);
775786
///
776787
/// let v: Vec<&str> = "A..B..".rsplit_terminator(".").collect();
777788
/// assert_eq!(v, ["", "B", "", "A"]);
778789
/// ```
790+
///
791+
/// More complex patterns with closures:
792+
///
793+
/// ```
794+
/// let v: Vec<&str> = "abc1def2ghi3".rsplit_terminator(|c: char| c.is_numeric()).collect();
795+
/// assert_eq!(v, ["ghi", "def", "abc"]);
796+
/// ```
779797
#[stable(feature = "rust1", since = "1.0.0")]
780798
pub fn rsplit_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplitTerminator<'a, P>
781799
where P::Searcher: ReverseSearcher<'a>
@@ -819,11 +837,11 @@ impl str {
819837
/// assert_eq!(v, [""]);
820838
/// ```
821839
///
822-
/// A more complex pattern, using a closure:
840+
/// More complex patterns with closures:
823841
///
824842
/// ```
825-
/// let v: Vec<&str> = "abc1defXghi".splitn(2, |c| c == '1' || c == 'X').collect();
826-
/// assert_eq!(v, ["abc", "defXghi"]);
843+
/// let v: Vec<&str> = "abc1def2ghi".splitn(2, |c: char| c.is_numeric()).collect();
844+
/// assert_eq!(v, ["abc", "def2ghi"]);
827845
/// ```
828846
#[stable(feature = "rust1", since = "1.0.0")]
829847
pub fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P> {
@@ -864,10 +882,10 @@ impl str {
864882
/// assert_eq!(v, ["leopard", "lion::tiger"]);
865883
/// ```
866884
///
867-
/// A more complex pattern, using a closure:
885+
/// More complex patterns with closures:
868886
///
869887
/// ```
870-
/// let v: Vec<&str> = "abc1defXghi".rsplitn(2, |c| c == '1' || c == 'X').collect();
888+
/// let v: Vec<&str> = "abc1def2ghi".rsplitn(2, |c: char| c.is_numeric()).collect();
871889
/// assert_eq!(v, ["ghi", "abc1def"]);
872890
/// ```
873891
#[stable(feature = "rust1", since = "1.0.0")]
@@ -902,7 +920,7 @@ impl str {
902920
/// let v: Vec<&str> = "abcXXXabcYYYabc".matches("abc").collect();
903921
/// assert_eq!(v, ["abc", "abc", "abc"]);
904922
///
905-
/// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect();
923+
/// let v: Vec<&str> = "1abc2abc3".matches(|c: char| c.is_numeric()).collect();
906924
/// assert_eq!(v, ["1", "2", "3"]);
907925
/// ```
908926
#[unstable(feature = "collections",
@@ -935,7 +953,7 @@ impl str {
935953
/// let v: Vec<&str> = "abcXXXabcYYYabc".rmatches("abc").collect();
936954
/// assert_eq!(v, ["abc", "abc", "abc"]);
937955
///
938-
/// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect();
956+
/// let v: Vec<&str> = "1abc2abc3".rmatches(|c: char| c.is_numeric()).collect();
939957
/// assert_eq!(v, ["3", "2", "1"]);
940958
/// ```
941959
#[unstable(feature = "collections",
@@ -1181,16 +1199,15 @@ impl str {
11811199
///
11821200
/// ```
11831201
/// assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar");
1184-
/// assert_eq!("123foo1bar123".trim_matches(char::is_numeric), "foo1bar");
11851202
///
11861203
/// let x: &[_] = &['1', '2'];
11871204
/// assert_eq!("12foo1bar12".trim_matches(x), "foo1bar");
11881205
/// ```
11891206
///
1190-
/// A more complex pattern, using a closure:
1207+
/// More complex patterns with closures:
11911208
///
11921209
/// ```
1193-
/// assert_eq!("1foo1barXX".trim_matches(|c| c == '1' || c == 'X'), "foo1bar");
1210+
/// assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar");
11941211
/// ```
11951212
#[stable(feature = "rust1", since = "1.0.0")]
11961213
pub fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
@@ -1207,13 +1224,20 @@ impl str {
12071224
///
12081225
/// # Examples
12091226
///
1227+
/// Simple patterns:
1228+
///
12101229
/// ```
12111230
/// assert_eq!("11foo1bar11".trim_left_matches('1'), "foo1bar11");
1212-
/// assert_eq!("123foo1bar123".trim_left_matches(char::is_numeric), "foo1bar123");
12131231
///
12141232
/// let x: &[_] = &['1', '2'];
12151233
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
12161234
/// ```
1235+
///
1236+
/// More complex patterns with closures:
1237+
///
1238+
/// ```
1239+
/// assert_eq!("123foo1bar123".trim_left_matches(|c: char| c.is_numeric()), "foo1bar123");
1240+
/// ```
12171241
#[stable(feature = "rust1", since = "1.0.0")]
12181242
pub fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str {
12191243
core_str::StrExt::trim_left_matches(&self[..], pat)
@@ -1231,16 +1255,14 @@ impl str {
12311255
///
12321256
/// ```
12331257
/// assert_eq!("11foo1bar11".trim_right_matches('1'), "11foo1bar");
1234-
/// assert_eq!("123foo1bar123".trim_right_matches(char::is_numeric), "123foo1bar");
1235-
///
12361258
/// let x: &[_] = &['1', '2'];
12371259
/// assert_eq!("12foo1bar12".trim_right_matches(x), "12foo1bar");
12381260
/// ```
12391261
///
1240-
/// A more complex pattern, using a closure:
1262+
/// More complex patterns with closures:
12411263
///
12421264
/// ```
1243-
/// assert_eq!("1fooX".trim_left_matches(|c| c == '1' || c == 'X'), "fooX");
1265+
/// assert_eq!("123foo1bar123".trim_right_matches(|c: char| c.is_numeric()), "123foo1bar");
12441266
/// ```
12451267
#[stable(feature = "rust1", since = "1.0.0")]
12461268
pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
@@ -1477,7 +1499,7 @@ impl str {
14771499
/// ```
14781500
/// let s = "Löwe 老虎 Léopard";
14791501
///
1480-
/// assert_eq!(s.find(char::is_whitespace), Some(5));
1502+
/// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5));
14811503
/// assert_eq!(s.find(char::is_lowercase), Some(1));
14821504
/// ```
14831505
///
@@ -1519,7 +1541,7 @@ impl str {
15191541
/// ```
15201542
/// let s = "Löwe 老虎 Léopard";
15211543
///
1522-
/// assert_eq!(s.rfind(char::is_whitespace), Some(12));
1544+
/// assert_eq!(s.rfind(|c: char| c.is_whitespace()), Some(12));
15231545
/// assert_eq!(s.rfind(char::is_lowercase), Some(20));
15241546
/// ```
15251547
///

branches/auto/src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ use borrow::{Cow, IntoCow};
8383
use super::range::RangeArgument;
8484

8585
// FIXME- fix places which assume the max vector allowed has memory usize::MAX.
86-
const MAX_MEMORY_SIZE: usize = isize::MAX as usize;
86+
static MAX_MEMORY_SIZE: usize = isize::MAX as usize;
8787

8888
/// A growable list type, written `Vec<T>` but pronounced 'vector.'
8989
///

branches/auto/src/libcore/num/flt2dec/strategy/dragon.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use num::flt2dec::estimator::estimate_scaling_factor;
2424
use num::flt2dec::bignum::Digit32 as Digit;
2525
use num::flt2dec::bignum::Big32x36 as Big;
2626

27+
// FIXME(#22540) const ref to static array seems to ICE
2728
static POW10: [Digit; 10] = [1, 10, 100, 1000, 10000, 100000,
2829
1000000, 10000000, 100000000, 1000000000];
2930
static TWOPOW10: [Digit; 10] = [2, 20, 200, 2000, 20000, 200000,
@@ -327,3 +328,4 @@ pub fn format_exact(d: &Decoded, buf: &mut [u8], limit: i16) -> (/*#digits*/ usi
327328

328329
(len, k)
329330
}
331+

branches/auto/src/libcore/num/flt2dec/strategy/grisu.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ for i in xrange(-308, 333, 8):
8787
f = ((f << 64 >> (l-1)) + 1) >> 1; e += l - 64
8888
print ' (%#018x, %5d, %4d),' % (f, e, i)
8989
*/
90-
90+
// FIXME(#22540) const ref to static array seems to ICE
9191
#[doc(hidden)]
9292
pub static CACHED_POW10: [(u64, i16, i16); 81] = [ // (f, e, k)
9393
(0xe61acf033d1a45df, -1087, -308),
@@ -746,3 +746,4 @@ pub fn format_exact(d: &Decoded, buf: &mut [u8], limit: i16) -> (/*#digits*/ usi
746746
None => fallback(d, buf, limit),
747747
}
748748
}
749+

branches/auto/src/liblog/directive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct LogDirective {
1717
pub level: u32,
1818
}
1919

20-
pub const LOG_LEVEL_NAMES: [&'static str; 4] = ["ERROR", "WARN", "INFO",
20+
pub static LOG_LEVEL_NAMES: [&'static str; 4] = ["ERROR", "WARN", "INFO",
2121
"DEBUG"];
2222

2323
/// Parse an individual log level that is either a number or a symbolic log level

branches/auto/src/librand/distributions/ziggurat_tables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// algorithm. Autogenerated by `ziggurat_tables.py`.
1313

1414
pub type ZigTable = &'static [f64; 257];
15-
pub const ZIG_NORM_R: f64 = 3.654152885361008796;
15+
pub static ZIG_NORM_R: f64 = 3.654152885361008796;
1616
pub static ZIG_NORM_X: [f64; 257] =
1717
[3.910757959537090045, 3.654152885361008796, 3.449278298560964462, 3.320244733839166074,
1818
3.224575052047029100, 3.147889289517149969, 3.083526132001233044, 3.027837791768635434,
@@ -145,7 +145,7 @@ pub static ZIG_NORM_F: [f64; 257] =
145145
0.887984660763399880, 0.898095921906304051, 0.908726440060562912, 0.919991505048360247,
146146
0.932060075968990209, 0.945198953453078028, 0.959879091812415930, 0.977101701282731328,
147147
1.000000000000000000];
148-
pub const ZIG_EXP_R: f64 = 7.697117470131050077;
148+
pub static ZIG_EXP_R: f64 = 7.697117470131050077;
149149
pub static ZIG_EXP_X: [f64; 257] =
150150
[8.697117470131052741, 7.697117470131050077, 6.941033629377212577, 6.478378493832569696,
151151
6.144164665772472667, 5.882144315795399869, 5.666410167454033697, 5.482890627526062488,

branches/auto/src/librustc/diagnostics.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -227,25 +227,6 @@ const Y: i32 = A;
227227
```
228228
"##,
229229

230-
E0014: r##"
231-
Constants can only be initialized by a constant value or, in a future
232-
version of Rust, a call to a const function. This error indicates the use
233-
of a path (like a::b, or x) denoting something other than one of these
234-
allowed items. Example:
235-
236-
```
237-
const FOO: i32 = { let x = 0; x }; // 'x' isn't a constant nor a function!
238-
```
239-
240-
To avoid it, you have to replace the non-constant value:
241-
242-
```
243-
const FOO: i32 = { const X : i32 = 0; X };
244-
// or even:
245-
const FOO: i32 = { 0 }; // but brackets are useless here
246-
```
247-
"##,
248-
249230
E0015: r##"
250231
The only functions that can be called in static or constant expressions are
251232
`const` functions. Rust currently does not support more general compile-time
@@ -950,6 +931,7 @@ static mut BAR: Option<Vec<i32>> = None;
950931

951932

952933
register_diagnostics! {
934+
E0014,
953935
E0016,
954936
E0017,
955937
E0019,

branches/auto/src/librustc/lint/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ macro_rules! declare_lint {
101101
#[macro_export]
102102
macro_rules! lint_array { ($( $lint:expr ),*) => (
103103
{
104-
static ARRAY: LintArray = &[ $( &$lint ),* ];
105-
ARRAY
104+
#[allow(non_upper_case_globals)]
105+
static array: LintArray = &[ $( &$lint ),* ];
106+
array
106107
}
107108
) }
108109

branches/auto/src/librustc/metadata/tydecode.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ pub enum DefIdSource {
5050
// Identifies a type alias (`type X = ...`).
5151
TypeWithId,
5252

53+
// Identifies a type parameter (`fn foo<X>() { ... }`).
54+
TypeParameter,
55+
5356
// Identifies a region parameter (`fn foo<'X>() { ... }`).
5457
RegionParameter,
5558

@@ -190,7 +193,7 @@ pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: us
190193
tcx: &ty::ctxt<'tcx>, conv: F) -> subst::Substs<'tcx> where
191194
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
192195
{
193-
debug!("parse_substs_data{}", data_log_string(data, pos));
196+
debug!("parse_substs_data {}", data_log_string(data, pos));
194197
let mut st = parse_state_from_data(data, crate_num, pos, tcx);
195198
parse_substs(&mut st, conv)
196199
}
@@ -539,14 +542,7 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w
539542
len: len };
540543

541544
match tcx.rcache.borrow().get(&key).cloned() {
542-
Some(tt) => {
543-
// If there is a closure buried in the type some where, then we
544-
// need to re-convert any def ids (see case 'k', below). That means
545-
// we can't reuse the cached version.
546-
if !ty::type_has_ty_closure(tt) {
547-
return tt;
548-
}
549-
}
545+
Some(tt) => return tt,
550546
None => {}
551547
}
552548
let mut ps = PState {

0 commit comments

Comments
 (0)