Skip to content

Commit 5c71e4e

Browse files
committed
Auto merge of #43551 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 8 pull requests - Successful merges: #43409, #43501, #43509, #43512, #43513, #43536, #43544, #43549 - Failed merges:
2 parents 53bf790 + 16c3fd9 commit 5c71e4e

File tree

22 files changed

+160
-58
lines changed

22 files changed

+160
-58
lines changed

src/bootstrap/builder.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use check;
2828
use flags::Subcommand;
2929
use doc;
3030
use tool;
31+
use native;
3132

3233
pub use Compiler;
3334

@@ -256,7 +257,8 @@ impl<'a> Builder<'a> {
256257
compile::StartupObjects, tool::BuildManifest, tool::Rustbook, tool::ErrorIndex,
257258
tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
258259
tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
259-
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc),
260+
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc,
261+
native::Llvm),
260262
Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
261263
check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Linkcheck,
262264
check::Cargotest, check::Cargo, check::Rls, check::Docs, check::ErrorIndex,

src/bootstrap/native.rs

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ impl Step for Llvm {
4848
run.path("src/llvm")
4949
}
5050

51+
fn make_run(run: RunConfig) {
52+
run.builder.ensure(Llvm { target: run.target })
53+
}
54+
5155
/// Compile LLVM for `target`.
5256
fn run(self, builder: &Builder) {
5357
let build = builder.build;

src/ci/docker/run.sh

+7
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ else
6767
args="$args --env SCCACHE_DIR=/sccache --volume $HOME/.cache/sccache:/sccache"
6868
fi
6969

70+
# Run containers as privileged as it should give them access to some more
71+
# syscalls such as ptrace and whatnot. In the upgrade to LLVM 5.0 it was
72+
# discovered that the leak sanitizer apparently needs these syscalls nowadays so
73+
# we'll need `--privileged` for at least the `x86_64-gnu` builder, so this just
74+
# goes ahead and sets it for all builders.
75+
args="$args --privileged"
76+
7077
exec docker \
7178
run \
7279
--volume "$root_dir:/checkout:ro" \

src/liballoc/allocator.rs

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ impl Layout {
215215
/// of each element in the array.
216216
///
217217
/// On arithmetic overflow, returns `None`.
218+
#[inline]
218219
pub fn repeat(&self, n: usize) -> Option<(Self, usize)> {
219220
let padded_size = match self.size.checked_add(self.padding_needed_for(self.align)) {
220221
None => return None,

src/libcore/iter/traits.rs

+8-25
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,13 @@ pub trait FromIterator<A>: Sized {
147147
///
148148
/// ```
149149
/// let v = vec![1, 2, 3];
150-
///
151150
/// let mut iter = v.into_iter();
152151
///
153-
/// let n = iter.next();
154-
/// assert_eq!(Some(1), n);
155-
///
156-
/// let n = iter.next();
157-
/// assert_eq!(Some(2), n);
158-
///
159-
/// let n = iter.next();
160-
/// assert_eq!(Some(3), n);
161-
///
162-
/// let n = iter.next();
163-
/// assert_eq!(None, n);
152+
/// assert_eq!(Some(1), iter.next());
153+
/// assert_eq!(Some(2), iter.next());
154+
/// assert_eq!(Some(3), iter.next());
155+
/// assert_eq!(None, iter.next());
164156
/// ```
165-
///
166157
/// Implementing `IntoIterator` for your type:
167158
///
168159
/// ```
@@ -227,20 +218,12 @@ pub trait IntoIterator {
227218
///
228219
/// ```
229220
/// let v = vec![1, 2, 3];
230-
///
231221
/// let mut iter = v.into_iter();
232222
///
233-
/// let n = iter.next();
234-
/// assert_eq!(Some(1), n);
235-
///
236-
/// let n = iter.next();
237-
/// assert_eq!(Some(2), n);
238-
///
239-
/// let n = iter.next();
240-
/// assert_eq!(Some(3), n);
241-
///
242-
/// let n = iter.next();
243-
/// assert_eq!(None, n);
223+
/// assert_eq!(Some(1), iter.next());
224+
/// assert_eq!(Some(2), iter.next());
225+
/// assert_eq!(Some(3), iter.next());
226+
/// assert_eq!(None, iter.next());
244227
/// ```
245228
#[stable(feature = "rust1", since = "1.0.0")]
246229
fn into_iter(self) -> Self::IntoIter;

src/librustc/ich/impls_mir.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,11 @@ impl<'a, 'gcx, 'tcx> HashStable<StableHashingContext<'a, 'gcx, 'tcx>> for mir::L
258258
}
259259
}
260260

261-
impl<'a, 'gcx, 'tcx, B, V> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
262-
for mir::Projection<'tcx, B, V>
261+
impl<'a, 'gcx, 'tcx, B, V, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
262+
for mir::Projection<'tcx, B, V, T>
263263
where B: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>,
264-
V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
264+
V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>,
265+
T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
265266
{
266267
fn hash_stable<W: StableHasherResult>(&self,
267268
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
@@ -276,17 +277,18 @@ for mir::Projection<'tcx, B, V>
276277
}
277278
}
278279

279-
impl<'a, 'gcx, 'tcx, V> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
280-
for mir::ProjectionElem<'tcx, V>
281-
where V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
280+
impl<'a, 'gcx, 'tcx, V, T> HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
281+
for mir::ProjectionElem<'tcx, V, T>
282+
where V: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>,
283+
T: HashStable<StableHashingContext<'a, 'gcx, 'tcx>>
282284
{
283285
fn hash_stable<W: StableHasherResult>(&self,
284286
hcx: &mut StableHashingContext<'a, 'gcx, 'tcx>,
285287
hasher: &mut StableHasher<W>) {
286288
mem::discriminant(self).hash_stable(hcx, hasher);
287289
match *self {
288290
mir::ProjectionElem::Deref => {}
289-
mir::ProjectionElem::Field(field, ty) => {
291+
mir::ProjectionElem::Field(field, ref ty) => {
290292
field.hash_stable(hcx, hasher);
291293
ty.hash_stable(hcx, hasher);
292294
}

src/librustc/mir/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -887,15 +887,15 @@ impl_stable_hash_for!(struct Static<'tcx> {
887887
/// shared between `Constant` and `Lvalue`. See the aliases
888888
/// `LvalueProjection` etc below.
889889
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
890-
pub struct Projection<'tcx, B, V> {
890+
pub struct Projection<'tcx, B, V, T> {
891891
pub base: B,
892-
pub elem: ProjectionElem<'tcx, V>,
892+
pub elem: ProjectionElem<'tcx, V, T>,
893893
}
894894

895895
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
896-
pub enum ProjectionElem<'tcx, V> {
896+
pub enum ProjectionElem<'tcx, V, T> {
897897
Deref,
898-
Field(Field, Ty<'tcx>),
898+
Field(Field, T),
899899
Index(V),
900900

901901
/// These indices are generated by slice patterns. Easiest to explain
@@ -932,11 +932,11 @@ pub enum ProjectionElem<'tcx, V> {
932932

933933
/// Alias for projections as they appear in lvalues, where the base is an lvalue
934934
/// and the index is an operand.
935-
pub type LvalueProjection<'tcx> = Projection<'tcx, Lvalue<'tcx>, Operand<'tcx>>;
935+
pub type LvalueProjection<'tcx> = Projection<'tcx, Lvalue<'tcx>, Operand<'tcx>, Ty<'tcx>>;
936936

937937
/// Alias for projections as they appear in lvalues, where the base is an lvalue
938938
/// and the index is an operand.
939-
pub type LvalueElem<'tcx> = ProjectionElem<'tcx, Operand<'tcx>>;
939+
pub type LvalueElem<'tcx> = ProjectionElem<'tcx, Operand<'tcx>, Ty<'tcx>>;
940940

941941
newtype_index!(Field, "field");
942942

@@ -1720,16 +1720,16 @@ impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx> {
17201720
}
17211721
}
17221722

1723-
impl<'tcx, B, V> TypeFoldable<'tcx> for Projection<'tcx, B, V>
1724-
where B: TypeFoldable<'tcx>, V: TypeFoldable<'tcx>
1723+
impl<'tcx, B, V, T> TypeFoldable<'tcx> for Projection<'tcx, B, V, T>
1724+
where B: TypeFoldable<'tcx>, V: TypeFoldable<'tcx>, T: TypeFoldable<'tcx>
17251725
{
17261726
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
17271727
use mir::ProjectionElem::*;
17281728

17291729
let base = self.base.fold_with(folder);
17301730
let elem = match self.elem {
17311731
Deref => Deref,
1732-
Field(f, ty) => Field(f, ty.fold_with(folder)),
1732+
Field(f, ref ty) => Field(f, ty.fold_with(folder)),
17331733
Index(ref v) => Index(v.fold_with(folder)),
17341734
ref elem => elem.clone()
17351735
};
@@ -1745,7 +1745,7 @@ impl<'tcx, B, V> TypeFoldable<'tcx> for Projection<'tcx, B, V>
17451745

17461746
self.base.visit_with(visitor) ||
17471747
match self.elem {
1748-
Field(_, ty) => ty.visit_with(visitor),
1748+
Field(_, ref ty) => ty.visit_with(visitor),
17491749
Index(ref v) => v.visit_with(visitor),
17501750
_ => false
17511751
}

src/librustc_mir/dataflow/move_paths/abs_domain.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
2424
use rustc::mir::LvalueElem;
2525
use rustc::mir::{Operand, ProjectionElem};
26+
use rustc::ty::Ty;
2627

2728
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
2829
pub struct AbstractOperand;
30+
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
31+
pub struct AbstractType;
2932
pub type AbstractElem<'tcx> =
30-
ProjectionElem<'tcx, AbstractOperand>;
33+
ProjectionElem<'tcx, AbstractOperand, AbstractType>;
3134

3235
pub trait Lift {
3336
type Abstract;
@@ -37,14 +40,18 @@ impl<'tcx> Lift for Operand<'tcx> {
3740
type Abstract = AbstractOperand;
3841
fn lift(&self) -> Self::Abstract { AbstractOperand }
3942
}
43+
impl<'tcx> Lift for Ty<'tcx> {
44+
type Abstract = AbstractType;
45+
fn lift(&self) -> Self::Abstract { AbstractType }
46+
}
4047
impl<'tcx> Lift for LvalueElem<'tcx> {
4148
type Abstract = AbstractElem<'tcx>;
4249
fn lift(&self) -> Self::Abstract {
4350
match *self {
4451
ProjectionElem::Deref =>
4552
ProjectionElem::Deref,
4653
ProjectionElem::Field(ref f, ty) =>
47-
ProjectionElem::Field(f.clone(), ty.clone()),
54+
ProjectionElem::Field(f.clone(), ty.lift()),
4855
ProjectionElem::Index(ref i) =>
4956
ProjectionElem::Index(i.lift()),
5057
ProjectionElem::Subslice {from, to} =>

src/librustdoc/html/render.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -2962,7 +2962,15 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
29622962
write!(w, "<code>")?;
29632963
render_assoc_item(w, item, link.anchor(&id), ItemType::Impl)?;
29642964
write!(w, "</code>")?;
2965-
render_stability_since_raw(w, item.stable_since(), outer_version)?;
2965+
if let Some(l) = (Item { cx, item }).src_href() {
2966+
write!(w, "</span><span class='out-of-band'>")?;
2967+
write!(w, "<div class='ghost'></div>")?;
2968+
render_stability_since_raw(w, item.stable_since(), outer_version)?;
2969+
write!(w, "<a class='srclink' href='{}' title='{}'>[src]</a>",
2970+
l, "goto source code")?;
2971+
} else {
2972+
render_stability_since_raw(w, item.stable_since(), outer_version)?;
2973+
}
29662974
write!(w, "</span></h4>\n")?;
29672975
}
29682976
}

src/librustdoc/html/static/rustdoc.css

+4
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ h3.impl > .out-of-band {
297297
font-size: 21px;
298298
}
299299

300+
h4.method > .out-of-band {
301+
font-size: 19px;
302+
}
303+
300304
h4 > code, h3 > code, .invisible > code {
301305
position: inherit;
302306
}

src/libstd/sys/redox/ext/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub mod ffi;
3333
pub mod fs;
3434
pub mod io;
3535
pub mod process;
36+
pub mod thread;
3637

3738
/// A prelude for conveniently writing platform-specific code.
3839
///
@@ -46,5 +47,7 @@ pub mod prelude {
4647
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
4748
pub use super::fs::{FileTypeExt, PermissionsExt, OpenOptionsExt, MetadataExt};
4849
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
50+
pub use super::thread::JoinHandleExt;
51+
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
4952
pub use super::process::{CommandExt, ExitStatusExt};
5053
}

src/libstd/sys/redox/ext/thread.rs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Unix-specific extensions to primitives in the `std::thread` module.
12+
13+
#![stable(feature = "thread_extensions", since = "1.9.0")]
14+
15+
use sys_common::{AsInner, IntoInner};
16+
use thread::JoinHandle;
17+
18+
#[stable(feature = "thread_extensions", since = "1.9.0")]
19+
#[allow(deprecated)]
20+
pub type RawPthread = usize;
21+
22+
/// Unix-specific extensions to `std::thread::JoinHandle`
23+
#[stable(feature = "thread_extensions", since = "1.9.0")]
24+
pub trait JoinHandleExt {
25+
/// Extracts the raw pthread_t without taking ownership
26+
#[stable(feature = "thread_extensions", since = "1.9.0")]
27+
fn as_pthread_t(&self) -> RawPthread;
28+
29+
/// Consumes the thread, returning the raw pthread_t
30+
///
31+
/// This function **transfers ownership** of the underlying pthread_t to
32+
/// the caller. Callers are then the unique owners of the pthread_t and
33+
/// must either detach or join the pthread_t once it's no longer needed.
34+
#[stable(feature = "thread_extensions", since = "1.9.0")]
35+
fn into_pthread_t(self) -> RawPthread;
36+
}
37+
38+
#[stable(feature = "thread_extensions", since = "1.9.0")]
39+
impl<T> JoinHandleExt for JoinHandle<T> {
40+
fn as_pthread_t(&self) -> RawPthread {
41+
self.as_inner().id() as RawPthread
42+
}
43+
44+
fn into_pthread_t(self) -> RawPthread {
45+
self.into_inner().into_id() as RawPthread
46+
}
47+
}

src/libstd/sys/redox/fd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ impl FileDesc {
5757
}
5858

5959
pub fn set_cloexec(&self) -> io::Result<()> {
60-
let mut flags = cvt(syscall::fcntl(self.fd, syscall::F_GETFL, 0))?;
60+
let mut flags = cvt(syscall::fcntl(self.fd, syscall::F_GETFD, 0))?;
6161
flags |= syscall::O_CLOEXEC;
62-
cvt(syscall::fcntl(self.fd, syscall::F_SETFL, flags)).and(Ok(()))
62+
cvt(syscall::fcntl(self.fd, syscall::F_SETFD, flags)).and(Ok(()))
6363
}
6464

6565
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {

src/libstd/sys/redox/process.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -272,21 +272,21 @@ impl Command {
272272

273273
if let Some(fd) = stdio.stderr.fd() {
274274
t!(cvt(syscall::dup2(fd, 2, &[])));
275-
let mut flags = t!(cvt(syscall::fcntl(2, syscall::F_GETFL, 0)));
275+
let mut flags = t!(cvt(syscall::fcntl(2, syscall::F_GETFD, 0)));
276276
flags &= ! syscall::O_CLOEXEC;
277-
t!(cvt(syscall::fcntl(2, syscall::F_SETFL, flags)));
277+
t!(cvt(syscall::fcntl(2, syscall::F_SETFD, flags)));
278278
}
279279
if let Some(fd) = stdio.stdout.fd() {
280280
t!(cvt(syscall::dup2(fd, 1, &[])));
281-
let mut flags = t!(cvt(syscall::fcntl(1, syscall::F_GETFL, 0)));
281+
let mut flags = t!(cvt(syscall::fcntl(1, syscall::F_GETFD, 0)));
282282
flags &= ! syscall::O_CLOEXEC;
283-
t!(cvt(syscall::fcntl(1, syscall::F_SETFL, flags)));
283+
t!(cvt(syscall::fcntl(1, syscall::F_SETFD, flags)));
284284
}
285285
if let Some(fd) = stdio.stdin.fd() {
286286
t!(cvt(syscall::dup2(fd, 0, &[])));
287-
let mut flags = t!(cvt(syscall::fcntl(0, syscall::F_GETFL, 0)));
287+
let mut flags = t!(cvt(syscall::fcntl(0, syscall::F_GETFD, 0)));
288288
flags &= ! syscall::O_CLOEXEC;
289-
t!(cvt(syscall::fcntl(0, syscall::F_SETFL, flags)));
289+
t!(cvt(syscall::fcntl(0, syscall::F_SETFD, flags)));
290290
}
291291

292292
if let Some(g) = self.gid {

src/libstd/sys/redox/syscall/flag.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ pub const EVENT_NONE: usize = 0;
2020
pub const EVENT_READ: usize = 1;
2121
pub const EVENT_WRITE: usize = 2;
2222

23-
pub const F_GETFL: usize = 1;
24-
pub const F_SETFL: usize = 2;
23+
pub const F_GETFD: usize = 1;
24+
pub const F_SETFD: usize = 2;
25+
pub const F_GETFL: usize = 3;
26+
pub const F_SETFL: usize = 4;
2527

2628
pub const FUTEX_WAIT: usize = 0;
2729
pub const FUTEX_WAKE: usize = 1;

0 commit comments

Comments
 (0)