Skip to content

Commit f85579d

Browse files
committed
Auto merge of #43181 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 8 pull requests - Successful merges: #42670, #42826, #43000, #43011, #43098, #43100, #43136, #43137 - Failed merges:
2 parents b2b19ec + 388fce9 commit f85579d

File tree

34 files changed

+338
-29
lines changed

34 files changed

+338
-29
lines changed

src/liballoc/boxed.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -726,14 +726,14 @@ impl<T: Clone> Clone for Box<[T]> {
726726
}
727727
}
728728

729-
#[stable(feature = "rust1", since = "1.0.0")]
729+
#[stable(feature = "box_borrow", since = "1.1.0")]
730730
impl<T: ?Sized> borrow::Borrow<T> for Box<T> {
731731
fn borrow(&self) -> &T {
732732
&**self
733733
}
734734
}
735735

736-
#[stable(feature = "rust1", since = "1.0.0")]
736+
#[stable(feature = "box_borrow", since = "1.1.0")]
737737
impl<T: ?Sized> borrow::BorrowMut<T> for Box<T> {
738738
fn borrow_mut(&mut self) -> &mut T {
739739
&mut **self

src/libcore/cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
942942
#[unstable(feature = "coerce_unsized", issue = "27732")]
943943
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {}
944944

945-
#[stable(feature = "std_guard_impls", since = "1.20")]
945+
#[stable(feature = "std_guard_impls", since = "1.20.0")]
946946
impl<'a, T: ?Sized + fmt::Display> fmt::Display for Ref<'a, T> {
947947
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
948948
self.value.fmt(f)
@@ -1041,7 +1041,7 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
10411041
#[unstable(feature = "coerce_unsized", issue = "27732")]
10421042
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {}
10431043

1044-
#[stable(feature = "std_guard_impls", since = "1.20")]
1044+
#[stable(feature = "std_guard_impls", since = "1.20.0")]
10451045
impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> {
10461046
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10471047
self.value.fmt(f)

src/libcore/char.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl From<u8> for char {
210210

211211

212212
/// An error which can be returned when parsing a char.
213-
#[stable(feature = "char_from_str", since = "1.19.0")]
213+
#[stable(feature = "char_from_str", since = "1.20.0")]
214214
#[derive(Clone, Debug)]
215215
pub struct ParseCharError {
216216
kind: CharErrorKind,
@@ -237,15 +237,15 @@ enum CharErrorKind {
237237
TooManyChars,
238238
}
239239

240-
#[stable(feature = "char_from_str", since = "1.19.0")]
240+
#[stable(feature = "char_from_str", since = "1.20.0")]
241241
impl fmt::Display for ParseCharError {
242242
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
243243
self.__description().fmt(f)
244244
}
245245
}
246246

247247

248-
#[stable(feature = "char_from_str", since = "1.19.0")]
248+
#[stable(feature = "char_from_str", since = "1.20.0")]
249249
impl FromStr for char {
250250
type Err = ParseCharError;
251251

src/libcore/fmt/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1627,13 +1627,13 @@ macro_rules! tuple {
16271627
() => ();
16281628
( $($name:ident,)+ ) => (
16291629
#[stable(feature = "rust1", since = "1.0.0")]
1630-
impl<$($name:Debug),*> Debug for ($($name,)*) {
1630+
impl<$($name:Debug),*> Debug for ($($name,)*) where last_type!($($name,)+): ?Sized {
16311631
#[allow(non_snake_case, unused_assignments, deprecated)]
16321632
fn fmt(&self, f: &mut Formatter) -> Result {
16331633
let mut builder = f.debug_tuple("");
16341634
let ($(ref $name,)*) = *self;
16351635
$(
1636-
builder.field($name);
1636+
builder.field(&$name);
16371637
)*
16381638

16391639
builder.finish()
@@ -1643,6 +1643,11 @@ macro_rules! tuple {
16431643
)
16441644
}
16451645

1646+
macro_rules! last_type {
1647+
($a:ident,) => { $a };
1648+
($a:ident, $($rest_a:ident,)+) => { last_type!($($rest_a,)+) };
1649+
}
1650+
16461651
tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
16471652

16481653
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/hash/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ mod impls {
559559

560560
( $($name:ident)+) => (
561561
#[stable(feature = "rust1", since = "1.0.0")]
562-
impl<$($name: Hash),*> Hash for ($($name,)*) {
562+
impl<$($name: Hash),*> Hash for ($($name,)*) where last_type!($($name,)+): ?Sized {
563563
#[allow(non_snake_case)]
564564
fn hash<S: Hasher>(&self, state: &mut S) {
565565
let ($(ref $name,)*) = *self;
@@ -569,6 +569,11 @@ mod impls {
569569
);
570570
}
571571

572+
macro_rules! last_type {
573+
($a:ident,) => { $a };
574+
($a:ident, $($rest_a:ident,)+) => { last_type!($($rest_a,)+) };
575+
}
576+
572577
impl_hash_tuple! {}
573578
impl_hash_tuple! { A }
574579
impl_hash_tuple! { A B }

src/libcore/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ macro_rules! writeln {
462462
///
463463
/// # Panics
464464
///
465-
/// This will always panic.
465+
/// This will always [panic!](macro.panic.html)
466466
///
467467
/// # Examples
468468
///

src/libcore/tuple.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! tuple_impls {
2929
}
3030

3131
#[stable(feature = "rust1", since = "1.0.0")]
32-
impl<$($T:PartialEq),+> PartialEq for ($($T,)+) {
32+
impl<$($T:PartialEq),+> PartialEq for ($($T,)+) where last_type!($($T,)+): ?Sized {
3333
#[inline]
3434
fn eq(&self, other: &($($T,)+)) -> bool {
3535
$(self.$idx == other.$idx)&&+
@@ -41,10 +41,11 @@ macro_rules! tuple_impls {
4141
}
4242

4343
#[stable(feature = "rust1", since = "1.0.0")]
44-
impl<$($T:Eq),+> Eq for ($($T,)+) {}
44+
impl<$($T:Eq),+> Eq for ($($T,)+) where last_type!($($T,)+): ?Sized {}
4545

4646
#[stable(feature = "rust1", since = "1.0.0")]
47-
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
47+
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+)
48+
where last_type!($($T,)+): ?Sized {
4849
#[inline]
4950
fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> {
5051
lexical_partial_cmp!($(self.$idx, other.$idx),+)
@@ -68,7 +69,7 @@ macro_rules! tuple_impls {
6869
}
6970

7071
#[stable(feature = "rust1", since = "1.0.0")]
71-
impl<$($T:Ord),+> Ord for ($($T,)+) {
72+
impl<$($T:Ord),+> Ord for ($($T,)+) where last_type!($($T,)+): ?Sized {
7273
#[inline]
7374
fn cmp(&self, other: &($($T,)+)) -> Ordering {
7475
lexical_cmp!($(self.$idx, other.$idx),+)
@@ -118,6 +119,11 @@ macro_rules! lexical_cmp {
118119
($a:expr, $b:expr) => { ($a).cmp(&$b) };
119120
}
120121

122+
macro_rules! last_type {
123+
($a:ident,) => { $a };
124+
($a:ident, $($rest_a:ident,)+) => { last_type!($($rest_a,)+) };
125+
}
126+
121127
tuple_impls! {
122128
Tuple1 {
123129
(0) -> A

src/libproc_macro/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl Literal {
303303
Literal(token::Literal(token::Lit::Integer(Symbol::intern(&n.to_string())), None))
304304
}
305305

306-
int_literals!(u8, i8, u16, i16, u32, i32, u64, i64);
306+
int_literals!(u8, i8, u16, i16, u32, i32, u64, i64, usize, isize);
307307
fn typed_integer(n: i128, kind: &'static str) -> Literal {
308308
Literal(token::Literal(token::Lit::Integer(Symbol::intern(&n.to_string())),
309309
Some(Symbol::intern(kind))))

src/librustc/infer/error_reporting/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
347347
if !(did1.is_local() || did2.is_local()) && did1.krate != did2.krate {
348348
let exp_path = self.tcx.item_path_str(did1);
349349
let found_path = self.tcx.item_path_str(did2);
350+
let exp_abs_path = self.tcx.absolute_item_path_str(did1);
351+
let found_abs_path = self.tcx.absolute_item_path_str(did2);
350352
// We compare strings because DefPath can be different
351353
// for imported and non-imported crates
352-
if exp_path == found_path {
354+
if exp_path == found_path
355+
|| exp_abs_path == found_abs_path {
353356
let crate_name = self.tcx.sess.cstore.crate_name(did1.krate);
354357
err.span_note(sp, &format!("Perhaps two different versions \
355358
of crate `{}` are being used?",

src/librustc/traits/error_reporting.rs

+4
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
330330
.filter(|a| a.check_name("rustc_on_unimplemented"))
331331
.next()
332332
{
333+
let name = self.tcx.item_name(def_id).as_str();
333334
let err_sp = item.span.substitute_dummy(span);
334335
let trait_str = self.tcx.item_path_str(trait_ref.def_id);
335336
if let Some(istring) = item.value_str() {
@@ -347,6 +348,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
347348
Piece::NextArgument(a) => match a.position {
348349
Position::ArgumentNamed(s) => match generic_map.get(s) {
349350
Some(val) => Some(val),
351+
None if s == name => {
352+
Some(&trait_str)
353+
}
350354
None => {
351355
span_err!(self.tcx.sess, err_sp, E0272,
352356
"the #[rustc_on_unimplemented] attribute on trait \

src/librustc_typeck/check/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@ fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11671167
}) {
11681168
if let Some(istring) = attr.value_str() {
11691169
let istring = istring.as_str();
1170+
let name = tcx.item_name(def_id).as_str();
11701171
let parser = Parser::new(&istring);
11711172
let types = &generics.types;
11721173
for token in parser {
@@ -1175,13 +1176,14 @@ fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
11751176
Piece::NextArgument(a) => match a.position {
11761177
// `{Self}` is allowed
11771178
Position::ArgumentNamed(s) if s == "Self" => (),
1179+
// `{ThisTraitsName}` is allowed
1180+
Position::ArgumentNamed(s) if s == name => (),
11781181
// So is `{A}` if A is a type parameter
11791182
Position::ArgumentNamed(s) => match types.iter().find(|t| {
11801183
t.name == s
11811184
}) {
11821185
Some(_) => (),
11831186
None => {
1184-
let name = tcx.item_name(def_id);
11851187
span_err!(tcx.sess, attr.span, E0230,
11861188
"there is no type parameter \
11871189
{} on trait {}",

src/libstd/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl Error for char::CharTryFromError {
340340
}
341341
}
342342

343-
#[stable(feature = "char_from_str", since = "1.19.0")]
343+
#[stable(feature = "char_from_str", since = "1.20.0")]
344344
impl Error for char::ParseCharError {
345345
fn description(&self) -> &str {
346346
self.__description()

src/libstd/io/buffered.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ impl<R: Seek> Seek for BufReader<R> {
276276
/// `BufWriter` keeps an in-memory buffer of data and writes it to an underlying
277277
/// writer in large, infrequent batches.
278278
///
279-
/// The buffer will be written out when the writer is dropped.
279+
/// When the `BufWriter` is dropped, the contents of its buffer will be written
280+
/// out. However, any errors that happen in the process of flushing the buffer
281+
/// when the writer is dropped will be ignored. Code that wishes to handle such
282+
/// errors must manually call [`flush`] before the writer is dropped.
280283
///
281284
/// # Examples
282285
///
@@ -316,6 +319,7 @@ impl<R: Seek> Seek for BufReader<R> {
316319
/// [`Write`]: ../../std/io/trait.Write.html
317320
/// [`Tcpstream::write`]: ../../std/net/struct.TcpStream.html#method.write
318321
/// [`TcpStream`]: ../../std/net/struct.TcpStream.html
322+
/// [`flush`]: #method.flush
319323
#[stable(feature = "rust1", since = "1.0.0")]
320324
pub struct BufWriter<W: Write> {
321325
inner: Option<W>,

src/libstd/macros.rs

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
/// The multi-argument form of this macro panics with a string and has the
2525
/// `format!` syntax for building a string.
2626
///
27+
/// # Current implementation
28+
///
29+
/// If the main thread panics it will terminate all your threads and end your
30+
/// program with code `101`.
31+
///
2732
/// # Examples
2833
///
2934
/// ```should_panic

src/libstd/sync/mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'a, T> {
440440
}
441441
}
442442

443-
#[stable(feature = "std_guard_impls", since = "1.20")]
443+
#[stable(feature = "std_guard_impls", since = "1.20.0")]
444444
impl<'a, T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'a, T> {
445445
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
446446
(**self).fmt(f)

src/libstd/sync/rwlock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockReadGuard<'a, T> {
370370
}
371371
}
372372

373-
#[stable(feature = "std_guard_impls", since = "1.20")]
373+
#[stable(feature = "std_guard_impls", since = "1.20.0")]
374374
impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'a, T> {
375375
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
376376
(**self).fmt(f)
@@ -386,7 +386,7 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> {
386386
}
387387
}
388388

389-
#[stable(feature = "std_guard_impls", since = "1.20")]
389+
#[stable(feature = "std_guard_impls", since = "1.20.0")]
390390
impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockWriteGuard<'a, T> {
391391
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
392392
(**self).fmt(f)

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

+15
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ pub trait MetadataExt {
177177
#[stable(feature = "metadata_ext", since = "1.1.0")]
178178
fn mode(&self) -> u32;
179179
#[stable(feature = "metadata_ext", since = "1.1.0")]
180+
fn nlink(&self) -> u64;
181+
#[stable(feature = "metadata_ext", since = "1.1.0")]
180182
fn uid(&self) -> u32;
181183
#[stable(feature = "metadata_ext", since = "1.1.0")]
182184
fn gid(&self) -> u32;
@@ -194,6 +196,10 @@ pub trait MetadataExt {
194196
fn ctime(&self) -> i64;
195197
#[stable(feature = "metadata_ext", since = "1.1.0")]
196198
fn ctime_nsec(&self) -> i64;
199+
#[stable(feature = "metadata_ext", since = "1.1.0")]
200+
fn blksize(&self) -> u64;
201+
#[stable(feature = "metadata_ext", since = "1.1.0")]
202+
fn blocks(&self) -> u64;
197203
}
198204

199205
#[stable(feature = "metadata_ext", since = "1.1.0")]
@@ -207,6 +213,9 @@ impl MetadataExt for fs::Metadata {
207213
fn mode(&self) -> u32 {
208214
self.as_inner().as_inner().st_mode as u32
209215
}
216+
fn nlink(&self) -> u64 {
217+
self.as_inner().as_inner().st_nlink as u64
218+
}
210219
fn uid(&self) -> u32 {
211220
self.as_inner().as_inner().st_uid as u32
212221
}
@@ -234,6 +243,12 @@ impl MetadataExt for fs::Metadata {
234243
fn ctime_nsec(&self) -> i64 {
235244
self.as_inner().as_inner().st_ctime_nsec as i64
236245
}
246+
fn blksize(&self) -> u64 {
247+
self.as_inner().as_inner().st_blksize as u64
248+
}
249+
fn blocks(&self) -> u64 {
250+
self.as_inner().as_inner().st_blocks as u64
251+
}
237252
}
238253

239254
/// Add special Redox types (block/char device, fifo and socket)

src/libstd/sys/redox/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ impl FilePermissions {
119119
impl FileType {
120120
pub fn is_dir(&self) -> bool { self.is(syscall::MODE_DIR) }
121121
pub fn is_file(&self) -> bool { self.is(syscall::MODE_FILE) }
122-
pub fn is_symlink(&self) -> bool { false /*FIXME: Implement symlink mode*/ }
122+
pub fn is_symlink(&self) -> bool { self.is(syscall::MODE_SYMLINK) }
123123

124124
pub fn is(&self, mode: u16) -> bool {
125-
self.mode & (syscall::MODE_DIR | syscall::MODE_FILE) == mode
125+
self.mode & syscall::MODE_TYPE == mode
126126
}
127127
}
128128

src/libstd_unicode/char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use tables::{conversions, derived_property, general_category, property};
3838
pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked};
3939
#[stable(feature = "rust1", since = "1.0.0")]
4040
pub use core::char::{EscapeDebug, EscapeDefault, EscapeUnicode};
41-
#[stable(feature = "char_from_str", since = "1.19.0")]
41+
#[stable(feature = "char_from_str", since = "1.20.0")]
4242
pub use core::char::ParseCharError;
4343

4444
// unstable reexports
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-include ../tools.mk
2+
3+
all:
4+
# compile two different versions of crateA
5+
$(RUSTC) --crate-type=rlib crateA.rs -C metadata=-1 -C extra-filename=-1
6+
$(RUSTC) --crate-type=rlib crateA.rs -C metadata=-2 -C extra-filename=-2
7+
# make crateB depend on version 1 of crateA
8+
$(RUSTC) --crate-type=rlib crateB.rs --extern crateA=$(TMPDIR)/libcrateA-1.rlib
9+
# make crateC depend on version 2 of crateA
10+
$(RUSTC) crateC.rs --extern crateA=$(TMPDIR)/libcrateA-2.rlib 2>&1 | \
11+
tr -d '\r\n' | grep \
12+
"mismatched types.*\
13+
crateB::try_foo(foo2);.*\
14+
expected struct \`crateA::foo::Foo\`, found struct \`crateA::Foo\`.*\
15+
different versions of crate \`crateA\`.*\
16+
mismatched types.*\
17+
crateB::try_bar(bar2);.*\
18+
expected trait \`crateA::bar::Bar\`, found trait \`crateA::Bar\`.*\
19+
different versions of crate \`crateA\`"

0 commit comments

Comments
 (0)