Skip to content

Commit 88fc543

Browse files
committed
Auto merge of #24232 - Manishearth:rollup, r=Manishearth
None
2 parents e326aa1 + ea73179 commit 88fc543

File tree

838 files changed

+461
-947
lines changed

Some content is hidden

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

838 files changed

+461
-947
lines changed

configure

+37-16
Original file line numberDiff line numberDiff line change
@@ -523,30 +523,35 @@ fi
523523
BOOL_OPTIONS=""
524524
VAL_OPTIONS=""
525525

526+
opt debug 0 "debug mode"
526527
opt valgrind 0 "run tests with valgrind (memcheck by default)"
527528
opt helgrind 0 "run tests with helgrind instead of memcheck"
528529
opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind"
529530
opt docs 1 "build standard library documentation"
530531
opt compiler-docs 0 "build compiler documentation"
531-
opt optimize 1 "build optimized rust code"
532-
opt optimize-cxx 1 "build optimized C++ code"
533-
opt optimize-llvm 1 "build optimized LLVM"
534532
opt optimize-tests 1 "build tests with optimizations"
535533
opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang"
536-
opt llvm-assertions 1 "build LLVM with assertions"
537-
opt debug 1 "build with extra debug fun"
534+
opt llvm-assertions 0 "build LLVM with assertions"
535+
opt debug-assertions 0 "build with debugging assertions"
538536
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
539537
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
540538
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
541539
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
542540
opt rpath 0 "build rpaths into rustc itself"
543-
opt nightly 0 "build nightly packages"
544-
opt verify-install 1 "verify installed binaries work"
545541
# This is used by the automation to produce single-target nightlies
546542
opt dist-host-only 0 "only install bins for the host architecture"
547543
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
548544
opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway"
549545

546+
# Optimization and debugging options. These may be overridden by the release channel, etc.
547+
opt_nosave optimize 1 "build optimized rust code"
548+
opt_nosave optimize-cxx 1 "build optimized C++ code"
549+
opt_nosave optimize-llvm 1 "build optimized LLVM"
550+
opt_nosave llvm-assertions 0 "build LLVM with assertions"
551+
opt_nosave debug-assertions 0 "build with debugging assertions"
552+
opt_nosave debuginfo 0 "build with debugger metadata"
553+
opt_nosave debug-jemalloc 0 "build jemalloc with --enable-debug --enable-fill"
554+
550555
valopt localstatedir "/var/lib" "local state directory"
551556
valopt sysconfdir "/etc" "install system configuration files"
552557

@@ -556,6 +561,7 @@ valopt llvm-root "" "set LLVM root"
556561
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
557562
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
558563
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
564+
valopt release-channel "dev" "the name of the release channel to build"
559565

560566
# Many of these are saved below during the "writing configuration" step
561567
# (others are conditionally saved).
@@ -568,7 +574,6 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
568574
valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
569575
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
570576
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
571-
valopt_nosave release-channel "dev" "the name of the release channel to build"
572577

573578
# Temporarily support old triples until buildbots get updated
574579
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
@@ -621,13 +626,24 @@ case "$CFG_RELEASE_CHANNEL" in
621626
;;
622627
esac
623628

624-
# Continue supporting the old --enable-nightly flag to transition the bots
625-
# XXX Remove me
626-
if [ ! -z "$CFG_ENABLE_NIGHTLY" ]
627-
then
628-
CFG_RELEASE_CHANNEL=nightly
629+
# Adjust perf and debug options for debug mode
630+
if [ -n "$CFG_ENABLE_DEBUG" ]; then
631+
msg "debug mode enabled, setting performance options"
632+
CFG_DISABLE_OPTIMIZE=1
633+
CFG_DISABLE_OPTIMIZE_CXX=1
634+
CFG_ENABLE_LLVM_ASSERTIONS=1
635+
CFG_ENABLE_DEBUG_ASSERTIONS=1
636+
CFG_ENABLE_DEBUG_JEMALLOC=1
629637
fi
630-
putvar CFG_RELEASE_CHANNEL
638+
639+
# OK, now write the debugging options
640+
if [ -n "$CFG_DISABLE_OPTIMIZE" ]; then putvar CFG_DISABLE_OPTIMIZE; fi
641+
if [ -n "$CFG_DISABLE_OPTIMIZE_CXX" ]; then putvar CFG_DISABLE_OPTIMIZE_CXX; fi
642+
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then putvar CFG_DISABLE_OPTIMIZE_LLVM; fi
643+
if [ -n "$CFG_ENABLE_LLVM_ASSERTIONS" ]; then putvar CFG_ENABLE_LLVM_ASSERTIONS; fi
644+
if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTIONS; fi
645+
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
646+
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi
631647

632648
# A magic value that allows the compiler to use unstable features
633649
# during the bootstrap even when doing so would normally be an error
@@ -1180,7 +1196,7 @@ do
11801196
LLVM_DBG_OPTS="--enable-optimized"
11811197
LLVM_INST_DIR=$LLVM_BUILD_DIR/Release
11821198
fi
1183-
if [ ! -z "$CFG_DISABLE_LLVM_ASSERTIONS" ]
1199+
if [ -z "$CFG_ENABLE_LLVM_ASSERTIONS" ]
11841200
then
11851201
LLVM_ASSERTION_OPTS="--disable-assertions"
11861202
else
@@ -1434,6 +1450,11 @@ move_if_changed config.tmp config.mk
14341450
rm -f config.tmp
14351451
touch config.stamp
14361452

1437-
step_msg "complete"
1453+
if [ -z "$CFG_ENABLE_DEBUG" ]; then
1454+
step_msg "configured in release mode. for development consider --enable-debug"
1455+
else
1456+
step_msg "complete"
1457+
fi
1458+
14381459
msg "run \`make help\`"
14391460
msg

mk/install.mk

+2-8
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
ifdef CFG_DISABLE_VERIFY_INSTALL
12-
MAYBE_DISABLE_VERIFY=--disable-verify
13-
else
14-
MAYBE_DISABLE_VERIFY=
15-
endif
16-
1711
install:
1812
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
1913
# Build the dist as the original user
@@ -22,9 +16,9 @@ else
2216
$(Q)$(MAKE) prepare_install
2317
endif
2418
ifeq ($(CFG_DISABLE_DOCS),)
25-
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
19+
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2620
endif
27-
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
21+
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2822
# Remove tmp files because it's a decent amount of disk space
2923
$(Q)rm -R tmp/dist
3024

mk/main.mk

+9-4
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,16 @@ endif
126126

127127
CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
128128

129-
ifdef CFG_DISABLE_DEBUG
130-
CFG_RUSTC_FLAGS += --cfg ndebug
131-
else
132-
$(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
129+
ifdef CFG_ENABLE_DEBUG_ASSERTIONS
130+
$(info cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS))
133131
CFG_RUSTC_FLAGS += --cfg debug -C debug-assertions=on
132+
else
133+
CFG_RUSTC_FLAGS += --cfg ndebug
134+
endif
135+
136+
ifdef CFG_ENABLE_DEBUGINFO
137+
$(info cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO))
138+
CFG_RUSTC_FLAGS += -g
134139
endif
135140

136141
ifdef SAVE_TEMPS

mk/rt.mk

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
143143
JEMALLOC_ARGS_$(1) := --disable-tls
144144
endif
145145

146+
ifdef CFG_ENABLE_DEBUG_JEMALLOC
147+
JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill
148+
endif
149+
146150
################################################################################
147151
# jemalloc
148152
################################################################################

src/doc/trpl/associated-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,5 @@ let obj = Box::new(graph) as Box<Graph<N=Node, E=Edge>>;
198198
```
199199

200200
The `N=Node` syntax allows us to provide a concrete type, `Node`, for the `N`
201-
type parameter. Same with `E=Edge`. If we didn’t proide this constraint, we
201+
type parameter. Same with `E=Edge`. If we didn’t provide this constraint, we
202202
couldn’t be sure which `impl` to match this trait object to.

src/libcore/clone.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ pub trait Clone : Sized {
4444
/// but can be overridden to reuse the resources of `a` to avoid unnecessary
4545
/// allocations.
4646
#[inline(always)]
47-
#[unstable(feature = "core",
48-
reason = "this function is rarely used")]
47+
#[stable(feature = "rust1", since = "1.0.0")]
4948
fn clone_from(&mut self, source: &Self) {
5049
*self = source.clone()
5150
}

src/libcore/iter.rs

+22-20
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ pub trait Iterator {
171171
/// ```
172172
#[inline]
173173
#[stable(feature = "rust1", since = "1.0.0")]
174-
fn chain<U>(self, other: U) -> Chain<Self, U> where
175-
Self: Sized, U: Iterator<Item=Self::Item>,
174+
fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where
175+
Self: Sized, U: IntoIterator<Item=Self::Item>,
176176
{
177-
Chain{a: self, b: other, flag: false}
177+
Chain{a: self, b: other.into_iter(), flag: false}
178178
}
179179

180180
/// Creates an iterator that iterates over both this and the specified
@@ -207,8 +207,10 @@ pub trait Iterator {
207207
/// both produce the same output.
208208
#[inline]
209209
#[stable(feature = "rust1", since = "1.0.0")]
210-
fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> where Self: Sized {
211-
Zip{a: self, b: other}
210+
fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where
211+
Self: Sized, U: IntoIterator
212+
{
213+
Zip{a: self, b: other.into_iter()}
212214
}
213215

214216
/// Creates a new iterator that will apply the specified function to each
@@ -443,7 +445,7 @@ pub trait Iterator {
443445
#[inline]
444446
#[stable(feature = "rust1", since = "1.0.0")]
445447
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
446-
where Self: Sized, U: Iterator, F: FnMut(Self::Item) -> U,
448+
where Self: Sized, U: IntoIterator, F: FnMut(Self::Item) -> U,
447449
{
448450
FlatMap{iter: self, f: f, frontiter: None, backiter: None }
449451
}
@@ -933,7 +935,7 @@ pub trait Iterator {
933935
/// `std::usize::MAX` elements of the original iterator.
934936
#[inline]
935937
#[stable(feature = "rust1", since = "1.0.0")]
936-
fn rev(self) -> Rev<Self> where Self: Sized {
938+
fn rev(self) -> Rev<Self> where Self: Sized + DoubleEndedIterator {
937939
Rev{iter: self}
938940
}
939941

@@ -2093,15 +2095,15 @@ impl<B, I, St, F> Iterator for Scan<I, St, F> where
20932095
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
20942096
#[stable(feature = "rust1", since = "1.0.0")]
20952097
#[derive(Clone)]
2096-
pub struct FlatMap<I, U, F> {
2098+
pub struct FlatMap<I, U: IntoIterator, F> {
20972099
iter: I,
20982100
f: F,
2099-
frontiter: Option<U>,
2100-
backiter: Option<U>,
2101+
frontiter: Option<U::IntoIter>,
2102+
backiter: Option<U::IntoIter>,
21012103
}
21022104

21032105
#[stable(feature = "rust1", since = "1.0.0")]
2104-
impl<I: Iterator, U: Iterator, F> Iterator for FlatMap<I, U, F>
2106+
impl<I: Iterator, U: IntoIterator, F> Iterator for FlatMap<I, U, F>
21052107
where F: FnMut(I::Item) -> U,
21062108
{
21072109
type Item = U::Item;
@@ -2110,13 +2112,13 @@ impl<I: Iterator, U: Iterator, F> Iterator for FlatMap<I, U, F>
21102112
fn next(&mut self) -> Option<U::Item> {
21112113
loop {
21122114
if let Some(ref mut inner) = self.frontiter {
2113-
for x in inner.by_ref() {
2115+
if let Some(x) = inner.by_ref().next() {
21142116
return Some(x)
21152117
}
21162118
}
21172119
match self.iter.next().map(|x| (self.f)(x)) {
21182120
None => return self.backiter.as_mut().and_then(|it| it.next()),
2119-
next => self.frontiter = next,
2121+
next => self.frontiter = next.map(IntoIterator::into_iter),
21202122
}
21212123
}
21222124
}
@@ -2134,22 +2136,22 @@ impl<I: Iterator, U: Iterator, F> Iterator for FlatMap<I, U, F>
21342136
}
21352137

21362138
#[stable(feature = "rust1", since = "1.0.0")]
2137-
impl<I: DoubleEndedIterator, U: DoubleEndedIterator, F> DoubleEndedIterator
2138-
for FlatMap<I, U, F>
2139-
where F: FnMut(I::Item) -> U
2139+
impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F> where
2140+
F: FnMut(I::Item) -> U,
2141+
U: IntoIterator,
2142+
U::IntoIter: DoubleEndedIterator
21402143
{
21412144
#[inline]
21422145
fn next_back(&mut self) -> Option<U::Item> {
21432146
loop {
21442147
if let Some(ref mut inner) = self.backiter {
2145-
match inner.next_back() {
2146-
None => (),
2147-
y => return y
2148+
if let Some(y) = inner.next_back() {
2149+
return Some(y)
21482150
}
21492151
}
21502152
match self.iter.next_back().map(|x| (self.f)(x)) {
21512153
None => return self.frontiter.as_mut().and_then(|it| it.next_back()),
2152-
next => self.backiter = next,
2154+
next => self.backiter = next.map(IntoIterator::into_iter),
21532155
}
21542156
}
21552157
}

src/librustc/middle/check_const.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,19 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'tcx> {
662662
cmt: mc::cmt<'tcx>,
663663
_loan_region: ty::Region,
664664
bk: ty::BorrowKind,
665-
loan_cause: euv::LoanCause) {
665+
loan_cause: euv::LoanCause)
666+
{
667+
// Kind of hacky, but we allow Unsafe coercions in constants.
668+
// These occur when we convert a &T or *T to a *U, as well as
669+
// when making a thin pointer (e.g., `*T`) into a fat pointer
670+
// (e.g., `*Trait`).
671+
match loan_cause {
672+
euv::LoanCause::AutoUnsafe => {
673+
return;
674+
}
675+
_ => { }
676+
}
677+
666678
let mut cur = &cmt;
667679
let mut is_interior = false;
668680
loop {

0 commit comments

Comments
 (0)