X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fmir%2Fpretty.rs;h=8cc705384b03e7bb8bdabf0c826bc087cb0b7c9a;hb=40c67206209b485b9e99f5e4e3a3bc9b8d255123;hp=8e1b887f87da75695eb5c41a6156250db02171e8;hpb=5bc09362dc90a9c4037907c0bb8e0773268344b1;p=rust.git diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 8e1b887f87d..8cc705384b0 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -167,8 +167,8 @@ fn dump_matched_mir_node<'tcx, F>( /// Returns the file basename portion (without extension) of a filename path /// where we should dump a MIR representation output files. -fn dump_file_basename( - tcx: TyCtxt<'_>, +fn dump_file_basename<'tcx>( + tcx: TyCtxt<'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, disambiguator: &dyn Display, @@ -251,8 +251,8 @@ fn create_dump_file_with_basename( /// bit of MIR-related data. Used by `mir-dump`, but also by other /// bits of code (e.g., NLL inference) that dump graphviz data or /// other things, and hence takes the extension as an argument. -pub fn create_dump_file( - tcx: TyCtxt<'_>, +pub fn create_dump_file<'tcx>( + tcx: TyCtxt<'tcx>, extension: &str, pass_num: Option<&dyn Display>, pass_name: &str, @@ -419,7 +419,7 @@ struct ExtraComments<'tcx> { comments: Vec, } -impl ExtraComments<'tcx> { +impl<'tcx> ExtraComments<'tcx> { fn push(&mut self, lines: &str) { for line in lines.split('\n') { self.comments.push(line.to_string()); @@ -427,7 +427,7 @@ fn push(&mut self, lines: &str) { } } -fn use_verbose(ty: &&TyS<'tcx>, fn_def: bool) -> bool { +fn use_verbose<'tcx>(ty: &&TyS<'tcx>, fn_def: bool) -> bool { match ty.kind() { ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => false, // Unit type @@ -439,7 +439,7 @@ fn use_verbose(ty: &&TyS<'tcx>, fn_def: bool) -> bool { } } -impl Visitor<'tcx> for ExtraComments<'tcx> { +impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> { fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) { self.super_constant(constant, location); let Constant { span, user_ty, literal } = constant; @@ -762,7 +762,7 @@ fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> ControlFlow( +pub fn display_allocation<'a, 'tcx, Tag, Extra>( tcx: TyCtxt<'tcx>, alloc: &'a Allocation, ) -> RenderAllocation<'a, 'tcx, Tag, Extra> { @@ -775,7 +775,9 @@ pub struct RenderAllocation<'a, 'tcx, Tag, Extra> { alloc: &'a Allocation, } -impl std::fmt::Display for RenderAllocation<'a, 'tcx, Tag, Extra> { +impl<'a, 'tcx, Tag: Provenance, Extra> std::fmt::Display + for RenderAllocation<'a, 'tcx, Tag, Extra> +{ fn fmt(&self, w: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let RenderAllocation { tcx, alloc } = *self; write!(w, "size: {}, align: {})", alloc.size().bytes(), alloc.align.bytes())?; @@ -818,7 +820,7 @@ fn write_allocation_newline( /// The `prefix` argument allows callers to add an arbitrary prefix before each line (even if there /// is only one line). Note that your prefix should contain a trailing space as the lines are /// printed directly after it. -fn write_allocation_bytes( +fn write_allocation_bytes<'tcx, Tag: Provenance, Extra>( tcx: TyCtxt<'tcx>, alloc: &Allocation, w: &mut dyn std::fmt::Write,