inline format!() args up to and including rustc_codegen_llvm
This commit is contained in:
parent
2e0136a131
commit
3ce90b1649
72 changed files with 411 additions and 481 deletions
|
@ -54,7 +54,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, '
|
|||
// The initial byte `4` instructs GDB that the following pretty printer
|
||||
// is defined inline as opposed to in a standalone file.
|
||||
section_contents.extend_from_slice(b"\x04");
|
||||
let vis_name = format!("pretty-printer-{}-{}\n", crate_name, index);
|
||||
let vis_name = format!("pretty-printer-{crate_name}-{index}\n");
|
||||
section_contents.extend_from_slice(vis_name.as_bytes());
|
||||
section_contents.extend_from_slice(&visualizer.src);
|
||||
|
||||
|
|
|
@ -184,9 +184,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
|
|||
debug_assert_eq!(
|
||||
(data_layout.pointer_size, data_layout.pointer_align.abi),
|
||||
cx.size_and_align_of(ptr_type),
|
||||
"ptr_type={}, pointee_type={}",
|
||||
ptr_type,
|
||||
pointee_type,
|
||||
"ptr_type={ptr_type}, pointee_type={pointee_type}",
|
||||
);
|
||||
|
||||
let di_node = unsafe {
|
||||
|
@ -521,7 +519,7 @@ fn recursion_marker_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> &'ll D
|
|||
fn hex_encode(data: &[u8]) -> String {
|
||||
let mut hex_string = String::with_capacity(data.len() * 2);
|
||||
for byte in data.iter() {
|
||||
write!(&mut hex_string, "{:02x}", byte).unwrap();
|
||||
write!(&mut hex_string, "{byte:02x}").unwrap();
|
||||
}
|
||||
hex_string
|
||||
}
|
||||
|
@ -766,7 +764,7 @@ fn build_param_type_di_node<'ll, 'tcx>(
|
|||
t: Ty<'tcx>,
|
||||
) -> DINodeCreationResult<'ll> {
|
||||
debug!("build_param_type_di_node: {:?}", t);
|
||||
let name = format!("{:?}", t);
|
||||
let name = format!("{t:?}");
|
||||
DINodeCreationResult {
|
||||
di_node: unsafe {
|
||||
llvm::LLVMRustDIBuilderCreateBasicType(
|
||||
|
@ -814,7 +812,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
|
|||
debug!("build_compile_unit_di_node: {:?}", name_in_debuginfo);
|
||||
let rustc_producer = format!("rustc version {}", tcx.sess.cfg_version);
|
||||
// FIXME(#41252) Remove "clang LLVM" if we can get GDB and LLVM to play nice.
|
||||
let producer = format!("clang LLVM ({})", rustc_producer);
|
||||
let producer = format!("clang LLVM ({rustc_producer})");
|
||||
|
||||
let name_in_debuginfo = name_in_debuginfo.to_string_lossy();
|
||||
let work_dir = tcx.sess.opts.working_dir.to_string_lossy(FileNameDisplayPreference::Remapped);
|
||||
|
@ -1331,10 +1329,10 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
|
|||
// Note: This code does not try to give a proper name to each method
|
||||
// because their might be multiple methods with the same name
|
||||
// (coming from different traits).
|
||||
(format!("__method{}", index), void_pointer_type_di_node)
|
||||
(format!("__method{index}"), void_pointer_type_di_node)
|
||||
}
|
||||
ty::VtblEntry::TraitVPtr(_) => {
|
||||
(format!("__super_trait_ptr{}", index), void_pointer_type_di_node)
|
||||
(format!("__super_trait_ptr{index}"), void_pointer_type_di_node)
|
||||
}
|
||||
ty::VtblEntry::MetadataAlign => ("align".to_string(), usize_di_node),
|
||||
ty::VtblEntry::MetadataSize => ("size".to_string(), usize_di_node),
|
||||
|
@ -1504,5 +1502,5 @@ pub fn tuple_field_name(field_index: usize) -> Cow<'static, str> {
|
|||
TUPLE_FIELD_NAMES
|
||||
.get(field_index)
|
||||
.map(|s| Cow::from(*s))
|
||||
.unwrap_or_else(|| Cow::from(format!("__{}", field_index)))
|
||||
.unwrap_or_else(|| Cow::from(format!("__{field_index}")))
|
||||
}
|
||||
|
|
|
@ -91,8 +91,7 @@ pub(crate) fn fat_pointer_kind<'ll, 'tcx>(
|
|||
// For all other pointee types we should already have returned None
|
||||
// at the beginning of the function.
|
||||
panic!(
|
||||
"fat_pointer_kind() - Encountered unexpected `pointee_tail_ty`: {:?}",
|
||||
pointee_tail_ty
|
||||
"fat_pointer_kind() - Encountered unexpected `pointee_tail_ty`: {pointee_tail_ty:?}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue