Skip to content

Commit 5472b07

Browse files
committed
Auto merge of #54809 - pietroalbini:rollup, r=pietroalbini
Rollup of 10 pull requests Successful merges: - #53523 (Add doc for impl From for Std Error) - #54746 (simplify some unused lints code) - #54761 (Make spec_extend use for_each()) - #54769 (Fix typo in CONTRIBUTING.md) - #54773 (Update a FIXME in memory.rs) - #54777 (abolish ICE when pretty-printing async block) - #54780 (Remove duplicate predicates in `explicit_predicates_of`) - #54788 (A handful of cleanups for rustc/mir) - #54789 (Introduce `TyKind::UnnormalizedProjection`) - #54795 (remove padding from multiline format string label) Failed merges: r? @ghost
2 parents 8a0e5cb + 71aded8 commit 5472b07

File tree

44 files changed

+304
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+304
-76
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ labels to triage issues:
566566
to fix the issue.
567567

568568
* The dark blue **final-comment-period** label marks bugs that are using the
569-
RFC signoff functionality of [rfcbot][rfcbot] and are currenty in the final
569+
RFC signoff functionality of [rfcbot][rfcbot] and are currently in the final
570570
comment period.
571571

572572
* Red, **I**-prefixed labels indicate the **importance** of the issue. The

src/liballoc/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,12 +1822,12 @@ impl<T, I> SpecExtend<T, I> for Vec<T>
18221822
unsafe {
18231823
let mut ptr = self.as_mut_ptr().add(self.len());
18241824
let mut local_len = SetLenOnDrop::new(&mut self.len);
1825-
for element in iterator {
1825+
iterator.for_each(move |element| {
18261826
ptr::write(ptr, element);
18271827
ptr = ptr.offset(1);
18281828
// NB can't overflow since we would have had to alloc the address space
18291829
local_len.increment_len(1);
1830-
}
1830+
});
18311831
}
18321832
} else {
18331833
self.extend_desugared(iterator)

src/libfmt_macros/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<'a> Parser<'a> {
288288
self.cur.next();
289289
Some(pos)
290290
} else {
291-
let pos = pos + padding + 1;
291+
let pos = pos + raw + 1;
292292
self.err(format!("expected `{:?}`, found `{:?}`", c, maybe),
293293
format!("expected `{}`", c),
294294
pos,

src/librustc/ich/impls_ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,8 @@ for ty::TyKind<'gcx>
873873
Tuple(inner_tys) => {
874874
inner_tys.hash_stable(hcx, hasher);
875875
}
876-
Projection(ref projection_ty) => {
877-
projection_ty.hash_stable(hcx, hasher);
876+
Projection(ref data) | UnnormalizedProjection(ref data) => {
877+
data.hash_stable(hcx, hasher);
878878
}
879879
Opaque(def_id, substs) => {
880880
def_id.hash_stable(hcx, hasher);

src/librustc/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
283283
| ty::Never
284284
| ty::Tuple(..)
285285
| ty::Projection(..)
286+
| ty::UnnormalizedProjection(..)
286287
| ty::Foreign(..)
287288
| ty::Param(..)
288289
| ty::Opaque(..) => {

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
193193
ty::Never |
194194
ty::Tuple(..) |
195195
ty::Projection(..) |
196+
ty::UnnormalizedProjection(..) |
196197
ty::Foreign(..) |
197198
ty::Param(..) |
198199
ty::Closure(..) |

src/librustc/mir/interpret/value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'tcx> Scalar {
171171
pub fn from_uint(i: impl Into<u128>, size: Size) -> Self {
172172
let i = i.into();
173173
debug_assert_eq!(truncate(i, size), i,
174-
"Unsigned value {} does not fit in {} bits", i, size.bits());
174+
"Unsigned value {} does not fit in {} bits", i, size.bits());
175175
Scalar::Bits { bits: i, size: size.bytes() as u8 }
176176
}
177177

@@ -181,7 +181,7 @@ impl<'tcx> Scalar {
181181
// `into` performed sign extension, we have to truncate
182182
let truncated = truncate(i as u128, size);
183183
debug_assert_eq!(sign_extend(truncated, size) as i128, i,
184-
"Signed value {} does not fit in {} bits", i, size.bits());
184+
"Signed value {} does not fit in {} bits", i, size.bits());
185185
Scalar::Bits { bits: truncated, size: size.bytes() as u8 }
186186
}
187187

src/librustc/mir/mod.rs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//!
1313
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html
1414
15-
use graphviz::IntoCow;
1615
use hir::def::CtorKind;
1716
use hir::def_id::DefId;
1817
use hir::{self, HirId, InlineAsm};
@@ -327,22 +326,20 @@ impl<'tcx> Mir<'tcx> {
327326
if idx < stmts.len() {
328327
&stmts[idx].source_info
329328
} else {
330-
assert!(idx == stmts.len());
329+
assert_eq!(idx, stmts.len());
331330
&block.terminator().source_info
332331
}
333332
}
334333

335334
/// Check if `sub` is a sub scope of `sup`
336335
pub fn is_sub_scope(&self, mut sub: SourceScope, sup: SourceScope) -> bool {
337-
loop {
338-
if sub == sup {
339-
return true;
340-
}
336+
while sub != sup {
341337
match self.source_scopes[sub].parent_scope {
342338
None => return false,
343339
Some(p) => sub = p,
344340
}
345341
}
342+
true
346343
}
347344

348345
/// Return the return type, it always return first element from `local_decls` array
@@ -526,9 +523,7 @@ impl BorrowKind {
526523
pub fn allows_two_phase_borrow(&self) -> bool {
527524
match *self {
528525
BorrowKind::Shared | BorrowKind::Shallow | BorrowKind::Unique => false,
529-
BorrowKind::Mut {
530-
allow_two_phase_borrow,
531-
} => allow_two_phase_borrow,
526+
BorrowKind::Mut { allow_two_phase_borrow } => allow_two_phase_borrow,
532527
}
533528
}
534529
}
@@ -1574,42 +1569,42 @@ impl<'tcx> TerminatorKind<'tcx> {
15741569
};
15751570
fmt_const_val(&mut s, &c).unwrap();
15761571
s.into()
1577-
}).chain(iter::once(String::from("otherwise").into()))
1572+
}).chain(iter::once("otherwise".into()))
15781573
.collect()
15791574
}
15801575
Call {
15811576
destination: Some(_),
15821577
cleanup: Some(_),
15831578
..
1584-
} => vec!["return".into_cow(), "unwind".into_cow()],
1579+
} => vec!["return".into(), "unwind".into()],
15851580
Call {
15861581
destination: Some(_),
15871582
cleanup: None,
15881583
..
1589-
} => vec!["return".into_cow()],
1584+
} => vec!["return".into()],
15901585
Call {
15911586
destination: None,
15921587
cleanup: Some(_),
15931588
..
1594-
} => vec!["unwind".into_cow()],
1589+
} => vec!["unwind".into()],
15951590
Call {
15961591
destination: None,
15971592
cleanup: None,
15981593
..
15991594
} => vec![],
1600-
Yield { drop: Some(_), .. } => vec!["resume".into_cow(), "drop".into_cow()],
1601-
Yield { drop: None, .. } => vec!["resume".into_cow()],
1595+
Yield { drop: Some(_), .. } => vec!["resume".into(), "drop".into()],
1596+
Yield { drop: None, .. } => vec!["resume".into()],
16021597
DropAndReplace { unwind: None, .. } | Drop { unwind: None, .. } => {
1603-
vec!["return".into_cow()]
1598+
vec!["return".into()]
16041599
}
16051600
DropAndReplace {
16061601
unwind: Some(_), ..
16071602
}
16081603
| Drop {
16091604
unwind: Some(_), ..
1610-
} => vec!["return".into_cow(), "unwind".into_cow()],
1605+
} => vec!["return".into(), "unwind".into()],
16111606
Assert { cleanup: None, .. } => vec!["".into()],
1612-
Assert { .. } => vec!["success".into_cow(), "unwind".into_cow()],
1607+
Assert { .. } => vec!["success".into(), "unwind".into()],
16131608
FalseEdges {
16141609
ref imaginary_targets,
16151610
..

src/librustc/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> {
325325
String::new()
326326
};
327327

328-
let crate_disambiguator = format!("{}", tcx.crate_disambiguator(cnum));
328+
let crate_disambiguator = tcx.crate_disambiguator(cnum).to_string();
329329
// Using a shortened disambiguator of about 40 bits
330330
format!("{}.{}{}",
331331
tcx.crate_name(cnum),

src/librustc/mir/tcx.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
8787
assert!(index < adt_def.variants.len());
8888
assert_eq!(adt_def, adt_def1);
8989
PlaceTy::Downcast { adt_def,
90-
substs,
91-
variant_index: index }
90+
substs,
91+
variant_index: index }
9292
}
9393
_ => {
9494
bug!("cannot downcast non-ADT type: `{:?}`", self)
@@ -151,7 +151,7 @@ impl<'tcx> Place<'tcx> {
151151
}
152152
},
153153
_ => None,
154-
}
154+
}
155155
_ => None,
156156
}
157157
}
@@ -255,9 +255,9 @@ impl<'tcx> Operand<'tcx> {
255255

256256
impl<'tcx> BinOp {
257257
pub fn ty<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
258-
lhs_ty: Ty<'tcx>,
259-
rhs_ty: Ty<'tcx>)
260-
-> Ty<'tcx> {
258+
lhs_ty: Ty<'tcx>,
259+
rhs_ty: Ty<'tcx>)
260+
-> Ty<'tcx> {
261261
// FIXME: handle SIMD correctly
262262
match self {
263263
&BinOp::Add | &BinOp::Sub | &BinOp::Mul | &BinOp::Div | &BinOp::Rem |

0 commit comments

Comments
 (0)