mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 02:29:44 +00:00
Merge pull request #19644 from ChayimFriedman2/const-syms
internal: Make predefined symbols `const` instead of `static`
This commit is contained in:
commit
34e7d60e30
72 changed files with 432 additions and 473 deletions
|
|
@ -631,8 +631,7 @@ fn enum_variants_with_paths(
|
|||
let mut process_variant = |variant: Variant| {
|
||||
let self_path = hir::ModPath::from_segments(
|
||||
hir::PathKind::Plain,
|
||||
iter::once(Name::new_symbol_root(sym::Self_.clone()))
|
||||
.chain(iter::once(variant.name(ctx.db))),
|
||||
iter::once(Name::new_symbol_root(sym::Self_)).chain(iter::once(variant.name(ctx.db))),
|
||||
);
|
||||
|
||||
cb(acc, ctx, variant, self_path);
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ pub(crate) fn complete_expr_path(
|
|||
path_ctx,
|
||||
strukt,
|
||||
None,
|
||||
Some(Name::new_symbol_root(sym::Self_.clone())),
|
||||
Some(Name::new_symbol_root(sym::Self_)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ pub(crate) fn complete_expr_path(
|
|||
ctx,
|
||||
un,
|
||||
None,
|
||||
Some(Name::new_symbol_root(sym::Self_.clone())),
|
||||
Some(Name::new_symbol_root(sym::Self_)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ pub(crate) fn complete_lifetime(
|
|||
acc.add_lifetime(ctx, name);
|
||||
}
|
||||
});
|
||||
acc.add_lifetime(ctx, Name::new_symbol_root(sym::tick_static.clone()));
|
||||
acc.add_lifetime(ctx, Name::new_symbol_root(sym::tick_static));
|
||||
if !in_lifetime_param_bound
|
||||
&& def.is_some_and(|def| {
|
||||
!matches!(def, hir::GenericDef::Function(_) | hir::GenericDef::Impl(_))
|
||||
})
|
||||
{
|
||||
acc.add_lifetime(ctx, Name::new_symbol_root(sym::tick_underscore.clone()));
|
||||
acc.add_lifetime(ctx, Name::new_symbol_root(sym::tick_underscore));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ impl<'a> RenderContext<'a> {
|
|||
|
||||
fn is_deprecated(&self, def: impl HasAttrs) -> bool {
|
||||
let attrs = def.attrs(self.db());
|
||||
attrs.by_key(&sym::deprecated).exists()
|
||||
attrs.by_key(sym::deprecated).exists()
|
||||
}
|
||||
|
||||
fn is_deprecated_assoc_item(&self, as_assoc_item: impl AsAssocItem) -> bool {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ pub(crate) fn visible_fields(
|
|||
.copied()
|
||||
.collect::<Vec<_>>();
|
||||
let has_invisible_field = n_fields - fields.len() > 0;
|
||||
let is_foreign_non_exhaustive = item.attrs(ctx.db).by_key(&sym::non_exhaustive).exists()
|
||||
let is_foreign_non_exhaustive = item.attrs(ctx.db).by_key(sym::non_exhaustive).exists()
|
||||
&& item.krate(ctx.db) != module.krate();
|
||||
let fields_omitted = has_invisible_field || is_foreign_non_exhaustive;
|
||||
Some((fields, fields_omitted))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue