Skip to content

Commit 63dcc9a

Browse files
committed
auto merge of #14867 : alexcrichton/rust/rollup, r=alexcrichton
2 parents e7f11f2 + b7af250 commit 63dcc9a

Some content is hidden

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

71 files changed

+1165
-411
lines changed

configure

+19-54
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ opt mingw-cross 0 "cross-compile for win32 using mingw"
416416
opt clang 0 "prefer clang to gcc for building the runtime"
417417
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
418418
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
419-
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
420419
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
421420
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
422421
opt rpath 1 "build rpaths into rustc itself"
@@ -518,12 +517,6 @@ then
518517
fi
519518
fi
520519

521-
if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
522-
then
523-
probe CFG_PAXCTL paxctl /sbin/paxctl
524-
probe CFG_ZCAT zcat
525-
fi
526-
527520
step_msg "looking for target specific programs"
528521

529522
probe CFG_ADB adb
@@ -546,51 +539,6 @@ then
546539
fi
547540
fi
548541

549-
if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
550-
then
551-
if [ ! -z "$CFG_ENABLE_PAX_FLAGS" -a -z "$CFG_PAXCTL" ]
552-
then
553-
err "enabled PaX markings but no paxctl binary found"
554-
fi
555-
556-
if [ -z "$CFG_DISABLE_PAX_FLAGS" ]
557-
then
558-
# GRSecurity/PaX detection. This can be very flaky.
559-
GRSEC_DETECTED=
560-
561-
# /dev/grsec only exists if CONFIG_GRKERNSEC_NO_RBAC is not set.
562-
# /proc/sys/kernel/grsecurity is not available if ÇONFIG_GRKERNSEC_SYSCTL is not set.
563-
if [ -e /dev/grsec -o -d /proc/sys/kernel/grsecurity ]
564-
then
565-
GRSEC_DETECTED=1
566-
# /proc/config.gz is normally only available to root, and only if CONFIG_IKCONFIG_PROC has been set.
567-
elif [ -r /proc/config.gz -a ! -z "$CFG_ZCAT" ]
568-
then
569-
if "$CFG_ZCAT" /proc/config.gz | grep --quiet "CONFIG_GRKERNSEC=y"
570-
then
571-
GRSEC_DETECTED=1
572-
fi
573-
# Flaky.
574-
elif grep --quiet grsec /proc/version
575-
then
576-
GRSEC_DETECTED=1
577-
fi
578-
579-
if [ ! -z "$GRSEC_DETECTED" ]
580-
then
581-
step_msg "GRSecurity: yes"
582-
if [ ! -z "$CFG_PAXCTL" ]
583-
then
584-
CFG_ENABLE_PAX_FLAGS=1
585-
else
586-
warn "GRSecurity kernel detected but no paxctl binary found: not setting CFG_ENABLE_PAX_FLAGS"
587-
fi
588-
else
589-
step_msg "GRSecurity: no"
590-
fi
591-
fi
592-
fi
593-
594542
BIN_SUF=
595543
if [ "$CFG_OSTYPE" = "pc-mingw32" ] || [ "$CFG_OSTYPE" = "w64-mingw32" ]
596544
then
@@ -942,16 +890,33 @@ then
942890
msg "git: submodule sync"
943891
"${CFG_GIT}" submodule sync
944892

893+
msg "git: submodule init"
894+
"${CFG_GIT}" submodule init
895+
896+
# Disable submodules that we're not using
897+
if [ ! -z "${CFG_LLVM_ROOT}" ]; then
898+
msg "git: submodule deinit src/llvm"
899+
"${CFG_GIT}" submodule deinit src/llvm
900+
fi
901+
if [ ! -z "${CFG_JEMALLOC_ROOT}" ]; then
902+
msg "git: submodule deinit src/jemalloc"
903+
"${CFG_GIT}" submodule deinit src/jemalloc
904+
fi
905+
if [ ! -z "${CFG_LIBUV_ROOT}" ]; then
906+
msg "git: submodule deinit src/libuv"
907+
"${CFG_GIT}" submodule deinit src/libuv
908+
fi
909+
945910
msg "git: submodule update"
946-
"${CFG_GIT}" submodule update --init
911+
"${CFG_GIT}" submodule update
947912
need_ok "git failed"
948913

949914
msg "git: submodule foreach sync"
950915
"${CFG_GIT}" submodule foreach --recursive 'if test -e .gitmodules; then git submodule sync; fi'
951916
need_ok "git failed"
952917

953918
msg "git: submodule foreach update"
954-
"${CFG_GIT}" submodule update --init --recursive
919+
"${CFG_GIT}" submodule update --recursive
955920
need_ok "git failed"
956921

957922
# NB: this is just for the sake of getting the submodule SHA1 values

mk/stage0.mk

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ ifdef CFG_ENABLE_LOCAL_RUST
1818
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
1919
else
2020
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
21-
ifdef CFG_ENABLE_PAX_FLAGS
22-
@$(call E, apply PaX flags: $@)
23-
@"$(CFG_PAXCTL)" -cm "$@"
24-
endif
2521
endif
2622
$(Q)touch $@
2723

src/libcollections/treemap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ pub struct IntersectionItems<'a, T> {
761761
b: Peekable<&'a T, SetItems<'a, T>>,
762762
}
763763

764-
/// Lazy iterator producing elements in the set intersection (in-order)
764+
/// Lazy iterator producing elements in the set union (in-order)
765765
pub struct UnionItems<'a, T> {
766766
a: Peekable<&'a T, SetItems<'a, T>>,
767767
b: Peekable<&'a T, SetItems<'a, T>>,

src/libcore/any.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Traits for dynamic typing of any type (through runtime reflection)
11+
//! Traits for dynamic typing of any `'static` type (through runtime reflection)
1212
//!
1313
//! This module implements the `Any` trait, which enables dynamic typing
14-
//! of any type, through runtime reflection.
14+
//! of any `'static` type through runtime reflection.
1515
//!
1616
//! `Any` itself can be used to get a `TypeId`, and has more features when used as a trait object.
1717
//! As `&Any` (a borrowed trait object), it has the `is` and `as_ref` methods, to test if the
@@ -32,8 +32,10 @@ pub enum Void { }
3232
// Any trait
3333
///////////////////////////////////////////////////////////////////////////////
3434

35-
/// The `Any` trait is implemented by all types, and can be used as a trait object
36-
/// for dynamic typing
35+
/// The `Any` trait is implemented by all `'static` types, and can be used for dynamic typing
36+
///
37+
/// Every type with no non-`'static` references implements `Any`, so `Any` can be used as a trait
38+
/// object to emulate the effects dynamic typing.
3739
pub trait Any {
3840
/// Get the `TypeId` of `self`
3941
fn get_type_id(&self) -> TypeId;
@@ -261,6 +263,14 @@ mod tests {
261263
let s = format!("{}", b);
262264
assert_eq!(s.as_slice(), "&Any");
263265
}
266+
267+
#[test]
268+
fn any_fixed_vec() {
269+
let test = [0u, ..8];
270+
let test = &test as &Any;
271+
assert!(test.is::<[uint, ..8]>());
272+
assert!(!test.is::<[uint, ..10]>());
273+
}
264274
}
265275

266276
#[cfg(test)]

src/libcore/intrinsics.rs

+14
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,20 @@ extern "rust-intrinsic" {
307307
/// `forget` is unsafe because the caller is responsible for
308308
/// ensuring the argument is deallocated already.
309309
pub fn forget<T>(_: T) -> ();
310+
311+
/// Unsafely transforms a value of one type into a value of another type.
312+
///
313+
/// Both types must have the same size and alignment, and this guarantee
314+
/// is enforced at compile-time.
315+
///
316+
/// # Example
317+
///
318+
/// ```rust
319+
/// use std::mem;
320+
///
321+
/// let v: &[u8] = unsafe { mem::transmute("L") };
322+
/// assert!(v == [76u8]);
323+
/// ```
310324
pub fn transmute<T,U>(e: T) -> U;
311325

312326
/// Returns `true` if a type requires drop glue.

src/libcore/mem.rs

+2-23
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ use ptr;
1717
use intrinsics;
1818
use intrinsics::{bswap16, bswap32, bswap64};
1919

20+
pub use intrinsics::transmute;
21+
2022
/// Returns the size of a type in bytes.
2123
#[inline]
2224
#[stable]
@@ -412,29 +414,6 @@ pub fn drop<T>(_x: T) { }
412414
#[stable]
413415
pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing) }
414416

415-
/// Unsafely transforms a value of one type into a value of another type.
416-
///
417-
/// Both types must have the same size and alignment, and this guarantee is
418-
/// enforced at compile-time.
419-
///
420-
/// # Example
421-
///
422-
/// ```rust
423-
/// use std::mem;
424-
///
425-
/// let v: &[u8] = unsafe { mem::transmute("L") };
426-
/// assert!(v == [76u8]);
427-
/// ```
428-
#[inline]
429-
#[unstable = "this function will be modified to reject invocations of it which \
430-
cannot statically prove that T and U are the same size. For \
431-
example, this function, as written today, will be rejected in \
432-
the future because the size of T and U cannot be statically \
433-
known to be the same"]
434-
pub unsafe fn transmute<T, U>(thing: T) -> U {
435-
intrinsics::transmute(thing)
436-
}
437-
438417
/// Interprets `src` as `&U`, and then reads `src` without moving the contained
439418
/// value.
440419
///

src/libnative/io/c_win32.rs

+15-10
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,20 @@ pub mod compat {
7777
fn GetProcAddress(hModule: HMODULE, lpProcName: LPCSTR) -> LPVOID;
7878
}
7979

80-
// store_func() is idempotent, so using relaxed ordering for the atomics should be enough.
81-
// This way, calling a function in this compatibility layer (after it's loaded) shouldn't
82-
// be any slower than a regular DLL call.
83-
unsafe fn store_func<T: Copy>(ptr: *mut T, module: &str, symbol: &str, fallback: T) {
80+
// store_func() is idempotent, so using relaxed ordering for the atomics
81+
// should be enough. This way, calling a function in this compatibility
82+
// layer (after it's loaded) shouldn't be any slower than a regular DLL
83+
// call.
84+
unsafe fn store_func(ptr: *mut uint, module: &str, symbol: &str, fallback: uint) {
8485
let module = module.to_utf16().append_one(0);
8586
symbol.with_c_str(|symbol| {
8687
let handle = GetModuleHandleW(module.as_ptr());
87-
let func: Option<T> = transmute(GetProcAddress(handle, symbol));
88-
atomic_store_relaxed(ptr, func.unwrap_or(fallback))
88+
let func: uint = transmute(GetProcAddress(handle, symbol));
89+
atomic_store_relaxed(ptr, if func == 0 {
90+
fallback
91+
} else {
92+
func
93+
})
8994
})
9095
}
9196

@@ -109,10 +114,10 @@ pub mod compat {
109114

110115
extern "system" fn thunk($($argname: $argtype),*) -> $rettype {
111116
unsafe {
112-
::io::c::compat::store_func(&mut ptr,
113-
stringify!($module),
114-
stringify!($symbol),
115-
fallback);
117+
::io::c::compat::store_func(&mut ptr as *mut _ as *mut uint,
118+
stringify!($module),
119+
stringify!($symbol),
120+
fallback as uint);
116121
::std::intrinsics::atomic_load_relaxed(&ptr)($($argname),*)
117122
}
118123
}

src/librustc/driver/driver.rs

+3
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
333333
time(time_passes, "privacy checking", maps, |(a, b)|
334334
middle::privacy::check_crate(&ty_cx, &exp_map2, a, b, krate));
335335

336+
time(time_passes, "intrinsic checking", (), |_|
337+
middle::intrinsicck::check_crate(&ty_cx, krate));
338+
336339
time(time_passes, "effect checking", (), |_|
337340
middle::effect::check_crate(&ty_cx, krate));
338341

src/librustc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub mod middle {
8585
pub mod dependency_format;
8686
pub mod weak_lang_items;
8787
pub mod save;
88+
pub mod intrinsicck;
8889
}
8990

9091
pub mod front {

0 commit comments

Comments
 (0)