Auto merge of #35666 - eddyb:rollup, r=eddyb

Rollup of 30 pull requests

- Successful merges: #34941, #35392, #35444, #35447, #35491, #35533, #35539, #35558, #35573, #35574, #35577, #35586, #35588, #35594, #35596, #35597, #35598, #35606, #35611, #35615, #35616, #35620, #35622, #35640, #35643, #35644, #35646, #35647, #35648, #35661
- Failed merges: #35395, #35415
This commit is contained in:
bors 2016-08-14 15:27:15 -07:00 committed by GitHub
commit 13ff307f07
127 changed files with 534 additions and 219 deletions

2
configure vendored
View File

@ -1013,7 +1013,7 @@ then
LLVM_VERSION=$($LLVM_CONFIG --version)
case $LLVM_VERSION in
(3.[7-8]*)
(3.[7-9]*)
msg "found ok version of LLVM: $LLVM_VERSION"
;;
(*)

View File

@ -7,8 +7,8 @@ CFG_LIB_NAME_i586-unknown-linux-gnu=lib$(1).so
CFG_STATIC_LIB_NAME_i586-unknown-linux-gnu=lib$(1).a
CFG_LIB_GLOB_i586-unknown-linux-gnu=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_i586-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium
CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -march=pentium
CFG_JEMALLOC_CFLAGS_i586-unknown-linux-gnu := -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
CFG_GCCISH_CFLAGS_i586-unknown-linux-gnu := -g -fPIC -m32 $(CFLAGS) -march=pentium -Wa,-mrelax-relocations=no
CFG_GCCISH_CXXFLAGS_i586-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) -march=pentium
CFG_GCCISH_LINK_FLAGS_i586-unknown-linux-gnu := -shared -fPIC -ldl -pthread -lrt -g -m32
CFG_GCCISH_DEF_FLAG_i586-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=

View File

@ -7,8 +7,8 @@ CFG_INSTALL_ONLY_RLIB_i686-unknown-linux-musl = 1
CFG_LIB_NAME_i686-unknown-linux-musl=lib$(1).so
CFG_STATIC_LIB_NAME_i686-unknown-linux-musl=lib$(1).a
CFG_LIB_GLOB_i686-unknown-linux-musl=lib$(1)-*.so
CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386
CFG_GCCISH_CFLAGS_i686-unknown-linux-musl := -g -fPIC -m32 -Wl,-melf_i386
CFG_JEMALLOC_CFLAGS_i686-unknown-linux-musl := -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
CFG_GCCISH_CFLAGS_i686-unknown-linux-musl := -g -fPIC -m32 -Wl,-melf_i386 -Wa,-mrelax-relocations=no
CFG_GCCISH_CXXFLAGS_i686-unknown-linux-musl :=
CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-musl :=
CFG_GCCISH_DEF_FLAG_i686-unknown-linux-musl :=

View File

@ -870,8 +870,13 @@ impl Build {
// This is a hack, because newer binutils broke things on some vms/distros
// (i.e., linking against unknown relocs disabled by the following flag)
// See: https://github.com/rust-lang/rust/issues/34978
if target == "x86_64-unknown-linux-musl" {
base.push("-Wa,-mrelax-relocations=no".into());
match target {
"i586-unknown-linux-gnu" |
"i686-unknown-linux-musl" |
"x86_64-unknown-linux-musl" => {
base.push("-Wa,-mrelax-relocations=no".into());
},
_ => {},
}
return base
}

View File

@ -98,7 +98,8 @@ pub fn check(build: &mut Build) {
if target.contains("rumprun") ||
target.contains("bitrig") ||
target.contains("openbsd") ||
target.contains("msvc") {
target.contains("msvc") ||
target.contains("emscripten") {
build.config.use_jemalloc = false;
}

View File

@ -166,7 +166,7 @@ story. The other half is *using* the `find` function we've written. Let's try
to use it to find the extension in a file name.
```rust
# fn find(_: &str, _: char) -> Option<usize> { None }
# fn find(haystack: &str, needle: char) -> Option<usize> { haystack.find(needle) }
fn main() {
let file_name = "foobar.rs";
match find(file_name, '.') {
@ -223,7 +223,7 @@ Getting the extension of a file name is a pretty common operation, so it makes
sense to put it into a function:
```rust
# fn find(_: &str, _: char) -> Option<usize> { None }
# fn find(haystack: &str, needle: char) -> Option<usize> { haystack.find(needle) }
// Returns the extension of the given file name, where the extension is defined
// as all characters following the first `.`.
// If `file_name` has no `.`, then `None` is returned.
@ -272,7 +272,7 @@ Armed with our new combinator, we can rewrite our `extension_explicit` method
to get rid of the case analysis:
```rust
# fn find(_: &str, _: char) -> Option<usize> { None }
# fn find(haystack: &str, needle: char) -> Option<usize> { haystack.find(needle) }
// Returns the extension of the given file name, where the extension is defined
// as all characters following the first `.`.
// If `file_name` has no `.`, then `None` is returned.

View File

@ -125,7 +125,7 @@ warning, but it will still print "Hello, world!":
```text
Compiling hello_world v0.0.1 (file:///home/you/projects/hello_world)
src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variable)]
src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variables)]
on by default
src/main.rs:2 let x: i32;
^

View File

@ -17,7 +17,7 @@ use super::boxed::Box;
use core::ops::Drop;
use core::cmp;
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating a
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
/// a buffer of memory on the heap without having to worry about all the corner cases
/// involved. This type is excellent for building your own data structures like Vec and VecDeque.
/// In particular:
@ -534,8 +534,8 @@ impl<T> RawVec<T> {
/// Converts the entire buffer into `Box<[T]>`.
///
/// While it is not *strictly* Undefined Behavior to call
/// this procedure while some of the RawVec is unintialized,
/// it cetainly makes it trivial to trigger it.
/// this procedure while some of the RawVec is uninitialized,
/// it certainly makes it trivial to trigger it.
///
/// Note that this will correctly reconstitute any `cap` changes
/// that may have been performed. (see description of type for details)

View File

@ -1152,7 +1152,7 @@ impl String {
self.vec.set_len(len + amt);
}
/// Inserts a string into this `String` at a byte position.
/// Inserts a string slice into this `String` at a byte position.
///
/// This is an `O(n)` operation as it requires copying every element in the
/// buffer.
@ -1182,8 +1182,7 @@ impl String {
reason = "recent addition",
issue = "35553")]
pub fn insert_str(&mut self, idx: usize, string: &str) {
let len = self.len();
assert!(idx <= len);
assert!(idx <= self.len());
assert!(self.is_char_boundary(idx));
unsafe {

View File

@ -1446,13 +1446,12 @@ impl<T> IntoIterator for Vec<T> {
#[inline]
fn into_iter(mut self) -> IntoIter<T> {
unsafe {
let ptr = self.as_mut_ptr();
assume(!ptr.is_null());
let begin = ptr as *const T;
let begin = self.as_mut_ptr();
assume(!begin.is_null());
let end = if mem::size_of::<T>() == 0 {
arith_offset(ptr as *const i8, self.len() as isize) as *const T
arith_offset(begin as *const i8, self.len() as isize) as *const T
} else {
ptr.offset(self.len() as isize) as *const T
begin.offset(self.len() as isize) as *const T
};
let buf = ptr::read(&self.buf);
mem::forget(self);
@ -1710,10 +1709,52 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
#[stable(feature = "rust1", since = "1.0.0")]
pub struct IntoIter<T> {
_buf: RawVec<T>,
ptr: *const T,
ptr: *mut T,
end: *const T,
}
impl<T> IntoIter<T> {
/// Returns the remaining items of this iterator as a slice.
///
/// # Examples
///
/// ```rust
/// # #![feature(vec_into_iter_as_slice)]
/// let vec = vec!['a', 'b', 'c'];
/// let mut into_iter = vec.into_iter();
/// assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
/// let _ = into_iter.next().unwrap();
/// assert_eq!(into_iter.as_slice(), &['b', 'c']);
/// ```
#[unstable(feature = "vec_into_iter_as_slice", issue = "35601")]
pub fn as_slice(&self) -> &[T] {
unsafe {
slice::from_raw_parts(self.ptr, self.len())
}
}
/// Returns the remaining items of this iterator as a mutable slice.
///
/// # Examples
///
/// ```rust
/// # #![feature(vec_into_iter_as_slice)]
/// let vec = vec!['a', 'b', 'c'];
/// let mut into_iter = vec.into_iter();
/// assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
/// into_iter.as_mut_slice()[2] = 'z';
/// assert_eq!(into_iter.next().unwrap(), 'a');
/// assert_eq!(into_iter.next().unwrap(), 'b');
/// assert_eq!(into_iter.next().unwrap(), 'z');
/// ```
#[unstable(feature = "vec_into_iter_as_slice", issue = "35601")]
pub fn as_mut_slice(&self) -> &mut [T] {
unsafe {
slice::from_raw_parts_mut(self.ptr, self.len())
}
}
}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: Send> Send for IntoIter<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
@ -1726,14 +1767,14 @@ impl<T> Iterator for IntoIter<T> {
#[inline]
fn next(&mut self) -> Option<T> {
unsafe {
if self.ptr == self.end {
if self.ptr as *const _ == self.end {
None
} else {
if mem::size_of::<T>() == 0 {
// purposefully don't use 'ptr.offset' because for
// vectors with 0-size elements this would return the
// same pointer.
self.ptr = arith_offset(self.ptr as *const i8, 1) as *const T;
self.ptr = arith_offset(self.ptr as *const i8, 1) as *mut T;
// Use a non-null pointer value
Some(ptr::read(EMPTY as *mut T))
@ -1776,7 +1817,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
} else {
if mem::size_of::<T>() == 0 {
// See above for why 'ptr.offset' isn't used
self.end = arith_offset(self.end as *const i8, -1) as *const T;
self.end = arith_offset(self.end as *const i8, -1) as *mut T;
// Use a non-null pointer value
Some(ptr::read(EMPTY as *mut T))
@ -1796,9 +1837,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {}
#[stable(feature = "vec_into_iter_clone", since = "1.8.0")]
impl<T: Clone> Clone for IntoIter<T> {
fn clone(&self) -> IntoIter<T> {
unsafe {
slice::from_raw_parts(self.ptr, self.len()).to_owned().into_iter()
}
self.as_slice().to_owned().into_iter()
}
}

View File

@ -28,6 +28,7 @@
#![feature(unboxed_closures)]
#![feature(unicode)]
#![feature(vec_deque_contains)]
#![feature(vec_into_iter_as_slice)]
extern crate collections;
extern crate test;

View File

@ -478,6 +478,29 @@ fn test_split_off() {
assert_eq!(vec2, [5, 6]);
}
#[test]
fn test_into_iter_as_slice() {
let vec = vec!['a', 'b', 'c'];
let mut into_iter = vec.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &['b', 'c']);
let _ = into_iter.next().unwrap();
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &[]);
}
#[test]
fn test_into_iter_as_mut_slice() {
let vec = vec!['a', 'b', 'c'];
let mut into_iter = vec.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
into_iter.as_mut_slice()[0] = 'x';
into_iter.as_mut_slice()[1] = 'y';
assert_eq!(into_iter.next().unwrap(), 'x');
assert_eq!(into_iter.as_slice(), &['y', 'c']);
}
#[test]
fn test_into_iter_count() {
assert_eq!(vec![1, 2, 3].into_iter().count(), 3);

View File

@ -146,6 +146,7 @@
use clone::Clone;
use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
use convert::From;
use default::Default;
use fmt::{self, Debug, Display};
use marker::{Copy, PhantomData, Send, Sync, Sized, Unsize};
@ -329,6 +330,13 @@ impl<T:Ord + Copy> Ord for Cell<T> {
}
}
#[stable(feature = "cell_from", since = "1.12.0")]
impl<T: Copy> From<T> for Cell<T> {
fn from(t: T) -> Cell<T> {
Cell::new(t)
}
}
/// A mutable memory location with dynamically checked borrow rules
///
/// See the [module-level documentation](index.html) for more.
@ -742,6 +750,13 @@ impl<T: ?Sized + Ord> Ord for RefCell<T> {
}
}
#[stable(feature = "cell_from", since = "1.12.0")]
impl<T> From<T> for RefCell<T> {
fn from(t: T) -> RefCell<T> {
RefCell::new(t)
}
}
struct BorrowRef<'b> {
borrow: &'b Cell<BorrowFlag>,
}
@ -1064,3 +1079,10 @@ impl<T: Default> Default for UnsafeCell<T> {
UnsafeCell::new(Default::default())
}
}
#[stable(feature = "cell_from", since = "1.12.0")]
impl<T> From<T> for UnsafeCell<T> {
fn from(t: T) -> UnsafeCell<T> {
UnsafeCell::new(t)
}
}

View File

@ -71,8 +71,8 @@ use result::Result;
///
/// # Generic Impls
///
/// - `AsRef` auto-dereference if the inner type is a reference or a mutable
/// reference (eg: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`)
/// - `AsRef` auto-dereferences if the inner type is a reference or a mutable
/// reference (e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`)
///
#[stable(feature = "rust1", since = "1.0.0")]
pub trait AsRef<T: ?Sized> {
@ -88,8 +88,8 @@ pub trait AsRef<T: ?Sized> {
///
/// # Generic Impls
///
/// - `AsMut` auto-dereference if the inner type is a reference or a mutable
/// reference (eg: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`)
/// - `AsMut` auto-dereferences if the inner type is a reference or a mutable
/// reference (e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`)
///
#[stable(feature = "rust1", since = "1.0.0")]
pub trait AsMut<T: ?Sized> {

View File

@ -32,7 +32,7 @@
//! atomically-reference-counted shared pointer).
//!
//! Most atomic types may be stored in static variables, initialized using
//! the provided static initializers like `INIT_ATOMIC_BOOL`. Atomic statics
//! the provided static initializers like `ATOMIC_BOOL_INIT`. Atomic statics
//! are often used for lazy global initialization.
//!
//!

View File

@ -132,8 +132,13 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
if ctxt.start_fn.is_none() {
ctxt.start_fn = Some((item.id, item.span));
} else {
span_err!(ctxt.session, item.span, E0138,
"multiple 'start' functions");
struct_span_err!(
ctxt.session, item.span, E0138,
"multiple 'start' functions")
.span_label(ctxt.start_fn.unwrap().1,
&format!("previous `start` function here"))
.span_label(item.span, &format!("multiple `start` functions"))
.emit();
}
},
EntryPointType::None => ()

View File

@ -222,7 +222,24 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
ty::TyArray(_, n) => format!("array of {} elements", n),
ty::TySlice(_) => "slice".to_string(),
ty::TyRawPtr(_) => "*-ptr".to_string(),
ty::TyRef(_, _) => "&-ptr".to_string(),
ty::TyRef(region, tymut) => {
let tymut_string = tymut.to_string();
if tymut_string == "_" || //unknown type name,
tymut_string.len() > 10 || //name longer than saying "reference",
region.to_string() != "" //... or a complex type
{
match tymut {
ty::TypeAndMut{mutbl, ..} => {
format!("{}reference", match mutbl {
hir::Mutability::MutMutable => "mutable ",
_ => ""
})
}
}
} else {
format!("&{}", tymut_string)
}
}
ty::TyFnDef(..) => format!("fn item"),
ty::TyFnPtr(_) => "fn pointer".to_string(),
ty::TyTrait(ref inner) => {

View File

@ -1175,8 +1175,10 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
_: LoanCause) {
match kind {
MutBorrow => {
span_err!(self.cx.tcx.sess, span, E0301,
struct_span_err!(self.cx.tcx.sess, span, E0301,
"cannot mutably borrow in a pattern guard")
.span_label(span, &format!("borrowed mutably in pattern guard"))
.emit();
}
ImmBorrow | UniqueImmBorrow => {}
}
@ -1185,7 +1187,9 @@ impl<'a, 'gcx, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'gcx> {
fn mutate(&mut self, _: NodeId, span: Span, _: cmt, mode: MutateMode) {
match mode {
MutateMode::JustWrite | MutateMode::WriteAndRead => {
span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
.span_label(span, &format!("assignment in pattern guard"))
.emit();
}
MutateMode::Init => {}
}

View File

@ -77,10 +77,14 @@ impl<'a> CheckLoopVisitor<'a> {
match self.cx {
Loop => {}
Closure => {
span_err!(self.sess, span, E0267, "`{}` inside of a closure", name);
struct_span_err!(self.sess, span, E0267, "`{}` inside of a closure", name)
.span_label(span, &format!("cannot break inside of a closure"))
.emit();
}
Normal => {
span_err!(self.sess, span, E0268, "`{}` outside of loop", name);
struct_span_err!(self.sess, span, E0268, "`{}` outside of loop", name)
.span_label(span, &format!("cannot break outside of a loop"))
.emit();
}
}
}

View File

@ -3374,8 +3374,11 @@ impl<'a> Resolver<'a> {
let mut err = match (old_binding.is_extern_crate(), binding.is_extern_crate()) {
(true, true) => struct_span_err!(self.session, span, E0259, "{}", msg),
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() =>
struct_span_err!(self.session, span, E0254, "{}", msg),
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() => {
let mut e = struct_span_err!(self.session, span, E0254, "{}", msg);
e.span_label(span, &"already imported");
e
},
(true, _) | (_, true) => struct_span_err!(self.session, span, E0260, "{}", msg),
_ => match (old_binding.is_import(), binding.is_import()) {
(false, false) => struct_span_err!(self.session, span, E0428, "{}", msg),

View File

@ -505,7 +505,9 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
}
Success(binding) if !binding.is_importable() => {
let msg = format!("`{}` is not directly importable", target);
span_err!(self.session, directive.span, E0253, "{}", &msg);
struct_span_err!(self.session, directive.span, E0253, "{}", &msg)
.span_label(directive.span, &format!("cannot be imported directly"))
.emit();
// Do not import this illegal binding. Import a dummy binding and pretend
// everything is fine
self.import_dummy_binding(module, directive);

View File

@ -51,10 +51,12 @@ fn equate_intrinsic_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
}));
let i_n_tps = i_ty.generics.types.len(subst::FnSpace);
if i_n_tps != n_tps {
span_err!(tcx.sess, it.span, E0094,
struct_span_err!(tcx.sess, it.span, E0094,
"intrinsic has wrong number of type \
parameters: found {}, expected {}",
i_n_tps, n_tps);
i_n_tps, n_tps)
.span_label(it.span, &format!("expected {} type parameter", n_tps))
.emit();
} else {
require_same_types(ccx,
TypeOrigin::IntrinsicType(it.span),

View File

@ -3520,8 +3520,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let tcx = self.tcx;
if !tcx.expr_is_lval(&lhs) {
span_err!(tcx.sess, expr.span, E0070,
"invalid left-hand side expression");
struct_span_err!(
tcx.sess, expr.span, E0070,
"invalid left-hand side expression")
.span_label(
expr.span,
&format!("left-hand of expression not valid"))
.emit();
}
let lhs_ty = self.expr_ty(&lhs);

View File

@ -41,7 +41,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
let tcx = self.tcx;
if !tcx.expr_is_lval(lhs_expr) {
span_err!(tcx.sess, lhs_expr.span, E0067, "invalid left-hand side expression");
struct_span_err!(
tcx.sess, lhs_expr.span,
E0067, "invalid left-hand side expression")
.span_label(
lhs_expr.span,
&format!("invalid expression for left-hand side"))
.emit();
}
}

View File

@ -526,10 +526,10 @@ pub fn temp_dir() -> PathBuf {
/// Ok("/home/alex/bar")
/// ```
///
/// This sort of behavior has been known to [lead to privledge escalation] when
/// This sort of behavior has been known to [lead to privilege escalation] when
/// used incorrectly, for example.
///
/// [lead to privledge escalation]: http://securityvulns.com/Wdocument183.html
/// [lead to privilege escalation]: http://securityvulns.com/Wdocument183.html
///
/// # Examples
///

View File

@ -25,9 +25,10 @@ use cell::RefCell;
use fmt;
use intrinsics;
use mem;
use ptr;
use raw;
use sys_common::rwlock::RWLock;
use sys::stdio::Stderr;
use sys_common::rwlock::RWLock;
use sys_common::thread_info;
use sys_common::util;
use thread;
@ -255,46 +256,77 @@ pub use realstd::rt::update_panic_count;
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
let mut slot = None;
let mut f = Some(f);
let ret;
struct Data<F, R> {
f: F,
r: R,
}
{
let mut to_run = || {
slot = Some(f.take().unwrap()());
};
let fnptr = get_call(&mut to_run);
let dataptr = &mut to_run as *mut _ as *mut u8;
let mut any_data = 0;
let mut any_vtable = 0;
let fnptr = mem::transmute::<fn(&mut _), fn(*mut u8)>(fnptr);
let r = __rust_maybe_catch_panic(fnptr,
dataptr,
&mut any_data,
&mut any_vtable);
if r == 0 {
ret = Ok(());
} else {
update_panic_count(-1);
ret = Err(mem::transmute(raw::TraitObject {
data: any_data as *mut _,
vtable: any_vtable as *mut _,
}));
// We do some sketchy operations with ownership here for the sake of
// performance. The `Data` structure is never actually fully valid, but
// instead it always contains at least one uninitialized field. We can only
// pass pointers down to `__rust_maybe_catch_panic` (can't pass objects by
// value), so we do all the ownership tracking here manully.
//
// Note that this is all invalid if any of these functions unwind, but the
// whole point of this function is to prevent that! As a result we go
// through a transition where:
//
// * First, only the closure we're going to call is initialized. The return
// value is uninitialized.
// * When we make the function call, the `do_call` function below, we take
// ownership of the function pointer, replacing it with uninitialized
// data. At this point the `Data` structure is entirely uninitialized, but
// it won't drop due to an unwind because it's owned on the other side of
// the catch panic.
// * If the closure successfully returns, we write the return value into the
// data's return slot. Note that `ptr::write` is used as it's overwriting
// uninitialized data.
// * Finally, when we come back out of the `__rust_maybe_catch_panic` we're
// in one of two states:
//
// 1. The closure didn't panic, in which case the return value was
// filled in. We have to be careful to `forget` the closure,
// however, as ownership was passed to the `do_call` function.
// 2. The closure panicked, in which case the return value wasn't
// filled in. In this case the entire `data` structure is invalid,
// so we forget the entire thing.
//
// Once we stack all that together we should have the "most efficient'
// method of calling a catch panic whilst juggling ownership.
let mut any_data = 0;
let mut any_vtable = 0;
let mut data = Data {
f: f,
r: mem::uninitialized(),
};
let r = __rust_maybe_catch_panic(do_call::<F, R>,
&mut data as *mut _ as *mut u8,
&mut any_data,
&mut any_vtable);
return if r == 0 {
let Data { f, r } = data;
mem::forget(f);
debug_assert!(update_panic_count(0) == 0);
Ok(r)
} else {
mem::forget(data);
update_panic_count(-1);
debug_assert!(update_panic_count(0) == 0);
Err(mem::transmute(raw::TraitObject {
data: any_data as *mut _,
vtable: any_vtable as *mut _,
}))
};
fn do_call<F: FnOnce() -> R, R>(data: *mut u8) {
unsafe {
let data = data as *mut Data<F, R>;
let f = ptr::read(&mut (*data).f);
ptr::write(&mut (*data).r, f());
}
}
debug_assert!(update_panic_count(0) == 0);
return ret.map(|()| {
slot.take().unwrap()
});
fn get_call<F: FnMut()>(_: &mut F) -> fn(&mut F) {
call
}
fn call<F: FnMut()>(f: &mut F) {
f()
}
}
/// Determines whether the current thread is unwinding because of panic.

View File

@ -83,11 +83,11 @@ pub fn init() {
}
}
#[cfg(not(target_os = "nacl"))]
#[cfg(not(any(target_os = "nacl", target_os = "emscripten")))]
unsafe fn reset_sigpipe() {
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0);
}
#[cfg(target_os = "nacl")]
#[cfg(any(target_os = "nacl", target_os = "emscripten"))]
unsafe fn reset_sigpipe() {}
}

View File

@ -551,11 +551,13 @@ pub fn home_dir() -> Option<PathBuf> {
#[cfg(any(target_os = "android",
target_os = "ios",
target_os = "nacl"))]
target_os = "nacl",
target_os = "emscripten"))]
unsafe fn fallback() -> Option<OsString> { None }
#[cfg(not(any(target_os = "android",
target_os = "ios",
target_os = "nacl")))]
target_os = "nacl",
target_os = "emscripten")))]
unsafe fn fallback() -> Option<OsString> {
#[cfg(not(target_os = "solaris"))]
unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,

View File

@ -81,8 +81,7 @@ impl Thread {
}
#[cfg(any(target_os = "linux",
target_os = "android",
target_os = "emscripten"))]
target_os = "android"))]
pub fn set_name(name: &CStr) {
const PR_SET_NAME: libc::c_int = 15;
// pthread wrapper only appeared in glibc 2.12, so we use syscall
@ -118,9 +117,9 @@ impl Thread {
name.as_ptr() as *mut libc::c_void);
}
}
#[cfg(any(target_env = "newlib", target_os = "solaris"))]
#[cfg(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten"))]
pub fn set_name(_name: &CStr) {
// Newlib and Illumos has no way to set a thread name.
// Newlib, Illumos and Emscripten have no way to set a thread name.
}
pub fn sleep(dur: Duration) {

View File

@ -314,7 +314,7 @@ declare_features! (
(accepted, issue_5723_bootstrap, "1.0.0", None),
(accepted, macro_rules, "1.0.0", None),
// Allows using #![no_std]
(accepted, no_std, "1.0.0", None),
(accepted, no_std, "1.6.0", None),
(accepted, slicing_syntax, "1.0.0", None),
(accepted, struct_variant, "1.0.0", None),
// These are used to test this portion of the compiler, they don't actually

View File

@ -3788,19 +3788,18 @@ impl<'a> Parser<'a> {
}
/// Parse a structure field
fn parse_name_and_ty(&mut self, pr: Visibility,
attrs: Vec<Attribute> ) -> PResult<'a, StructField> {
let lo = match pr {
Visibility::Inherited => self.span.lo,
_ => self.last_span.lo,
};
fn parse_name_and_ty(&mut self,
lo: BytePos,
vis: Visibility,
attrs: Vec<Attribute>)
-> PResult<'a, StructField> {
let name = self.parse_ident()?;
self.expect(&token::Colon)?;
let ty = self.parse_ty_sum()?;
Ok(StructField {
span: mk_sp(lo, self.last_span.hi),
ident: Some(name),
vis: pr,
vis: vis,
id: ast::DUMMY_NODE_ID,
ty: ty,
attrs: attrs,
@ -5120,10 +5119,11 @@ impl<'a> Parser<'a> {
/// Parse a structure field declaration
pub fn parse_single_struct_field(&mut self,
lo: BytePos,
vis: Visibility,
attrs: Vec<Attribute> )
-> PResult<'a, StructField> {
let a_var = self.parse_name_and_ty(vis, attrs)?;
let a_var = self.parse_name_and_ty(lo, vis, attrs)?;
match self.token {
token::Comma => {
self.bump();
@ -5144,8 +5144,9 @@ impl<'a> Parser<'a> {
/// Parse an element of a struct definition
fn parse_struct_decl_field(&mut self) -> PResult<'a, StructField> {
let attrs = self.parse_outer_attributes()?;
let lo = self.span.lo;
let vis = self.parse_visibility(true)?;
self.parse_single_struct_field(vis, attrs)
self.parse_single_struct_field(lo, vis, attrs)
}
// If `allow_path` is false, just parse the `pub` in `pub(path)` (but still parse `pub(crate)`)

View File

@ -340,6 +340,11 @@ pub struct TokenStream {
ts: InternalTS,
}
// This indicates the maximum size for a leaf in the concatenation algorithm.
// If two leafs will be collectively smaller than this, they will be merged.
// If a leaf is larger than this, it will be concatenated at the top.
const LEAF_SIZE : usize = 32;
// NB If Leaf access proves to be slow, inroducing a secondary Leaf without the bounds
// for unsliced Leafs may lead to some performance improvemenet.
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
@ -483,6 +488,37 @@ impl InternalTS {
}
}
}
fn to_vec(&self) -> Vec<&TokenTree> {
let mut res = Vec::with_capacity(self.len());
fn traverse_and_append<'a>(res: &mut Vec<&'a TokenTree>, ts: &'a InternalTS) {
match *ts {
InternalTS::Empty(..) => {},
InternalTS::Leaf { ref tts, offset, len, .. } => {
let mut to_app = tts[offset..offset + len].iter().collect();
res.append(&mut to_app);
}
InternalTS::Node { ref left, ref right, .. } => {
traverse_and_append(res, left);
traverse_and_append(res, right);
}
}
}
traverse_and_append(&mut res, self);
res
}
fn to_tts(&self) -> Vec<TokenTree> {
self.to_vec().into_iter().cloned().collect::<Vec<TokenTree>>()
}
// Returns an internal node's children.
fn children(&self) -> Option<(Rc<InternalTS>, Rc<InternalTS>)> {
match *self {
InternalTS::Node { ref left, ref right, .. } => Some((left.clone(), right.clone())),
_ => None,
}
}
}
/// TokenStream operators include basic destructuring, boolean operations, `maybe_...`
@ -496,14 +532,17 @@ impl InternalTS {
///
/// `maybe_path_prefix("a::b::c(a,b,c).foo()") -> (a::b::c, "(a,b,c).foo()")`
impl TokenStream {
// Construct an empty node with a dummy span.
pub fn mk_empty() -> TokenStream {
TokenStream { ts: InternalTS::Empty(DUMMY_SP) }
}
// Construct an empty node with the provided span.
fn mk_spanned_empty(sp: Span) -> TokenStream {
TokenStream { ts: InternalTS::Empty(sp) }
}
// Construct a leaf node with a 0 offset and length equivalent to the input.
fn mk_leaf(tts: Rc<Vec<TokenTree>>, sp: Span) -> TokenStream {
let len = tts.len();
TokenStream {
@ -516,6 +555,7 @@ impl TokenStream {
}
}
// Construct a leaf node with the provided values.
fn mk_sub_leaf(tts: Rc<Vec<TokenTree>>, offset: usize, len: usize, sp: Span) -> TokenStream {
TokenStream {
ts: InternalTS::Leaf {
@ -527,6 +567,7 @@ impl TokenStream {
}
}
// Construct an internal node with the provided values.
fn mk_int_node(left: Rc<InternalTS>,
right: Rc<InternalTS>,
len: usize,
@ -561,11 +602,56 @@ impl TokenStream {
}
}
/// Concatenates two TokenStreams into a new TokenStream
/// Concatenates two TokenStreams into a new TokenStream.
pub fn concat(left: TokenStream, right: TokenStream) -> TokenStream {
let new_len = left.len() + right.len();
let new_span = combine_spans(left.span(), right.span());
TokenStream::mk_int_node(Rc::new(left.ts), Rc::new(right.ts), new_len, new_span)
// This internal procedure performs 'aggressive compacting' during concatenation as
// follows:
// - If the nodes' combined total total length is less than 32, we copy both of
// them into a new vector and build a new leaf node.
// - If one node is an internal node and the other is a 'small' leaf (length<32),
// we recur down the internal node on the appropriate side.
// - Otherwise, we construct a new internal node that points to them as left and
// right.
fn concat_internal(left: Rc<InternalTS>, right: Rc<InternalTS>) -> TokenStream {
let llen = left.len();
let rlen = right.len();
let len = llen + rlen;
let span = combine_spans(left.span(), right.span());
if len <= LEAF_SIZE {
let mut new_vec = left.to_tts();
let mut rvec = right.to_tts();
new_vec.append(&mut rvec);
return TokenStream::mk_leaf(Rc::new(new_vec), span);
}
match (left.children(), right.children()) {
(Some((lleft, lright)), None) => {
if rlen <= LEAF_SIZE {
let new_right = concat_internal(lright, right);
TokenStream::mk_int_node(lleft, Rc::new(new_right.ts), len, span)
} else {
TokenStream::mk_int_node(left, right, len, span)
}
}
(None, Some((rleft, rright))) => {
if rlen <= LEAF_SIZE {
let new_left = concat_internal(left, rleft);
TokenStream::mk_int_node(Rc::new(new_left.ts), rright, len, span)
} else {
TokenStream::mk_int_node(left, right, len, span)
}
}
(_, _) => TokenStream::mk_int_node(left, right, len, span),
}
}
if left.is_empty() {
right
} else if right.is_empty() {
left
} else {
concat_internal(Rc::new(left.ts), Rc::new(right.ts))
}
}
/// Indicate if the TokenStream is empty.
@ -580,27 +666,13 @@ impl TokenStream {
/// Convert a TokenStream into a vector of borrowed TokenTrees.
pub fn to_vec(&self) -> Vec<&TokenTree> {
fn internal_to_vec(ts: &InternalTS) -> Vec<&TokenTree> {
match *ts {
InternalTS::Empty(..) => Vec::new(),
InternalTS::Leaf { ref tts, offset, len, .. } => {
tts[offset..offset + len].iter().collect()
}
InternalTS::Node { ref left, ref right, .. } => {
let mut v1 = internal_to_vec(left);
let mut v2 = internal_to_vec(right);
v1.append(&mut v2);
v1
}
}
}
internal_to_vec(&self.ts)
self.ts.to_vec()
}
/// Convert a TokenStream into a vector of TokenTrees (by cloning the TokenTrees).
/// (This operation is an O(n) deep copy of the underlying structure.)
pub fn to_tts(&self) -> Vec<TokenTree> {
self.to_vec().into_iter().cloned().collect::<Vec<TokenTree>>()
self.ts.to_tts()
}
/// Return the TokenStream's span.

View File

@ -60,7 +60,6 @@ pub const unwinder_private_data_size: usize = 2;
pub const unwinder_private_data_size: usize = 2;
#[cfg(target_arch = "asmjs")]
// FIXME: Copied from arm. Need to confirm.
pub const unwinder_private_data_size: usize = 20;
#[repr(C)]

View File

@ -13,4 +13,6 @@ use std::collections::LinkedList;
fn main() {
LinkedList::new() += 1; //~ ERROR E0368
//~^ ERROR E0067
//~^^ NOTE invalid expression for left-hand side
//~| NOTE cannot use `+=` on type `std::collections::LinkedList<_>`
}

View File

@ -11,6 +11,7 @@
#![feature(intrinsics)]
extern "rust-intrinsic" {
fn size_of<T, U>() -> usize; //~ ERROR E0094
//~| NOTE expected 1 type parameter
}
fn main() {

View File

@ -12,6 +12,9 @@
#[start]
fn foo(argc: isize, argv: *const *const u8) -> isize {}
//~^ NOTE previous `start` function here
#[start]
fn f(argc: isize, argv: *const *const u8) -> isize {} //~ ERROR E0138
fn f(argc: isize, argv: *const *const u8) -> isize {}
//~^ ERROR E0138
//~| NOTE multiple `start` functions

View File

@ -14,6 +14,8 @@ mod foo {
}
}
use foo::MyTrait::do_something; //~ ERROR E0253
use foo::MyTrait::do_something;
//~^ ERROR E0253
//~|NOTE cannot be imported directly
fn main() {}

View File

@ -9,6 +9,7 @@
// except according to those terms.
extern crate collections;
//~^ NOTE previous import of `collections` here
mod foo {
pub trait collections {
@ -16,6 +17,8 @@ mod foo {
}
}
use foo::collections; //~ ERROR E0254
use foo::collections;
//~^ ERROR E0254
//~| NOTE already imported
fn main() {}

View File

@ -10,4 +10,5 @@
fn main() {
let w = || { break; }; //~ ERROR E0267
//~| NOTE cannot break inside of a closure
}

View File

@ -10,4 +10,5 @@
fn main() {
break; //~ ERROR E0268
//~| NOTE cannot break outside of a loop
}

View File

@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if option.take().is_none() => {}, //~ ERROR E0301
//~| NOTE borrowed mutably in pattern guard
Some(_) => { }
}
}

View File

@ -12,6 +12,7 @@ fn main() {
match Some(()) {
None => { },
option if { option = None; false } => { }, //~ ERROR E0302
//~| NOTE assignment in pattern guard
Some(_) => { }
}
}

View File

@ -15,5 +15,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `&[i32]`
//~| found type `[{integer}; 1]`
//~| expected &-ptr, found array of 1 elements
//~| expected &[i32], found array of 1 elements
}

View File

@ -21,5 +21,5 @@ pub fn main() {
let _y: &Trait = x; //~ ERROR mismatched types
//~| expected type `&Trait`
//~| found type `Box<Trait>`
//~| expected &-ptr, found box
//~| expected &Trait, found box
}

View File

@ -42,12 +42,12 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `T`
//~| found type `&_`
//~| expected trait T, found &-ptr
//~| expected trait T, found reference
let &&&x = &(&1isize as &T);
//~^ ERROR mismatched types
//~| expected type `T`
//~| found type `&_`
//~| expected trait T, found &-ptr
//~| expected trait T, found reference
let box box x = box 1isize as Box<T>;
//~^ ERROR mismatched types
//~| expected type `T`

View File

@ -19,12 +19,12 @@ struct Foo<T: ?Sized> {
}
pub fn main() {
// Test that we cannot convert from *-ptr to &-ptr
// Test that we cannot convert from *-ptr to &S and &T
let x: *const S = &S;
let y: &S = x; //~ ERROR mismatched types
let y: &T = x; //~ ERROR mismatched types
// Test that we cannot convert from *-ptr to &-ptr (mut version)
// Test that we cannot convert from *-ptr to &S and &T (mut version)
let x: *mut S = &mut S;
let y: &S = x; //~ ERROR mismatched types
let y: &T = x; //~ ERROR mismatched types

View File

@ -17,4 +17,4 @@ fn bar(x: isize) { }
//~^ ERROR mismatched types
//~| expected type `fn(&mut __test::test::Bencher)`
//~| found type `fn(isize) {bar}`
//~| expected &-ptr, found isize
//~| expected mutable reference, found isize

View File

@ -18,5 +18,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `&str`
//~| found type `Slice<_>`
//~| expected &-ptr, found struct `Slice`
//~| expected &str, found struct `Slice`
}

View File

@ -12,7 +12,7 @@ fn f<'r>(p: &'r mut fn(p: &mut ())) {
(*p)(()) //~ ERROR mismatched types
//~| expected type `&mut ()`
//~| found type `()`
//~| expected &-ptr, found ()
//~| expected &mut (), found ()
}
fn main() {}

View File

@ -15,13 +15,13 @@ struct Foo;
impl<'a, T> Fn<(&'a T,)> for Foo {
extern "rust-call" fn call(&self, (_,): (T,)) {}
//~^ ERROR: has an incompatible type for trait
//~| expected &-ptr
//~| expected reference
}
impl<'a, T> FnMut<(&'a T,)> for Foo {
extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
//~^ ERROR: has an incompatible type for trait
//~| expected &-ptr
//~| expected reference
}
impl<'a, T> FnOnce<(&'a T,)> for Foo {
@ -29,7 +29,7 @@ impl<'a, T> FnOnce<(&'a T,)> for Foo {
extern "rust-call" fn call_once(self, (_,): (T,)) {}
//~^ ERROR: has an incompatible type for trait
//~| expected &-ptr
//~| expected reference
}
fn main() {}

View File

@ -12,6 +12,7 @@ macro_rules! not_an_lvalue {
($thing:expr) => {
$thing = 42;
//~^ ERROR invalid left-hand side expression
//~^^ NOTE left-hand of expression not valid
}
}

View File

@ -13,7 +13,7 @@ macro_rules! foo {
fn bar(d: u8) { }
bar(&mut $d);
//~^ ERROR mismatched types
//~| expected u8, found &-ptr
//~| expected u8, found &mut u8
//~| expected type `u8`
//~| found type `&mut u8`
}}

View File

@ -52,7 +52,7 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `(bool, bool)`
//~| found type `&_`
//~| expected tuple, found &-ptr
//~| expected tuple, found reference
}

View File

@ -13,5 +13,5 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `()`
//~| found type `&_`
//~| expected (), found &-ptr
//~| expected (), found reference
}

View File

@ -15,7 +15,7 @@ impl<'a> BarStruct {
//~^ ERROR mismatched types
//~| expected type `Box<BarStruct>`
//~| found type `&'a mut BarStruct`
//~| expected box, found &-ptr
//~| expected box, found mutable reference
}
fn main() {}

View File

@ -27,11 +27,11 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `&std::option::Option<{integer}>`
//~| found type `std::option::Option<_>`
//~| expected &-ptr, found enum `std::option::Option`
//~| expected reference, found enum `std::option::Option`
None => ()
//~^ ERROR mismatched types
//~| expected type `&std::option::Option<{integer}>`
//~| found type `std::option::Option<_>`
//~| expected &-ptr, found enum `std::option::Option`
//~| expected reference, found enum `std::option::Option`
}
}

View File

@ -21,7 +21,7 @@ fn main() {
Foo::bar(x); //~ ERROR mismatched types
//~| expected type `&Foo`
//~| found type `Foo`
//~| expected &-ptr, found struct `Foo`
//~| expected &Foo, found struct `Foo`
Foo::bar(&42); //~ ERROR mismatched types
//~| expected type `&Foo`
//~| found type `&{integer}`

View File

@ -36,7 +36,7 @@ fn main() {
y: 3,
};
let ans = s("what"); //~ ERROR mismatched types
//~^ NOTE expected isize, found &-ptr
//~^ NOTE expected isize, found reference
//~| NOTE expected type
//~| NOTE found type
let ans = s();

View File

@ -1,30 +0,0 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Regression test for issue #26083
// Test that span for public struct fields start at `pub` instead of the identifier
struct Foo {
pub bar: u8,
pub
//~^ error: field `bar` is already declared [E0124]
bar: u8,
pub bar:
//~^ error: field `bar` is already declared [E0124]
u8,
bar:
//~^ error: field `bar` is already declared [E0124]
u8,
}
fn main() { }

View File

@ -38,7 +38,7 @@ fn main() {
//~^ ERROR mismatched types
//~| expected type `usize`
//~| found type `&'static str`
//~| expected usize, found &-ptr
//~| expected usize, found reference
//~| ERROR expected `usize` for repeat count, found string literal [E0306]
//~| expected `usize`
let f = [0; -4_isize];

View File

@ -12,6 +12,7 @@
// ignore-android: FIXME(#10356)
// ignore-windows: std::dynamic_lib does not work on Windows well
// ignore-musl
// ignore-emscripten no dynamic linking
extern crate linkage_visibility as foo;

View File

@ -9,6 +9,7 @@
// except according to those terms.
// exec-env:RUST_LOG=logging_enabled=info
// ignore-emscripten: FIXME(#31622)
#![feature(rustc_private)]

View File

@ -11,6 +11,7 @@
// ignore-windows
// exec-env:RUST_LOG=debug
// compile-flags:-C debug-assertions=y
// ignore-emscripten: FIXME(#31622)
#![feature(rustc_private)]

View File

@ -12,7 +12,7 @@
// ignore-pretty: does not work well with `--test`
#![feature(quote, rustc_private)]
#![deny(unused_variable)]
#![deny(unused_variables)]
extern crate syntax;

View File

@ -17,6 +17,7 @@
// compile-flags:-g -Cllvm-args=-enable-tail-merge=0
// ignore-pretty as this critically relies on line numbers
// ignore-emscripten spawning processes is not supported
use std::io;
use std::io::prelude::*;

View File

@ -10,6 +10,7 @@
// no-pretty-expanded FIXME #15189
// ignore-android FIXME #17520
// ignore-emscripten spawning processes is not supported
// compile-flags:-g
use std::env;

View File

@ -9,6 +9,7 @@
// except according to those terms.
// ignore-windows - this is a unix-specific test
// ignore-emscripten
#![feature(process_exec, libc)]

View File

@ -9,6 +9,7 @@
// except according to those terms.
// ignore-windows - this is a unix-specific test
// ignore-emscripten
// ignore-pretty
#![feature(process_exec)]

View File

@ -9,6 +9,7 @@
// except according to those terms.
// compile-flags: -Z force-dropflag-checks=on
// ignore-emscripten
// Quick-and-dirty test to ensure -Z force-dropflag-checks=on works as
// expected. Note that the inlined drop-flag is slated for removal

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten no threads support
#![allow(unknown_features)]
#![feature(box_syntax)]

View File

@ -11,7 +11,7 @@
// pretty-expanded FIXME #23616
#![allow(dead_assignment)]
#![allow(unused_variable)]
#![allow(unused_variables)]
enum Animal {
Dog (String, f64),

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
use std::env::args;
use std::process::Command;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
#![feature(path)]

View File

@ -9,7 +9,7 @@
// except according to those terms.
// exec-env:TEST_EXEC_ENV=22
// ignore-emscripten FIXME: issue #31622
use std::env;

View File

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![allow(unused_variable)]
#![allow(unused_variables)]
pub fn main() {
// We should be able to type infer inside of ||s.

View File

@ -11,7 +11,7 @@
// pretty-expanded FIXME #23616
#![allow(dead_assignment)]
#![allow(unused_variable)]
#![allow(unused_variables)]
#![allow(unknown_features)]
#![feature(box_syntax)]

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten No support for threads
#![allow(unknown_features)]
#![feature(std_misc)]

View File

@ -24,7 +24,8 @@ mod rusti {
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris"))]
target_os = "solaris",
target_os = "emscripten"))]
mod m {
#[main]
#[cfg(target_arch = "x86")]

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
// Make sure that if a process doesn't have its stdio/stderr descriptors set up
// that we don't die in a large ball of fire

View File

@ -12,6 +12,7 @@
// aux-build:issue-12133-dylib.rs
// aux-build:issue-12133-dylib2.rs
// ignore-musl
// ignore-emscripten no dylib support
// pretty-expanded FIXME #23616

View File

@ -16,7 +16,7 @@ extern crate issue12660aux;
use issue12660aux::{my_fn, MyStruct};
#[allow(path_statement)]
#[allow(path_statements)]
fn main() {
my_fn(MyStruct);
MyStruct;

View File

@ -9,6 +9,7 @@
// except according to those terms.
// ignore-aarch64
// ignore-emscripten
#![feature(io, process_capture)]
use std::env;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
#![feature(io, process_capture)]

View File

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![allow(unused_variable)]
#![allow(unused_variables)]
struct T { f: extern "Rust" fn() }
struct S { f: extern "Rust" fn() }

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
use std::env;
use std::process::Command;

View File

@ -9,6 +9,7 @@
// except according to those terms.
// ignore-aarch64
// ignore-emscripten
use std::process::Command;
use std::env;

View File

@ -9,6 +9,7 @@
// except according to those terms.
// ignore-aarch64
// ignore-emscripten
#![feature(std_misc, os)]
#[cfg(unix)]

View File

@ -9,6 +9,7 @@
// except according to those terms.
// pretty-expanded FIXME #23616
// ignore-emscripten
use std::thread::Builder;

View File

@ -0,0 +1,13 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(dead_code)]
static X: &'static str = &*"";
fn main() {}

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
use std::thread;
use std::env;
use std::process::Command;

View File

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
// compile-flags: -Z orbit=off
// (blows the stack with MIR trans and no optimizations)

View File

@ -9,6 +9,7 @@
// except according to those terms.
// aux-build:issue-29485.rs
// ignore-emscripten
#[feature(recover)]

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
// Previously libstd would set stdio descriptors of a child process
// by `dup`ing the requested descriptors to inherit directly into the
// stdio descriptors. This, however, would incorrectly handle cases

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-emscripten
use std::process::{Command, Stdio};
use std::env;
use std::sync::{Mutex, RwLock};

View File

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![allow(path_statement)]
#![allow(path_statements)]
#![allow(unknown_features)]
#![feature(box_syntax)]

View File

@ -12,7 +12,7 @@
// `e` is a type which requires a destructor.
#![allow(path_statement)]
#![allow(path_statements)]
struct A { n: isize }
struct B;

View File

@ -13,7 +13,7 @@
// (Closes #7911) Test that we can use the same self expression
// with different mutability in macro in two methods
#![allow(unused_variable)] // unused foobar_immut + foobar_mut
#![allow(unused_variables)] // unused foobar_immut + foobar_mut
trait FooBar {
fn dummy(&self) { }
}

View File

@ -10,6 +10,7 @@
// ignore-windows
// ignore-macos
// ignore-emscripten
// aux-build:linkage1.rs
#![feature(linkage)]

View File

@ -12,7 +12,7 @@
#![allow(dead_assignment)]
#![allow(unreachable_code)]
#![allow(unused_variable)]
#![allow(unused_variables)]
fn test(_cond: bool) {
let v: isize;

View File

@ -10,7 +10,7 @@
// pretty-expanded FIXME #23616
#![allow(unused_variable)]
#![allow(unused_variables)]
pub fn main() {
let mut i: isize = 0;

Some files were not shown because too many files have changed in this diff Show More