Skip to content

Commit e41cdab

Browse files
authored
Auto merge of #34408 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests - Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404 - Failed merges:
2 parents 3ee3267 + c749a3e commit e41cdab

File tree

14 files changed

+188
-46
lines changed

14 files changed

+188
-46
lines changed

configure

-31
Original file line numberDiff line numberDiff line change
@@ -1040,37 +1040,6 @@ if [ -n "$CFG_ENABLE_CLANG" ]
10401040
then
10411041
case "$CC" in
10421042
(''|*clang)
1043-
CFG_CLANG_REPORTED_VERSION=$($CFG_CC --version | grep version)
1044-
1045-
if echo $CFG_CLANG_REPORTED_VERSION | grep -q "(based on LLVM "; then
1046-
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*(based on LLVM \(.*\))/\1/')
1047-
elif echo $CFG_CLANG_REPORTED_VERSION | grep -q "Apple LLVM"; then
1048-
CFG_OSX_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
1049-
else
1050-
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
1051-
fi
1052-
1053-
if [ -n "$CFG_OSX_CLANG_VERSION" ]
1054-
then
1055-
case $CFG_OSX_CLANG_VERSION in
1056-
(7.0* | 7.1* | 7.2* | 7.3* | 8.0*)
1057-
step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
1058-
;;
1059-
(*)
1060-
err "bad APPLE CLANG version: $CFG_OSX_CLANG_VERSION, need >=7.0"
1061-
;;
1062-
esac
1063-
else
1064-
case $CFG_CLANG_VERSION in
1065-
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7* | 3.8* | 3.9*)
1066-
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
1067-
;;
1068-
(*)
1069-
err "bad CLANG version: $CFG_CLANG_VERSION, need >=3.0svn"
1070-
;;
1071-
esac
1072-
fi
1073-
10741043
if [ -z "$CC" ]
10751044
then
10761045
CFG_CC="clang"

src/libcore/num/mod.rs

+28
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,34 @@ impl<T: fmt::Display> fmt::Display for Wrapping<T> {
6666
}
6767
}
6868

69+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
70+
impl<T: fmt::Binary> fmt::Binary for Wrapping<T> {
71+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
72+
self.0.fmt(f)
73+
}
74+
}
75+
76+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
77+
impl<T: fmt::Octal> fmt::Octal for Wrapping<T> {
78+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
79+
self.0.fmt(f)
80+
}
81+
}
82+
83+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
84+
impl<T: fmt::LowerHex> fmt::LowerHex for Wrapping<T> {
85+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
86+
self.0.fmt(f)
87+
}
88+
}
89+
90+
#[stable(feature = "wrapping_fmt", since = "1.11.0")]
91+
impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> {
92+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
93+
self.0.fmt(f)
94+
}
95+
}
96+
6997
mod wrapping;
7098

7199
// All these modules are technically private and only exposed for libcoretest:

src/librustc_const_eval/eval.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ fn cast_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, val: ConstVal, ty: ty::Ty)
11161116
ty::TyRawPtr(_) => {
11171117
Err(ErrKind::UnimplementedConstVal("casting a bytestr to a raw ptr"))
11181118
},
1119+
ty::TyRef(..) => Err(ErrKind::UnimplementedConstVal("casting a bytestr to slice")),
11191120
_ => Err(CannotCast),
11201121
},
11211122
_ => Err(CannotCast),

src/librustdoc/clean/inline.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,14 @@ pub fn load_attrs<'a, 'tcx>(cx: &DocContext, tcx: TyCtxt<'a, 'tcx, 'tcx>,
143143
pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
144144
if let Some(tcx) = cx.tcx_opt() {
145145
let crate_name = tcx.sess.cstore.crate_name(did.krate).to_string();
146-
let relative = tcx.def_path(did).data.into_iter().map(|elem| {
147-
elem.data.to_string()
146+
let relative = tcx.def_path(did).data.into_iter().filter_map(|elem| {
147+
// extern blocks have an empty name
148+
let s = elem.data.to_string();
149+
if !s.is_empty() {
150+
Some(s)
151+
} else {
152+
None
153+
}
148154
});
149155
let fqn = once(crate_name).chain(relative).collect();
150156
cx.renderinfo.borrow_mut().external_paths.insert(did, (fqn, kind));

src/librustdoc/html/render.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -1519,20 +1519,23 @@ impl<'a> Item<'a> {
15191519
// located, then we return `None`.
15201520
} else {
15211521
let cache = cache();
1522-
let path = match cache.external_paths.get(&self.item.def_id) {
1522+
let external_path = match cache.external_paths.get(&self.item.def_id) {
15231523
Some(path) => path,
15241524
None => return None,
15251525
};
1526-
let root = match cache.extern_locations.get(&self.item.def_id.krate) {
1526+
let mut path = match cache.extern_locations.get(&self.item.def_id.krate) {
15271527
Some(&(_, Remote(ref s))) => s.to_string(),
15281528
Some(&(_, Local)) => self.cx.root_path.clone(),
15291529
Some(&(_, Unknown)) => return None,
15301530
None => return None,
15311531
};
1532-
Some(format!("{root}{path}/{file}?gotosrc={goto}",
1533-
root = root,
1534-
path = path[..path.len() - 1].join("/"),
1535-
file = item_path(shortty(self.item), self.item.name.as_ref().unwrap()),
1532+
for item in &external_path[..external_path.len() - 1] {
1533+
path.push_str(item);
1534+
path.push_str("/");
1535+
}
1536+
Some(format!("{path}{file}?gotosrc={goto}",
1537+
path = path,
1538+
file = item_path(shortty(self.item), external_path.last().unwrap()),
15361539
goto = self.item.def_id.index.as_usize()))
15371540
}
15381541
}

src/libstd/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub mod builtin {
276276
/// // fn concat_idents!(new, fun, name) { } // not usable in this way!
277277
/// # }
278278
/// ```
279-
#[stable(feature = "rust1", since = "1.0.0")]
279+
#[unstable(feature = "concat_idents", issue = "29599")]
280280
#[macro_export]
281281
macro_rules! concat_idents {
282282
($($e:ident),*) => ({ /* compiler built-in */ })

src/libstd/sys/unix/thread.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,25 @@ impl Thread {
125125
}
126126

127127
pub fn sleep(dur: Duration) {
128-
let mut ts = libc::timespec {
129-
tv_sec: dur.as_secs() as libc::time_t,
130-
tv_nsec: dur.subsec_nanos() as libc::c_long,
131-
};
128+
let mut secs = dur.as_secs();
129+
let mut nsecs = dur.subsec_nanos() as libc::c_long;
132130

133131
// If we're awoken with a signal then the return value will be -1 and
134132
// nanosleep will fill in `ts` with the remaining time.
135133
unsafe {
136-
while libc::nanosleep(&ts, &mut ts) == -1 {
137-
assert_eq!(os::errno(), libc::EINTR);
134+
while secs > 0 || nsecs > 0 {
135+
let mut ts = libc::timespec {
136+
tv_sec: cmp::min(libc::time_t::max_value() as u64, secs) as libc::time_t,
137+
tv_nsec: nsecs,
138+
};
139+
secs -= ts.tv_sec as u64;
140+
if libc::nanosleep(&ts, &mut ts) == -1 {
141+
assert_eq!(os::errno(), libc::EINTR);
142+
secs += ts.tv_sec as u64;
143+
nsecs = ts.tv_nsec;
144+
} else {
145+
nsecs = 0;
146+
}
138147
}
139148
}
140149
}

src/test/compile-fail/issue-23281.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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+
// ignore-tidy-linelength
12+
13+
pub struct Struct;
14+
15+
impl Struct {
16+
pub fn function(funs: Vec<Fn() -> ()>) {}
17+
//~^ ERROR the trait bound `std::ops::Fn() + 'static: std::marker::Sized` is not satisfied
18+
}
19+
20+
fn main() {}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 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+
#[deny(warnings)]
12+
13+
pub fn main() {
14+
let _ = b"x" as &[u8];
15+
}

src/test/run-pass/sleep.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2016 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+
use std::thread::{self, sleep};
12+
use std::time::Duration;
13+
use std::sync::{Arc, Mutex};
14+
use std::u64;
15+
16+
fn main() {
17+
let finished = Arc::new(Mutex::new(false));
18+
let t_finished = finished.clone();
19+
thread::spawn(move || {
20+
sleep(Duration::new(u64::MAX, 0));
21+
*t_finished.lock().unwrap() = true;
22+
});
23+
sleep(Duration::from_millis(100));
24+
assert_eq!(*finished.lock().unwrap(), false);
25+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2016 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+
extern {
12+
pub fn extern_c_fn();
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2016 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+
pub struct Foo;

src/test/rustdoc/issue-34274.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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+
// aux-build:issue-34274.rs
12+
// build-aux-docs
13+
// ignore-cross-compile
14+
15+
#![crate_name = "foo"]
16+
17+
extern crate issue_34274;
18+
19+
// @has foo/fn.extern_c_fn.html '//a/@href' '../issue_34274/fn.extern_c_fn.html?gotosrc='
20+
pub use issue_34274::extern_c_fn;
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2016 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+
// aux-build:src-links-external.rs
12+
// build-aux-docs
13+
// ignore-cross-compile
14+
15+
#![crate_name = "foo"]
16+
17+
extern crate src_links_external;
18+
19+
// @has foo/bar/index.html '//a/@href' '../src_links_external/index.html?gotosrc='
20+
pub use src_links_external as bar;
21+
22+
// @has foo/bar/struct.Foo.html '//a/@href' '../src_links_external/struct.Foo.html?gotosrc='

0 commit comments

Comments
 (0)