Skip to content

Commit 0194860

Browse files
authored
Rollup merge of #146251 - hkBst:clippy-fix-8, r=cjgillot
rustc_middle: clippy fixes Fixes for: ```text warning: bound is defined in more than one place warning: empty line after doc comment ```
2 parents bb27a2b + ad21f43 commit 0194860

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

compiler/rustc_middle/src/mir/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ impl<'tcx> Display for Const<'tcx> {
579579
}
580580

581581
///////////////////////////////////////////////////////////////////////////
582-
/// Const-related utilities
582+
// Const-related utilities
583583

584584
impl<'tcx> TyCtxt<'tcx> {
585585
pub fn span_as_caller_location(self, span: Span) -> ConstValue {

compiler/rustc_middle/src/mir/statement.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,14 @@ impl<'tcx> Place<'tcx> {
408408
self.as_ref().project_deeper(more_projections, tcx)
409409
}
410410

411-
pub fn ty_from<D: ?Sized>(
411+
pub fn ty_from<D>(
412412
local: Local,
413413
projection: &[PlaceElem<'tcx>],
414414
local_decls: &D,
415415
tcx: TyCtxt<'tcx>,
416416
) -> PlaceTy<'tcx>
417417
where
418-
D: HasLocalDecls<'tcx>,
418+
D: ?Sized + HasLocalDecls<'tcx>,
419419
{
420420
PlaceTy::from_ty(local_decls.local_decls()[local].ty).multi_projection_ty(tcx, projection)
421421
}
@@ -529,9 +529,9 @@ impl<'tcx> PlaceRef<'tcx> {
529529
Place { local: self.local, projection: tcx.mk_place_elems(new_projections) }
530530
}
531531

532-
pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> PlaceTy<'tcx>
532+
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> PlaceTy<'tcx>
533533
where
534-
D: HasLocalDecls<'tcx>,
534+
D: ?Sized + HasLocalDecls<'tcx>,
535535
{
536536
Place::ty_from(self.local, self.projection, local_decls, tcx)
537537
}
@@ -630,19 +630,19 @@ impl<'tcx> Operand<'tcx> {
630630
if let ty::FnDef(def_id, args) = *const_ty.kind() { Some((def_id, args)) } else { None }
631631
}
632632

633-
pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
633+
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
634634
where
635-
D: HasLocalDecls<'tcx>,
635+
D: ?Sized + HasLocalDecls<'tcx>,
636636
{
637637
match self {
638638
&Operand::Copy(ref l) | &Operand::Move(ref l) => l.ty(local_decls, tcx).ty,
639639
Operand::Constant(c) => c.const_.ty(),
640640
}
641641
}
642642

643-
pub fn span<D: ?Sized>(&self, local_decls: &D) -> Span
643+
pub fn span<D>(&self, local_decls: &D) -> Span
644644
where
645-
D: HasLocalDecls<'tcx>,
645+
D: ?Sized + HasLocalDecls<'tcx>,
646646
{
647647
match self {
648648
&Operand::Copy(ref l) | &Operand::Move(ref l) => {
@@ -674,7 +674,7 @@ impl<'tcx> ConstOperand<'tcx> {
674674
}
675675

676676
///////////////////////////////////////////////////////////////////////////
677-
/// Rvalues
677+
// Rvalues
678678

679679
pub enum RvalueInitializationState {
680680
Shallow,
@@ -721,9 +721,9 @@ impl<'tcx> Rvalue<'tcx> {
721721
}
722722
}
723723

724-
pub fn ty<D: ?Sized>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
724+
pub fn ty<D>(&self, local_decls: &D, tcx: TyCtxt<'tcx>) -> Ty<'tcx>
725725
where
726-
D: HasLocalDecls<'tcx>,
726+
D: ?Sized + HasLocalDecls<'tcx>,
727727
{
728728
match *self {
729729
Rvalue::Use(ref operand) => operand.ty(local_decls, tcx),

compiler/rustc_middle/src/ty/codec.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,7 @@ impl<'tcx, E: TyEncoder<'tcx>> Encodable<E> for ty::ParamEnv<'tcx> {
216216
#[inline]
217217
fn decode_arena_allocable<'tcx, D: TyDecoder<'tcx>, T: ArenaAllocatable<'tcx> + Decodable<D>>(
218218
decoder: &mut D,
219-
) -> &'tcx T
220-
where
221-
D: TyDecoder<'tcx>,
222-
{
219+
) -> &'tcx T {
223220
decoder.interner().arena.alloc(Decodable::decode(decoder))
224221
}
225222

@@ -230,10 +227,7 @@ fn decode_arena_allocable_slice<
230227
T: ArenaAllocatable<'tcx> + Decodable<D>,
231228
>(
232229
decoder: &mut D,
233-
) -> &'tcx [T]
234-
where
235-
D: TyDecoder<'tcx>,
236-
{
230+
) -> &'tcx [T] {
237231
decoder.interner().arena.alloc_from_iter(<Vec<T> as Decodable<D>>::decode(decoder))
238232
}
239233

0 commit comments

Comments
 (0)