about summary refs log tree commit diff
path: root/compiler/rustc_session/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-07-16 22:30:56 +0200
committerGitHub <noreply@github.com>2022-07-16 22:30:56 +0200
commit6277ac2fb8bf97cd910a0a841c6924b246d32c44 (patch)
tree2ecfa500407be289cf19a91c39d2ce7bdd511731 /compiler/rustc_session/src
parent0c6e01baffa5eeaa6658f065daffddf9916d0e87 (diff)
parentc54d4ada26c6a92346076bcc27d628398345ed9e (diff)
downloadrust-6277ac2fb8bf97cd910a0a841c6924b246d32c44.tar.gz
rust-6277ac2fb8bf97cd910a0a841c6924b246d32c44.zip
Rollup merge of #99342 - TaKO8Ki:avoid-symbol-to-string-conversions, r=compiler-errors
Avoid some `Symbol` to `String` conversions

This patch removes some Symbol to String conversions.
Diffstat (limited to 'compiler/rustc_session/src')
-rw-r--r--compiler/rustc_session/src/code_stats.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_session/src/code_stats.rs b/compiler/rustc_session/src/code_stats.rs
index cbb03ffd7a0..eede4d16ea3 100644
--- a/compiler/rustc_session/src/code_stats.rs
+++ b/compiler/rustc_session/src/code_stats.rs
@@ -1,11 +1,12 @@
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::sync::Lock;
+use rustc_span::Symbol;
 use rustc_target::abi::{Align, Size};
 use std::cmp::{self, Ordering};
 
 #[derive(Clone, PartialEq, Eq, Hash, Debug)]
 pub struct VariantInfo {
-    pub name: Option<String>,
+    pub name: Option<Symbol>,
     pub kind: SizeKind,
     pub size: u64,
     pub align: u64,
@@ -20,7 +21,7 @@ pub enum SizeKind {
 
 #[derive(Clone, PartialEq, Eq, Hash, Debug)]
 pub struct FieldInfo {
-    pub name: String,
+    pub name: Symbol,
     pub offset: u64,
     pub size: u64,
     pub align: u64,
@@ -119,7 +120,7 @@ impl CodeStats {
                 let VariantInfo { ref name, kind: _, align: _, size, ref fields } = *variant_info;
                 let indent = if !struct_like {
                     let name = match name.as_ref() {
-                        Some(name) => name.to_owned(),
+                        Some(name) => name.to_string(),
                         None => i.to_string(),
                     };
                     println!(