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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 7 additions & 2 deletions
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

Lines changed: 6 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 4 additions & 0 deletions
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 \

0 commit comments

Comments
 (0)