Skip to content

Commit 254ecef

Browse files
committed
---
yaml --- r: 235950 b: refs/heads/stable c: 6fcf628 h: refs/heads/master v: v3
1 parent 089df48 commit 254ecef

File tree

119 files changed

+1913
-7440
lines changed

Some content is hidden

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

119 files changed

+1913
-7440
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 757b0c176fa185fda59283efaf0d8079b702ca69
32+
refs/heads/stable: 6fcf62831efcdef242f6858b47dd2a9b208b19ce
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/.gitattributes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66
*.rs rust
77
src/etc/pkg/rust-logo.ico binary
88
src/etc/pkg/rust-logo.png binary
9-
src/rt/msvc/* -whitespace
10-
src/rt/valgrind/* -whitespace
119
*.woff binary

branches/stable/configure

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ valopt llvm-root "" "set LLVM root"
601601
valopt python "" "set path to python"
602602
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
603603
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
604-
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
604+
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path (deprecated)"
605+
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
606+
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
605607
valopt release-channel "dev" "the name of the release channel to build"
606608
valopt musl-root "/usr/local" "MUSL root installation directory"
607609

@@ -1112,20 +1114,24 @@ do
11121114
fi
11131115

11141116
case $i in
1115-
arm-linux-androideabi)
1116-
1117-
if [ ! -f $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-gcc ]
1118-
then
1119-
err "NDK $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-gcc not found"
1120-
fi
1121-
if [ ! -f $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-g++ ]
1122-
then
1123-
err "NDK $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-g++ not found"
1124-
fi
1125-
if [ ! -f $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-ar ]
1117+
*android*)
1118+
upper_snake_target=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
1119+
eval ndk=\$"CFG_${upper_snake_target}_NDK"
1120+
if [ -z "$ndk" ]
11261121
then
1127-
err "NDK $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-ar not found"
1122+
ndk=$CFG_ANDROID_CROSS_PATH
1123+
eval "CFG_${upper_snake_target}_NDK"=$CFG_ANDROID_CROSS_PATH
1124+
warn "generic/default Android NDK option is deprecated (use --$i-ndk option instead)"
11281125
fi
1126+
1127+
# Perform a basic sanity check of the NDK
1128+
for android_ndk_tool in "$ndk/bin/$i-gcc" "$ndk/bin/$i-g++" "$ndk/bin/$i-ar"
1129+
do
1130+
if [ ! -f $android_ndk_tool ]
1131+
then
1132+
err "NDK tool $android_ndk_tool not found (bad or missing --$i-ndk option?)"
1133+
fi
1134+
done
11291135
;;
11301136

11311137
arm-apple-darwin)
@@ -1682,7 +1688,8 @@ putvar CFG_HOST
16821688
putvar CFG_TARGET
16831689
putvar CFG_LIBDIR_RELATIVE
16841690
putvar CFG_DISABLE_MANAGE_SUBMODULES
1685-
putvar CFG_ANDROID_CROSS_PATH
1691+
putvar CFG_AARCH64_LINUX_ANDROID_NDK
1692+
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
16861693
putvar CFG_MANDIR
16871694

16881695
# Avoid spurious warnings from clang by feeding it original source on

branches/stable/mk/cfg/aarch64-linux-android.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# aarch64-linux-android configuration
22
# CROSS_PREFIX_aarch64-linux-android-
3-
CC_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-gcc
4-
CXX_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-g++
5-
CPP_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-gcc -E
6-
AR_aarch64-linux-android=$(CFG_ANDROID_CROSS_PATH)/bin/aarch64-linux-android-ar
3+
CC_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc
4+
CXX_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-g++
5+
CPP_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-gcc -E
6+
AR_aarch64-linux-android=$(CFG_AARCH64_LINUX_ANDROID_NDK)/bin/aarch64-linux-android-ar
77
CFG_LIB_NAME_aarch64-linux-android=lib$(1).so
88
CFG_STATIC_LIB_NAME_aarch64-linux-android=lib$(1).a
99
CFG_LIB_GLOB_aarch64-linux-android=lib$(1)-*.so

branches/stable/mk/cfg/arm-linux-androideabi.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# arm-linux-androideabi configuration
2-
CC_arm-linux-androideabi=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-gcc
3-
CXX_arm-linux-androideabi=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-g++
4-
CPP_arm-linux-androideabi=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-gcc -E
5-
AR_arm-linux-androideabi=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-ar
2+
CC_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc
3+
CXX_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-g++
4+
CPP_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-gcc -E
5+
AR_arm-linux-androideabi=$(CFG_ARM_LINUX_ANDROIDEABI_NDK)/bin/arm-linux-androideabi-ar
66
CFG_LIB_NAME_arm-linux-androideabi=lib$(1).so
77
CFG_STATIC_LIB_NAME_arm-linux-androideabi=lib$(1).a
88
CFG_LIB_GLOB_arm-linux-androideabi=lib$(1)-*.so

branches/stable/src/doc/trpl/compiler-plugins.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
6161
("I", 1)];
6262
6363
let text = match args {
64-
[TtToken(_, token::Ident(s, _))] => token::get_ident(s).to_string(),
64+
[TtToken(_, token::Ident(s, _))] => s.to_string(),
6565
_ => {
6666
cx.span_err(sp, "argument should be a single identifier");
6767
return DummyResult::any(sp);
@@ -186,8 +186,7 @@ impl LintPass for Pass {
186186
}
187187
188188
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
189-
let name = token::get_ident(it.ident);
190-
if name.get() == "lintme" {
189+
if it.ident.name == "lintme" {
191190
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
192191
}
193192
}

branches/stable/src/liballoc/boxed.rs

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
use core::prelude::*;
5757

5858
use heap;
59+
use raw_vec::RawVec;
5960

6061
use core::any::Any;
6162
use core::cmp::Ordering;
@@ -65,7 +66,7 @@ use core::marker::{self, Unsize};
6566
use core::mem;
6667
use core::ops::{CoerceUnsized, Deref, DerefMut};
6768
use core::ops::{Placer, Boxed, Place, InPlace, BoxPlace};
68-
use core::ptr::Unique;
69+
use core::ptr::{self, Unique};
6970
use core::raw::{TraitObject};
7071

7172
/// A value that represents the heap. This is the default place that the `box`
@@ -514,3 +515,55 @@ impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+Send+'a> {
514515
}
515516

516517
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
518+
519+
#[stable(feature = "box_slice_clone", since = "1.3.0")]
520+
impl<T: Clone> Clone for Box<[T]> {
521+
fn clone(&self) -> Self {
522+
let mut new = BoxBuilder {
523+
data: RawVec::with_capacity(self.len()),
524+
len: 0
525+
};
526+
527+
let mut target = new.data.ptr();
528+
529+
for item in self.iter() {
530+
unsafe {
531+
ptr::write(target, item.clone());
532+
target = target.offset(1);
533+
};
534+
535+
new.len += 1;
536+
}
537+
538+
return unsafe { new.into_box() };
539+
540+
// Helper type for responding to panics correctly.
541+
struct BoxBuilder<T> {
542+
data: RawVec<T>,
543+
len: usize,
544+
}
545+
546+
impl<T> BoxBuilder<T> {
547+
unsafe fn into_box(self) -> Box<[T]> {
548+
let raw = ptr::read(&self.data);
549+
mem::forget(self);
550+
raw.into_box()
551+
}
552+
}
553+
554+
impl<T> Drop for BoxBuilder<T> {
555+
fn drop(&mut self) {
556+
let mut data = self.data.ptr();
557+
let max = unsafe { data.offset(self.len as isize) };
558+
559+
while data != max {
560+
unsafe {
561+
ptr::read(data);
562+
data = data.offset(1);
563+
}
564+
}
565+
}
566+
}
567+
}
568+
}
569+

branches/stable/src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#![feature(core)]
7777
#![feature(core_intrinsics)]
7878
#![feature(core_prelude)]
79+
#![feature(core_slice_ext)]
7980
#![feature(custom_attribute)]
8081
#![feature(fundamental)]
8182
#![feature(lang_items)]

branches/stable/src/libcollectionstest/slice.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,59 @@ fn test_to_vec() {
12701270
assert_eq!(ys, [1, 2, 3]);
12711271
}
12721272

1273+
#[test]
1274+
fn test_box_slice_clone() {
1275+
let data = vec![vec![0, 1], vec![0], vec![1]];
1276+
let data2 = data.clone().into_boxed_slice().clone().to_vec();
1277+
1278+
assert_eq!(data, data2);
1279+
}
1280+
1281+
#[test]
1282+
fn test_box_slice_clone_panics() {
1283+
use std::sync::Arc;
1284+
use std::sync::atomic::{AtomicUsize, Ordering};
1285+
use std::thread::spawn;
1286+
1287+
struct Canary {
1288+
count: Arc<AtomicUsize>,
1289+
panics: bool
1290+
}
1291+
1292+
impl Drop for Canary {
1293+
fn drop(&mut self) {
1294+
self.count.fetch_add(1, Ordering::SeqCst);
1295+
}
1296+
}
1297+
1298+
impl Clone for Canary {
1299+
fn clone(&self) -> Self {
1300+
if self.panics { panic!() }
1301+
1302+
Canary {
1303+
count: self.count.clone(),
1304+
panics: self.panics
1305+
}
1306+
}
1307+
}
1308+
1309+
let drop_count = Arc::new(AtomicUsize::new(0));
1310+
let canary = Canary { count: drop_count.clone(), panics: false };
1311+
let panic = Canary { count: drop_count.clone(), panics: true };
1312+
1313+
spawn(move || {
1314+
// When xs is dropped, +5.
1315+
let xs = vec![canary.clone(), canary.clone(), canary.clone(),
1316+
panic, canary].into_boxed_slice();
1317+
1318+
// When panic is cloned, +3.
1319+
xs.clone();
1320+
}).join().unwrap_err();
1321+
1322+
// Total = 8
1323+
assert_eq!(drop_count.load(Ordering::SeqCst), 8);
1324+
}
1325+
12731326
mod bench {
12741327
use std::iter::repeat;
12751328
use std::{mem, ptr};

branches/stable/src/librustc/ast_map/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ impl PathElem {
4747

4848
impl fmt::Display for PathElem {
4949
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
50-
let slot = token::get_name(self.name());
51-
write!(f, "{}", slot)
50+
write!(f, "{}", self.name())
5251
}
5352
}
5453

@@ -1073,18 +1072,18 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
10731072
match ii.node {
10741073
ConstImplItem(..) => {
10751074
format!("assoc const {} in {}{}",
1076-
token::get_ident(ii.ident),
1075+
ii.ident,
10771076
map.path_to_string(id),
10781077
id_str)
10791078
}
10801079
MethodImplItem(..) => {
10811080
format!("method {} in {}{}",
1082-
token::get_ident(ii.ident),
1081+
ii.ident,
10831082
map.path_to_string(id), id_str)
10841083
}
10851084
TypeImplItem(_) => {
10861085
format!("assoc type {} in {}{}",
1087-
token::get_ident(ii.ident),
1086+
ii.ident,
10881087
map.path_to_string(id),
10891088
id_str)
10901089
}
@@ -1103,13 +1102,13 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
11031102

11041103
format!("{} {} in {}{}",
11051104
kind,
1106-
token::get_ident(ti.ident),
1105+
ti.ident,
11071106
map.path_to_string(id),
11081107
id_str)
11091108
}
11101109
Some(NodeVariant(ref variant)) => {
11111110
format!("variant {} in {}{}",
1112-
token::get_ident(variant.node.name),
1111+
variant.node.name,
11131112
map.path_to_string(id), id_str)
11141113
}
11151114
Some(NodeExpr(ref expr)) => {

branches/stable/src/librustc/lint/context.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use lint::builtin;
3434
use util::nodemap::FnvHashMap;
3535

3636
use std::cell::RefCell;
37+
use std::cmp;
3738
use std::mem;
3839
use syntax::ast_util::IdVisitingOperation;
3940
use syntax::attr::AttrMetaMethods;
@@ -66,6 +67,9 @@ pub struct LintStore {
6667
/// Map of registered lint groups to what lints they expand to. The bool
6768
/// is true if the lint group was added by a plugin.
6869
lint_groups: FnvHashMap<&'static str, (Vec<LintId>, bool)>,
70+
71+
/// Maximum level a lint can be
72+
lint_cap: Option<Level>,
6973
}
7074

7175
/// The targed of the `by_name` map, which accounts for renaming/deprecation.
@@ -94,7 +98,10 @@ impl LintStore {
9498
}
9599
}
96100

97-
fn set_level(&mut self, lint: LintId, lvlsrc: LevelSource) {
101+
fn set_level(&mut self, lint: LintId, mut lvlsrc: LevelSource) {
102+
if let Some(cap) = self.lint_cap {
103+
lvlsrc.0 = cmp::min(lvlsrc.0, cap);
104+
}
98105
if lvlsrc.0 == Allow {
99106
self.levels.remove(&lint);
100107
} else {
@@ -109,6 +116,7 @@ impl LintStore {
109116
by_name: FnvHashMap(),
110117
levels: FnvHashMap(),
111118
lint_groups: FnvHashMap(),
119+
lint_cap: None,
112120
}
113121
}
114122

@@ -227,6 +235,13 @@ impl LintStore {
227235
}
228236
}
229237
}
238+
239+
self.lint_cap = sess.opts.lint_cap;
240+
if let Some(cap) = self.lint_cap {
241+
for level in self.levels.iter_mut().map(|p| &mut (p.1).0) {
242+
*level = cmp::min(*level, cap);
243+
}
244+
}
230245
}
231246
}
232247

branches/stable/src/librustc/metadata/creader.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use syntax::attr::AttrMetaMethods;
3333
use syntax::codemap::{self, Span, mk_sp, Pos};
3434
use syntax::parse;
3535
use syntax::parse::token::InternedString;
36-
use syntax::parse::token;
3736
use syntax::visit;
3837
use log;
3938

@@ -181,19 +180,18 @@ impl<'a> CrateReader<'a> {
181180
fn extract_crate_info(&self, i: &ast::Item) -> Option<CrateInfo> {
182181
match i.node {
183182
ast::ItemExternCrate(ref path_opt) => {
184-
let ident = token::get_ident(i.ident);
185183
debug!("resolving extern crate stmt. ident: {} path_opt: {:?}",
186-
ident, path_opt);
184+
i.ident, path_opt);
187185
let name = match *path_opt {
188186
Some(name) => {
189-
validate_crate_name(Some(self.sess), name.as_str(),
187+
validate_crate_name(Some(self.sess), &name.as_str(),
190188
Some(i.span));
191-
name.as_str().to_string()
189+
name.to_string()
192190
}
193-
None => ident.to_string(),
191+
None => i.ident.to_string(),
194192
};
195193
Some(CrateInfo {
196-
ident: ident.to_string(),
194+
ident: i.ident.to_string(),
197195
name: name,
198196
id: i.id,
199197
should_link: should_link(i),

0 commit comments

Comments
 (0)