Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename LocalInternedString and more #65776

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl<'tcx> DepNodeParams<'tcx> for CrateNum {
}

fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
tcx.crate_name(*self).as_str().to_string()
tcx.crate_name(*self).to_string()
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3382,7 +3382,7 @@ pub fn is_range_literal(sess: &Session, expr: &hir::Expr) -> bool {
// either in std or core, i.e. has either a `::std::ops::Range` or
// `::core::ops::Range` prefix.
fn is_range_path(path: &Path) -> bool {
let segs: Vec<_> = path.segments.iter().map(|seg| seg.ident.as_str().to_string()).collect();
let segs: Vec<_> = path.segments.iter().map(|seg| seg.ident.to_string()).collect();
let segs: Vec<_> = segs.iter().map(|seg| &**seg).collect();

// "{{root}}" is the equivalent of `::` prefix in `Path`.
Expand Down Expand Up @@ -3423,7 +3423,7 @@ pub fn is_range_literal(sess: &Session, expr: &hir::Expr) -> bool {
ExprKind::Call(ref func, _) => {
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref segment)) = func.kind {
if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.kind {
let new_call = segment.ident.as_str() == "new";
let new_call = segment.ident.name == sym::new;
return is_range_path(&path) && is_lit(sess, &expr.span) && new_call;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ impl<'a> State<'a> {
}
hir::ItemKind::GlobalAsm(ref ga) => {
self.head(visibility_qualified(&item.vis, "global asm"));
self.s.word(ga.asm.as_str().to_string());
self.s.word(ga.asm.to_string());
self.end()
}
hir::ItemKind::TyAlias(ref ty, ref generics) => {
Expand Down Expand Up @@ -1855,7 +1855,7 @@ impl<'a> State<'a> {
self.commasep(Inconsistent, &decl.inputs, |s, ty| {
s.ibox(INDENT_UNIT);
if let Some(arg_name) = arg_names.get(i) {
s.s.word(arg_name.as_str().to_string());
s.s.word(arg_name.to_string());
s.s.word(":");
s.s.space();
} else if let Some(body_id) = body_id {
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::mem;
use syntax::ast;
use syntax::feature_gate;
use syntax::parse::token;
use syntax::symbol::LocalInternedString;
use syntax::symbol::SymbolStr;
use syntax::tokenstream;
use syntax_pos::SourceFile;

Expand All @@ -18,21 +18,21 @@ use crate::hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
use smallvec::SmallVec;
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};

impl<'a> HashStable<StableHashingContext<'a>> for LocalInternedString {
impl<'a> HashStable<StableHashingContext<'a>> for SymbolStr {
#[inline]
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
let str = self as &str;
str.hash_stable(hcx, hasher)
}
}

impl<'a> ToStableHashKey<StableHashingContext<'a>> for LocalInternedString {
type KeyType = LocalInternedString;
impl<'a> ToStableHashKey<StableHashingContext<'a>> for SymbolStr {
type KeyType = SymbolStr;

#[inline]
fn to_stable_hash_key(&self,
_: &StableHashingContext<'a>)
-> LocalInternedString {
-> SymbolStr {
self.clone()
}
}
Expand All @@ -45,12 +45,12 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::Name {
}

impl<'a> ToStableHashKey<StableHashingContext<'a>> for ast::Name {
type KeyType = LocalInternedString;
type KeyType = SymbolStr;

#[inline]
fn to_stable_hash_key(&self,
_: &StableHashingContext<'a>)
-> LocalInternedString {
-> SymbolStr {
self.as_str()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl CodegenUnitNameBuilder<'tcx> {
if self.tcx.sess.opts.debugging_opts.human_readable_cgu_names {
cgu_name
} else {
let cgu_name = &cgu_name.as_str()[..];
let cgu_name = &cgu_name.as_str();
Symbol::intern(&CodegenUnit::mangle_name(cgu_name))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let restrict_msg = "consider further restricting this bound";
let param_name = self_ty.to_string();
for param in generics.params.iter().filter(|p| {
&param_name == std::convert::AsRef::<str>::as_ref(&p.name.ident().as_str())
p.name.ident().as_str() == param_name
}) {
if param_name.starts_with("impl ") {
// `impl Trait` in argument:
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/on_unimplemented.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl<'tcx> OnUnimplementedDirective {
c.ident().map_or(false, |ident| {
options.contains(&(
ident.name,
c.value_str().map(|s| s.as_str().to_string())
c.value_str().map(|s| s.to_string())
))
})
}) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl<'sess> OnDiskCache<'sess> {
let sorted_cnums = sorted_cnums_including_local_crate(tcx);
let prev_cnums: Vec<_> = sorted_cnums.iter()
.map(|&cnum| {
let crate_name = tcx.original_crate_name(cnum).as_str().to_string();
let crate_name = tcx.original_crate_name(cnum).to_string();
let crate_disambiguator = tcx.crate_disambiguator(cnum);
(cnum.as_u32(), crate_name, crate_disambiguator)
})
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ pub fn from_fn_attrs(
codegen_fn_attrs.target_features
.iter()
.map(|f| {
let feature = &*f.as_str();
let feature = &f.as_str();
format!("+{}", llvm_util::to_llvm_feature(cx.tcx.sess, feature))
})
)
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/debuginfo/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub fn item_namespace(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
});

let namespace_name = match def_key.disambiguated_data.data {
DefPathData::CrateRoot => cx.tcx.crate_name(def_id.krate).as_str(),
data => data.as_symbol().as_str()
DefPathData::CrateRoot => cx.tcx.crate_name(def_id.krate),
data => data.as_symbol()
};

let namespace_name = SmallCStr::new(&namespace_name);
let namespace_name = SmallCStr::new(&namespace_name.as_str());

let scope = unsafe {
llvm::LLVMRustDIBuilderCreateNameSpace(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Command {
}

pub fn sym_arg(&mut self, arg: Symbol) -> &mut Command {
self.arg(&arg.as_str());
self.arg(&*arg.as_str());
self
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_ssa/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ fn reachable_non_generics_provider(
//
// In general though we won't link right if these
// symbols are stripped, and LTO currently strips them.
if &*name == "rust_eh_personality" ||
&*name == "rust_eh_register_frames" ||
&*name == "rust_eh_unregister_frames" {
if name == "rust_eh_personality" ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be sym::s?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably replace most string literals with valid literals in them, in the compiler, with sym::s.

I'd try this if I was in front of my laptop:

rg '"[_a-zA-Z][_a-zA-Z0-9]*"' src/lib*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rust_eh_personality already is a symbol. We could add the other two. For all potential static symbols there is a decision about whether the identifier is hot enough or frequently used enough for it to be worthwhile, and that decision is not always clear-cut.

"Intern all the static strings" is a possibility, but it would add a lot more due to functions like this one:

let n = &*name.as_str();
let human_readable = match (n, value) {
("unix", None) => "Unix",
("windows", None) => "Windows",
("debug_assertions", None) => "debug-assertions enabled",
("target_os", Some(os)) => match &*os.as_str() {
"android" => "Android",
"dragonfly" => "DragonFly BSD",
"emscripten" => "Emscripten",
"freebsd" => "FreeBSD",
"fuchsia" => "Fuchsia",
"haiku" => "Haiku",
"ios" => "iOS",
"l4re" => "L4Re",
"linux" => "Linux",
"macos" => "macOS",
"netbsd" => "NetBSD",
"openbsd" => "OpenBSD",
"redox" => "Redox",
"solaris" => "Solaris",
"windows" => "Windows",
_ => "",
},
("target_arch", Some(arch)) => match &*arch.as_str() {
"aarch64" => "AArch64",
"arm" => "ARM",
"asmjs" => "JavaScript",
"mips" => "MIPS",
"mips64" => "MIPS-64",
"msp430" => "MSP430",
"powerpc" => "PowerPC",
"powerpc64" => "PowerPC-64",
"s390x" => "s390x",
"sparc64" => "SPARC64",
"wasm32" => "WebAssembly",
"x86" => "x86",
"x86_64" => "x86-64",
_ => "",
},
("target_vendor", Some(vendor)) => match &*vendor.as_str() {
"apple" => "Apple",
"pc" => "PC",
"rumprun" => "Rumprun",
"sun" => "Sun",
"fortanix" => "Fortanix",
_ => ""
},
("target_env", Some(env)) => match &*env.as_str() {
"gnu" => "GNU",
"msvc" => "MSVC",
"musl" => "musl",
"newlib" => "Newlib",
"uclibc" => "uClibc",
"sgx" => "SGX",
_ => "",
},
("target_endian", Some(endian)) => return write!(fmt, "{}-endian", endian),
("target_pointer_width", Some(bits)) => return write!(fmt, "{}-bit", bits),
("target_feature", Some(feat)) =>
if self.1 {
return write!(fmt, "<code>{}</code>", feat);
} else {
return write!(fmt, "target feature <code>{}</code>", feat);
},
_ => "",
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I should add: I have already converted all the static identifiers that I though were worth converting. Other people may reasonably think that more should be converted.)

name == "rust_eh_register_frames" ||
name == "rust_eh_unregister_frames" {
SymbolExportLevel::C
} else {
SymbolExportLevel::Rust
Expand Down
6 changes: 2 additions & 4 deletions src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
} else if let Some(kind) = *tcx.sess.allocator_kind.get() {
let llmod_id = cgu_name_builder.build_cgu_name(LOCAL_CRATE,
&["crate"],
Some("allocator")).as_str()
.to_string();
Some("allocator")).to_string();
let mut modules = backend.new_metadata(tcx, &llmod_id);
time(tcx.sess, "write allocator module", || {
backend.codegen_allocator(tcx, &mut modules, kind)
Expand All @@ -576,8 +575,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
// Codegen the encoded metadata.
let metadata_cgu_name = cgu_name_builder.build_cgu_name(LOCAL_CRATE,
&["crate"],
Some("metadata")).as_str()
.to_string();
Some("metadata")).to_string();
let mut metadata_llvm_module = backend.new_metadata(tcx, &metadata_cgu_name);
time(tcx.sess, "write compressed metadata", || {
backend.write_compressed_metadata(tcx, &ongoing_codegen.metadata,
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_codegen_utils/symbol_names/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ fn get_symbol_hash<'tcx>(
substs.hash_stable(&mut hcx, &mut hasher);

if let Some(instantiating_crate) = instantiating_crate {
(&tcx.original_crate_name(instantiating_crate).as_str()[..])
tcx.original_crate_name(instantiating_crate).as_str()
.hash_stable(&mut hcx, &mut hasher);
tcx.crate_disambiguator(instantiating_crate)
.hash_stable(&mut hcx, &mut hasher);
(&tcx.crate_disambiguator(instantiating_crate)).hash_stable(&mut hcx, &mut hasher);
}

// We want to avoid accidental collision between different types of instances.
Expand Down
16 changes: 6 additions & 10 deletions src/librustc_incremental/assert_module_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ use syntax::symbol::{Symbol, sym};
use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED,
ATTR_EXPECTED_CGU_REUSE};

const MODULE: Symbol = sym::module;
const CFG: Symbol = sym::cfg;
const KIND: Symbol = sym::kind;

pub fn assert_module_sources(tcx: TyCtxt<'_>) {
tcx.dep_graph.with_ignore(|| {
if tcx.sess.opts.incremental.is_none() {
Expand Down Expand Up @@ -71,7 +67,7 @@ impl AssertModuleSource<'tcx> {
} else if attr.check_name(ATTR_PARTITION_CODEGENED) {
(CguReuse::No, ComparisonKind::Exact)
} else if attr.check_name(ATTR_EXPECTED_CGU_REUSE) {
match &self.field(attr, KIND).as_str()[..] {
match &*self.field(attr, sym::kind).as_str() {
"no" => (CguReuse::No, ComparisonKind::Exact),
"pre-lto" => (CguReuse::PreLto, ComparisonKind::Exact),
"post-lto" => (CguReuse::PostLto, ComparisonKind::Exact),
Expand All @@ -98,8 +94,8 @@ impl AssertModuleSource<'tcx> {
return;
}

let user_path = self.field(attr, MODULE).as_str().to_string();
let crate_name = self.tcx.crate_name(LOCAL_CRATE).as_str().to_string();
let user_path = self.field(attr, sym::module).to_string();
let crate_name = self.tcx.crate_name(LOCAL_CRATE).to_string();

if !user_path.starts_with(&crate_name) {
let msg = format!("Found malformed codegen unit name `{}`. \
Expand All @@ -125,7 +121,7 @@ impl AssertModuleSource<'tcx> {
cgu_path_components,
cgu_special_suffix);

debug!("mapping '{}' to cgu name '{}'", self.field(attr, MODULE), cgu_name);
debug!("mapping '{}' to cgu name '{}'", self.field(attr, sym::module), cgu_name);

if !self.available_cgus.contains(&cgu_name) {
self.tcx.sess.span_err(attr.span,
Expand All @@ -135,7 +131,7 @@ impl AssertModuleSource<'tcx> {
cgu_name,
self.available_cgus
.iter()
.map(|cgu| cgu.as_str().to_string())
.map(|cgu| cgu.to_string())
.collect::<Vec<_>>()
.join(", ")));
}
Expand Down Expand Up @@ -169,7 +165,7 @@ impl AssertModuleSource<'tcx> {
/// cfg flag called `foo`.
fn check_config(&self, attr: &ast::Attribute) -> bool {
let config = &self.tcx.sess.parse_sess.config;
let value = self.field(attr, CFG);
let value = self.field(attr, sym::cfg);
debug!("check_config(config={:?}, value={:?})", config, value);
if config.iter().any(|&(name, _)| name == value) {
debug!("check_config: matched");
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_incremental/persist/dirty_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl DirtyCleanVisitor<'tcx> {
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
if item.check_name(LABEL) {
let value = expect_associated_value(self.tcx, &item);
return Some(self.resolve_labels(&item, value.as_str().as_ref()));
return Some(self.resolve_labels(&item, &value.as_str()));
}
}
None
Expand All @@ -314,7 +314,7 @@ impl DirtyCleanVisitor<'tcx> {
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
if item.check_name(EXCEPT) {
let value = expect_associated_value(self.tcx, &item);
return self.resolve_labels(&item, value.as_str().as_ref());
return self.resolve_labels(&item, &value.as_str());
}
}
// if no `label` or `except` is given, only the node's group are asserted
Expand Down
6 changes: 2 additions & 4 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,14 +1476,12 @@ impl KeywordIdents {
let mut lint = cx.struct_span_lint(
KEYWORD_IDENTS,
ident.span,
&format!("`{}` is a keyword in the {} edition",
ident.as_str(),
next_edition),
&format!("`{}` is a keyword in the {} edition", ident, next_edition),
);
lint.span_suggestion(
ident.span,
"you can use a raw identifier to stay compatible",
format!("r#{}", ident.as_str()),
format!("r#{}", ident),
Applicability::MachineApplicable,
);
lint.emit()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl<'a> CrateLoader<'a> {
// `source` stores paths which are normalized which may be different
// from the strings on the command line.
let source = &self.cstore.get_crate_data(cnum).source;
if let Some(entry) = self.sess.opts.externs.get(&*name.as_str()) {
if let Some(entry) = self.sess.opts.externs.get(&name.as_str()) {
// Only use `--extern crate_name=path` here, not `--extern crate_name`.
let found = entry.locations.iter().filter_map(|l| l.as_ref()).any(|l| {
let l = fs::canonicalize(l).ok();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl ItemLikeVisitor<'tcx> for Collector<'tcx> {
Some(name) => name,
None => continue, // skip like historical compilers
};
lib.kind = match &kind.as_str()[..] {
lib.kind = match &*kind.as_str() {
"static" => cstore::NativeStatic,
"static-nobundle" => cstore::NativeStaticNobundle,
"dylib" => cstore::NativeUnknown,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let mut err = self.cannot_borrow_across_destructor(borrow_span);

let what_was_dropped = match self.describe_place(place.as_ref()) {
Some(name) => format!("`{}`", name.as_str()),
Some(name) => format!("`{}`", name),
None => String::from("temporary value"),
};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
) -> InterpResult<'tcx, bool> {
let substs = instance.substs;

let intrinsic_name = &self.tcx.item_name(instance.def_id()).as_str()[..];
let intrinsic_name = &*self.tcx.item_name(instance.def_id()).as_str();
match intrinsic_name {
"caller_location" => {
let caller = self.tcx.sess.source_map().lookup_char_pos(span.lo());
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_mir/transform/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,17 +642,17 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) {
struct_span_err!(
tcx.sess, source_info.span, E0133,
"{} is unsafe and requires unsafe function or block", description)
.span_label(source_info.span, &description.as_str()[..])
.note(&details.as_str()[..])
.span_label(source_info.span, &*description.as_str())
.note(&details.as_str())
.emit();
}
UnsafetyViolationKind::ExternStatic(lint_hir_id) => {
tcx.lint_node_note(SAFE_EXTERN_STATICS,
lint_hir_id,
source_info.span,
&format!("{} is unsafe and requires unsafe function or block \
(error E0133)", &description.as_str()[..]),
&details.as_str()[..]);
(error E0133)", description),
&details.as_str());
}
UnsafetyViolationKind::BorrowPacked(lint_hir_id) => {
if let Some(impl_def_id) = builtin_derive_def_id(tcx, def_id) {
Expand All @@ -662,8 +662,8 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) {
lint_hir_id,
source_info.span,
&format!("{} is unsafe and requires unsafe function or block \
(error E0133)", &description.as_str()[..]),
&details.as_str()[..]);
(error E0133)", description),
&details.as_str());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ impl Qualif for IsNotPromotable {
Abi::RustIntrinsic |
Abi::PlatformIntrinsic => {
assert!(!cx.tcx.is_const_fn(def_id));
match &cx.tcx.item_name(def_id).as_str()[..] {
match &*cx.tcx.item_name(def_id).as_str() {
| "size_of"
| "min_align_of"
| "needs_drop"
Expand Down Expand Up @@ -1476,7 +1476,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
Abi::RustIntrinsic |
Abi::PlatformIntrinsic => {
assert!(!self.tcx.is_const_fn(def_id));
match &self.tcx.item_name(def_id).as_str()[..] {
match &*self.tcx.item_name(def_id).as_str() {
// special intrinsic that can be called diretly without an intrinsic
// feature gate needs a language feature gate
"transmute" => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ fn check_terminator(
///
/// Adding more intrinsics requires sign-off from @rust-lang/lang.
fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
match &tcx.item_name(def_id).as_str()[..] {
match &*tcx.item_name(def_id).as_str() {
| "size_of"
| "min_align_of"
| "needs_drop"
Expand Down
Loading