Move is_gensymed
from Symbol
to Ident
.
Note that the `is_gensymed` call on `primitive_types` is unnecessary because that table only contains the name of primitive types (e.g. `i32`) and never contains gensyms.
This commit is contained in:
parent
128b4c8035
commit
f6637f3fcc
4 changed files with 10 additions and 15 deletions
|
@ -4225,7 +4225,7 @@ impl<'a> Resolver<'a> {
|
||||||
let add_module_candidates = |module: Module<'_>, names: &mut Vec<TypoSuggestion>| {
|
let add_module_candidates = |module: Module<'_>, names: &mut Vec<TypoSuggestion>| {
|
||||||
for (&(ident, _), resolution) in module.resolutions.borrow().iter() {
|
for (&(ident, _), resolution) in module.resolutions.borrow().iter() {
|
||||||
if let Some(binding) = resolution.borrow().binding {
|
if let Some(binding) = resolution.borrow().binding {
|
||||||
if !ident.name.is_gensymed() && filter_fn(binding.res()) {
|
if !ident.is_gensymed() && filter_fn(binding.res()) {
|
||||||
names.push(TypoSuggestion {
|
names.push(TypoSuggestion {
|
||||||
candidate: ident.name,
|
candidate: ident.name,
|
||||||
article: binding.res().article(),
|
article: binding.res().article(),
|
||||||
|
@ -4243,7 +4243,7 @@ impl<'a> Resolver<'a> {
|
||||||
for rib in self.ribs[ns].iter().rev() {
|
for rib in self.ribs[ns].iter().rev() {
|
||||||
// Locals and type parameters
|
// Locals and type parameters
|
||||||
for (ident, &res) in &rib.bindings {
|
for (ident, &res) in &rib.bindings {
|
||||||
if !ident.name.is_gensymed() && filter_fn(res) {
|
if !ident.is_gensymed() && filter_fn(res) {
|
||||||
names.push(TypoSuggestion {
|
names.push(TypoSuggestion {
|
||||||
candidate: ident.name,
|
candidate: ident.name,
|
||||||
article: res.article(),
|
article: res.article(),
|
||||||
|
@ -4273,7 +4273,7 @@ impl<'a> Resolver<'a> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if !ident.name.is_gensymed() && filter_fn(crate_mod) {
|
if !ident.is_gensymed() && filter_fn(crate_mod) {
|
||||||
Some(TypoSuggestion {
|
Some(TypoSuggestion {
|
||||||
candidate: ident.name,
|
candidate: ident.name,
|
||||||
article: "a",
|
article: "a",
|
||||||
|
@ -4298,7 +4298,6 @@ impl<'a> Resolver<'a> {
|
||||||
names.extend(
|
names.extend(
|
||||||
self.primitive_type_table.primitive_types
|
self.primitive_type_table.primitive_types
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(name, _)| !name.is_gensymed())
|
|
||||||
.map(|(name, _)| {
|
.map(|(name, _)| {
|
||||||
TypoSuggestion {
|
TypoSuggestion {
|
||||||
candidate: *name,
|
candidate: *name,
|
||||||
|
|
|
@ -1395,7 +1395,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
|
||||||
// so they can cause name conflict errors downstream.
|
// so they can cause name conflict errors downstream.
|
||||||
let is_good_import = binding.is_import() && !binding.is_ambiguity() &&
|
let is_good_import = binding.is_import() && !binding.is_ambiguity() &&
|
||||||
// Note that as_str() de-gensyms the Symbol
|
// Note that as_str() de-gensyms the Symbol
|
||||||
!(ident.name.is_gensymed() && ident.name.as_str() != "_");
|
!(ident.is_gensymed() && ident.name.as_str() != "_");
|
||||||
if is_good_import || binding.is_macro_def() {
|
if is_good_import || binding.is_macro_def() {
|
||||||
let res = binding.res();
|
let res = binding.res();
|
||||||
if res != Res::Err {
|
if res != Res::Err {
|
||||||
|
|
|
@ -72,11 +72,7 @@ pub struct Path {
|
||||||
impl PartialEq<Symbol> for Path {
|
impl PartialEq<Symbol> for Path {
|
||||||
fn eq(&self, symbol: &Symbol) -> bool {
|
fn eq(&self, symbol: &Symbol) -> bool {
|
||||||
self.segments.len() == 1 && {
|
self.segments.len() == 1 && {
|
||||||
let name = self.segments[0].ident.name;
|
self.segments[0].ident.name == *symbol
|
||||||
// Make sure these symbols are pure strings
|
|
||||||
debug_assert!(!symbol.is_gensymed());
|
|
||||||
debug_assert!(!name.is_gensymed());
|
|
||||||
name == *symbol
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,6 +684,11 @@ impl Ident {
|
||||||
if self.name == keywords::Underscore.name() { self.gensym() } else { self }
|
if self.name == keywords::Underscore.name() { self.gensym() } else { self }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WARNING: this function is deprecated and will be removed in the future.
|
||||||
|
pub fn is_gensymed(self) -> bool {
|
||||||
|
with_interner(|interner| interner.is_gensymed(self.name))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn as_str(self) -> LocalInternedString {
|
pub fn as_str(self) -> LocalInternedString {
|
||||||
self.name.as_str()
|
self.name.as_str()
|
||||||
}
|
}
|
||||||
|
@ -786,11 +791,6 @@ impl Symbol {
|
||||||
with_interner(|interner| interner.gensymed(self))
|
with_interner(|interner| interner.gensymed(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARNING: this function is deprecated and will be removed in the future.
|
|
||||||
pub fn is_gensymed(self) -> bool {
|
|
||||||
with_interner(|interner| interner.is_gensymed(self))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn as_str(self) -> LocalInternedString {
|
pub fn as_str(self) -> LocalInternedString {
|
||||||
with_interner(|interner| unsafe {
|
with_interner(|interner| unsafe {
|
||||||
LocalInternedString {
|
LocalInternedString {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue