Skip to content

Commit e847f30

Browse files
committed
Auto merge of #45532 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests - Successful merges: #45059, #45212, #45398, #45483, #45496, #45508, #45526 - Failed merges:
2 parents f9d2416 + 851d1c7 commit e847f30

File tree

20 files changed

+101
-32
lines changed

20 files changed

+101
-32
lines changed

src/bootstrap/compile.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,18 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
860860
// have a hash in the name, but there's a version of this file in
861861
// the `deps` folder which *does* have a hash in the name. That's
862862
// the one we'll want to we'll probe for it later.
863-
toplevel.push((filename.file_stem().unwrap()
864-
.to_str().unwrap().to_string(),
865-
filename.extension().unwrap().to_owned()
866-
.to_str().unwrap().to_string()));
863+
//
864+
// We do not use `Path::file_stem` or `Path::extension` here,
865+
// because some generated files may have multiple extensions e.g.
866+
// `std-<hash>.dll.lib` on Windows. The aforementioned methods only
867+
// split the file name by the last extension (`.lib`) while we need
868+
// to split by all extensions (`.dll.lib`).
869+
let filename = filename.file_name().unwrap().to_str().unwrap();
870+
let mut parts = filename.splitn(2, '.');
871+
let file_stem = parts.next().unwrap().to_owned();
872+
let extension = parts.next().unwrap().to_owned();
873+
874+
toplevel.push((file_stem, extension));
867875
}
868876
}
869877

src/ci/docker/asmjs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ ENV TARGETS=asmjs-unknown-emscripten
3131

3232
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
3333

34-
ENV SCRIPT python2.7 ../x.py test --target $TARGETS src/test/run-pass
34+
ENV SCRIPT python2.7 ../x.py test --target $TARGETS

src/libcore/hash/mod.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,16 +665,36 @@ mod impls {
665665
}
666666

667667
#[stable(feature = "rust1", since = "1.0.0")]
668-
impl<T> Hash for *const T {
668+
impl<T: ?Sized> Hash for *const T {
669669
fn hash<H: Hasher>(&self, state: &mut H) {
670-
state.write_usize(*self as usize)
670+
if mem::size_of::<Self>() == mem::size_of::<usize>() {
671+
// Thin pointer
672+
state.write_usize(*self as *const () as usize);
673+
} else {
674+
// Fat pointer
675+
let (a, b) = unsafe {
676+
*(self as *const Self as *const (usize, usize))
677+
};
678+
state.write_usize(a);
679+
state.write_usize(b);
680+
}
671681
}
672682
}
673683

674684
#[stable(feature = "rust1", since = "1.0.0")]
675-
impl<T> Hash for *mut T {
685+
impl<T: ?Sized> Hash for *mut T {
676686
fn hash<H: Hasher>(&self, state: &mut H) {
677-
state.write_usize(*self as usize)
687+
if mem::size_of::<Self>() == mem::size_of::<usize>() {
688+
// Thin pointer
689+
state.write_usize(*self as *const () as usize);
690+
} else {
691+
// Fat pointer
692+
let (a, b) = unsafe {
693+
*(self as *const Self as *const (usize, usize))
694+
};
695+
state.write_usize(a);
696+
state.write_usize(b);
697+
}
678698
}
679699
}
680700
}

src/libcore/tests/hash/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ fn test_writer_hasher() {
7979

8080
let ptr = 5_usize as *mut i32;
8181
assert_eq!(hash(&ptr), 5);
82+
83+
let cs: &mut [u8] = &mut [1, 2, 3];
84+
let ptr = cs.as_ptr();
85+
let slice_ptr = cs as *const [u8];
86+
assert_eq!(hash(&slice_ptr), hash(&ptr) + cs.len() as u64);
87+
88+
let slice_ptr = cs as *mut [u8];
89+
assert_eq!(hash(&slice_ptr), hash(&ptr) + cs.len() as u64);
8290
}
8391

8492
struct Custom { hash: u64 }

src/librustc_back/target/sparcv9_sun_solaris.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
// llvm calls this "v9"
1818
base.cpu = "v9".to_string();
1919
base.max_atomic_width = Some(64);
20+
base.exe_allocation_crate = None;
2021

2122
Ok(Target {
2223
llvm_target: "sparcv9-sun-solaris".to_string(),

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
744744
let mut err = self.cannot_reassign_immutable(span,
745745
&self.loan_path_to_string(lp),
746746
Origin::Ast);
747-
err.span_label(span, "re-assignment of immutable variable");
747+
err.span_label(span, "cannot assign twice to immutable variable");
748748
if span != assign.span {
749749
err.span_label(assign.span, format!("first assignment to `{}`",
750750
self.loan_path_to_string(lp)));

src/librustc_mir/borrow_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
11611161
self.tcx.cannot_reassign_immutable(span,
11621162
&self.describe_lvalue(lvalue),
11631163
Origin::Mir)
1164-
.span_label(span, "re-assignment of immutable variable")
1164+
.span_label(span, "cannot assign twice to immutable variable")
11651165
.span_label(assigned_span, format!("first assignment to `{}`",
11661166
self.describe_lvalue(lvalue)))
11671167
.emit();

src/librustc_mir/util/borrowck_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ pub trait BorrowckErrors {
232232
-> DiagnosticBuilder
233233
{
234234
struct_span_err!(self, span, E0384,
235-
"re-assignment of immutable variable `{}`{OGN}",
235+
"cannot assign twice to immutable variable `{}`{OGN}",
236236
desc, OGN=o)
237237
}
238238

src/librustdoc/html/static/rustdoc.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ nav.sub {
171171

172172
.sidebar {
173173
width: 200px;
174-
position: absolute;
174+
position: fixed;
175175
left: 0;
176176
top: 0;
177-
min-height: 100%;
177+
height: 100vh;
178+
overflow: auto;
178179
}
179180

180181
.sidebar .current {

src/libstd/process.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,25 @@ pub fn abort() -> ! {
13101310
unsafe { ::sys::abort_internal() };
13111311
}
13121312

1313+
/// Returns the OS-assigned process identifier associated with this process.
1314+
///
1315+
/// # Examples
1316+
///
1317+
/// Basic usage:
1318+
///
1319+
/// ```no_run
1320+
/// #![feature(getpid)]
1321+
/// use std::process;
1322+
///
1323+
/// println!("My pid is {}", process::id());
1324+
/// ```
1325+
///
1326+
///
1327+
#[unstable(feature = "getpid", issue = "44971", reason = "recently added")]
1328+
pub fn id() -> u32 {
1329+
::sys::os::getpid()
1330+
}
1331+
13131332
#[cfg(all(test, not(target_os = "emscripten")))]
13141333
mod tests {
13151334
use io::prelude::*;

0 commit comments

Comments
 (0)