Auto merge of #60910 - nnethercote:avoid-some-unnecessary-interning, r=petrochenkov
Avoid some unnecessary interning r? @petrochenkov
This commit is contained in:
commit
548add7f61
16 changed files with 67 additions and 49 deletions
|
|
@ -2218,7 +2218,7 @@ impl<'a> LoweringContext<'a> {
|
|||
bindings: hir_vec![
|
||||
hir::TypeBinding {
|
||||
hir_id: this.next_id(),
|
||||
ident: Ident::from_str(FN_OUTPUT_NAME),
|
||||
ident: Ident::with_empty_ctxt(FN_OUTPUT_NAME),
|
||||
ty: output
|
||||
.as_ref()
|
||||
.map(|ty| this.lower_ty(&ty, ImplTraitContext::disallowed()))
|
||||
|
|
@ -2543,7 +2543,7 @@ impl<'a> LoweringContext<'a> {
|
|||
let future_params = P(hir::GenericArgs {
|
||||
args: hir_vec![],
|
||||
bindings: hir_vec![hir::TypeBinding {
|
||||
ident: Ident::from_str(FN_OUTPUT_NAME),
|
||||
ident: Ident::with_empty_ctxt(FN_OUTPUT_NAME),
|
||||
ty: output_ty,
|
||||
hir_id: self.next_id(),
|
||||
span,
|
||||
|
|
@ -4801,7 +4801,7 @@ impl<'a> LoweringContext<'a> {
|
|||
let attr = {
|
||||
// `allow(unreachable_code)`
|
||||
let allow = {
|
||||
let allow_ident = Ident::from_str("allow").with_span_pos(e.span);
|
||||
let allow_ident = Ident::with_empty_ctxt(sym::allow).with_span_pos(e.span);
|
||||
let uc_ident = Ident::from_str("unreachable_code").with_span_pos(e.span);
|
||||
let uc_nested = attr::mk_nested_word_item(uc_ident);
|
||||
attr::mk_list_item(e.span, allow_ident, vec![uc_nested])
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use std::fmt::Write;
|
|||
use std::hash::Hash;
|
||||
use syntax::ast;
|
||||
use syntax::ext::hygiene::Mark;
|
||||
use syntax::symbol::{Symbol, InternedString};
|
||||
use syntax::symbol::{Symbol, sym, InternedString};
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
use crate::util::nodemap::NodeMap;
|
||||
|
||||
|
|
@ -584,16 +584,16 @@ impl DefPathData {
|
|||
return name
|
||||
}
|
||||
// note that this does not show up in user printouts
|
||||
CrateRoot => "{{crate}}",
|
||||
Impl => "{{impl}}",
|
||||
Misc => "{{misc}}",
|
||||
ClosureExpr => "{{closure}}",
|
||||
Ctor => "{{constructor}}",
|
||||
AnonConst => "{{constant}}",
|
||||
ImplTrait => "{{opaque}}",
|
||||
CrateRoot => sym::double_braced_crate,
|
||||
Impl => sym::double_braced_impl,
|
||||
Misc => sym::double_braced_misc,
|
||||
ClosureExpr => sym::double_braced_closure,
|
||||
Ctor => sym::double_braced_constructor,
|
||||
AnonConst => sym::double_braced_constant,
|
||||
ImplTrait => sym::double_braced_opaque,
|
||||
};
|
||||
|
||||
Symbol::intern(s).as_interned_str()
|
||||
s.as_interned_str()
|
||||
}
|
||||
|
||||
pub fn to_string(&self) -> String {
|
||||
|
|
|
|||
|
|
@ -1421,7 +1421,7 @@ fn confirm_callable_candidate<'cx, 'gcx, 'tcx>(
|
|||
projection_ty: ty::ProjectionTy::from_ref_and_name(
|
||||
tcx,
|
||||
trait_ref,
|
||||
Ident::from_str(FN_OUTPUT_NAME),
|
||||
Ident::with_empty_ctxt(FN_OUTPUT_NAME),
|
||||
),
|
||||
ty: ret_type
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use std::time::{Duration, Instant};
|
|||
|
||||
use std::sync::mpsc::{Sender};
|
||||
use syntax_pos::{SpanData};
|
||||
use syntax::symbol::{Symbol, sym};
|
||||
use rustc_macros::HashStable;
|
||||
use crate::ty::TyCtxt;
|
||||
use crate::dep_graph::{DepNode};
|
||||
|
|
@ -18,7 +19,7 @@ use lazy_static;
|
|||
use crate::session::Session;
|
||||
|
||||
// The name of the associated type for `Fn` return types
|
||||
pub const FN_OUTPUT_NAME: &str = "Output";
|
||||
pub const FN_OUTPUT_NAME: Symbol = sym::Output;
|
||||
|
||||
// Useful type to use with `Result<>` indicate that an error has already
|
||||
// been reported to the user, so no need to continue checking.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue