mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-25 11:17:13 +00:00
Fix 2024 syntax errors
This commit is contained in:
parent
71ff7fbe22
commit
aad66c7bf1
@ -117,7 +117,7 @@ impl VariantShape {
|
||||
quote! {span => #it : #mapped , }
|
||||
});
|
||||
quote! {span =>
|
||||
#path { ##fields }
|
||||
#path { # #fields }
|
||||
}
|
||||
}
|
||||
&VariantShape::Tuple(n) => {
|
||||
@ -128,7 +128,7 @@ impl VariantShape {
|
||||
}
|
||||
});
|
||||
quote! {span =>
|
||||
#path ( ##fields )
|
||||
#path ( # #fields )
|
||||
}
|
||||
}
|
||||
VariantShape::Unit => path,
|
||||
@ -523,7 +523,7 @@ fn expand_simple_derive_with_parsed(
|
||||
|
||||
let name = info.name;
|
||||
quote! {invoc_span =>
|
||||
impl < ##params #extra_impl_params > #trait_path for #name < ##args > where ##where_block { #trait_body }
|
||||
impl < # #params #extra_impl_params > #trait_path for #name < # #args > where # #where_block { #trait_body }
|
||||
}
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ fn clone_expand(
|
||||
quote! {span =>
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
##arms
|
||||
# #arms
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -650,7 +650,7 @@ fn debug_expand(
|
||||
}
|
||||
});
|
||||
quote! {span =>
|
||||
f.debug_struct(#name) ##for_fields .finish()
|
||||
f.debug_struct(#name) # #for_fields .finish()
|
||||
}
|
||||
}
|
||||
VariantShape::Tuple(n) => {
|
||||
@ -660,7 +660,7 @@ fn debug_expand(
|
||||
}
|
||||
});
|
||||
quote! {span =>
|
||||
f.debug_tuple(#name) ##for_fields .finish()
|
||||
f.debug_tuple(#name) # #for_fields .finish()
|
||||
}
|
||||
}
|
||||
VariantShape::Unit => quote! {span =>
|
||||
@ -703,7 +703,7 @@ fn debug_expand(
|
||||
quote! {span =>
|
||||
fn fmt(&self, f: &mut #krate::fmt::Formatter) -> #krate::fmt::Result {
|
||||
match self {
|
||||
##arms
|
||||
# #arms
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -736,7 +736,7 @@ fn hash_expand(
|
||||
let it =
|
||||
names.iter().map(|it| quote! {span => #it . hash(ra_expand_state); });
|
||||
quote! {span => {
|
||||
##it
|
||||
# #it
|
||||
} }
|
||||
};
|
||||
let fat_arrow = fat_arrow(span);
|
||||
@ -754,7 +754,7 @@ fn hash_expand(
|
||||
fn hash<H: #krate::hash::Hasher>(&self, ra_expand_state: &mut H) {
|
||||
#check_discriminant
|
||||
match self {
|
||||
##arms
|
||||
# #arms
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -803,7 +803,7 @@ fn partial_eq_expand(
|
||||
let t2 = tt::Ident::new(&format!("{}_other", first.sym), first.span);
|
||||
quote!(span =>#t1 .eq( #t2 ))
|
||||
};
|
||||
quote!(span =>#first ##rest)
|
||||
quote!(span =>#first # #rest)
|
||||
}
|
||||
};
|
||||
quote! {span => ( #pat1 , #pat2 ) #fat_arrow #body , }
|
||||
@ -814,7 +814,7 @@ fn partial_eq_expand(
|
||||
quote! {span =>
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
##arms
|
||||
# #arms
|
||||
_unused #fat_arrow false
|
||||
}
|
||||
}
|
||||
@ -891,7 +891,7 @@ fn ord_expand(
|
||||
let fat_arrow = fat_arrow(span);
|
||||
let mut body = quote! {span =>
|
||||
match (self, other) {
|
||||
##arms
|
||||
# #arms
|
||||
_unused #fat_arrow #krate::cmp::Ordering::Equal
|
||||
}
|
||||
};
|
||||
@ -961,7 +961,7 @@ fn partial_ord_expand(
|
||||
right,
|
||||
quote! {span =>
|
||||
match (self, other) {
|
||||
##arms
|
||||
# #arms
|
||||
_unused #fat_arrow #krate::option::Option::Some(#krate::cmp::Ordering::Equal)
|
||||
}
|
||||
},
|
||||
|
@ -240,9 +240,9 @@ fn assert_expand(
|
||||
let dollar_crate = dollar_crate(span);
|
||||
let panic_args = rest.iter();
|
||||
let mac = if use_panic_2021(db, span) {
|
||||
quote! {call_site_span => #dollar_crate::panic::panic_2021!(##panic_args) }
|
||||
quote! {call_site_span => #dollar_crate::panic::panic_2021!(# #panic_args) }
|
||||
} else {
|
||||
quote! {call_site_span => #dollar_crate::panic!(##panic_args) }
|
||||
quote! {call_site_span => #dollar_crate::panic!(# #panic_args) }
|
||||
};
|
||||
let value = cond.value;
|
||||
let expanded = quote! {call_site_span =>{
|
||||
|
@ -61,7 +61,7 @@ macro_rules! quote_impl__ {
|
||||
$crate::builtin::quote::__quote!($span $builder $($tail)*);
|
||||
};
|
||||
|
||||
($span:ident $builder:ident ## $first:ident $($tail:tt)* ) => {{
|
||||
($span:ident $builder:ident # # $first:ident $($tail:tt)* ) => {{
|
||||
::std::iter::IntoIterator::into_iter($first).for_each(|it| $crate::builtin::quote::ToTokenTree::to_tokens(it, $span, $builder));
|
||||
$crate::builtin::quote::__quote!($span $builder $($tail)*);
|
||||
}};
|
||||
|
@ -518,7 +518,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||
let Some(def) = self.owner.as_generic_def_id(self.db.upcast()) else {
|
||||
not_supported!("owner without generic def id");
|
||||
};
|
||||
let gen = generics(self.db.upcast(), def);
|
||||
let generics = generics(self.db.upcast(), def);
|
||||
let ty = self.expr_ty_without_adjust(expr_id);
|
||||
self.push_assignment(
|
||||
current,
|
||||
@ -528,7 +528,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||
ty,
|
||||
value: chalk_ir::ConstValue::BoundVar(BoundVar::new(
|
||||
DebruijnIndex::INNERMOST,
|
||||
gen.type_or_const_param_idx(p.into()).ok_or(
|
||||
generics.type_or_const_param_idx(p.into()).ok_or(
|
||||
MirLowerError::TypeError(
|
||||
"fail to lower const generic param",
|
||||
),
|
||||
|
@ -5261,7 +5261,7 @@ impl Type {
|
||||
|
||||
/// Returns types that this type dereferences to (including this type itself). The returned
|
||||
/// iterator won't yield the same type more than once even if the deref chain contains a cycle.
|
||||
pub fn autoderef(&self, db: &dyn HirDatabase) -> impl Iterator<Item = Type> + '_ {
|
||||
pub fn autoderef<'db>(&self, db: &'db dyn HirDatabase) -> impl Iterator<Item = Type> + use<'_, 'db> {
|
||||
self.autoderef_(db).map(move |ty| self.derived(ty))
|
||||
}
|
||||
|
||||
@ -5637,7 +5637,10 @@ impl Type {
|
||||
.map(Trait::from)
|
||||
}
|
||||
|
||||
pub fn as_impl_traits(&self, db: &dyn HirDatabase) -> Option<impl Iterator<Item = Trait>> {
|
||||
pub fn as_impl_traits(
|
||||
&self,
|
||||
db: &dyn HirDatabase,
|
||||
) -> Option<impl Iterator<Item = Trait> + use<>> {
|
||||
self.ty.impl_trait_bounds(db).map(|it| {
|
||||
it.into_iter().filter_map(|pred| match pred.skip_binders() {
|
||||
hir_ty::WhereClause::Implemented(trait_ref) => {
|
||||
|
@ -2087,7 +2087,7 @@ impl SemanticsScope<'_> {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn resolve_mod_path(&self, path: &ModPath) -> impl Iterator<Item = ItemInNs> {
|
||||
pub fn resolve_mod_path(&self, path: &ModPath) -> impl Iterator<Item = ItemInNs> + use<> {
|
||||
let items = self.resolver.resolve_module_path_in_items(self.db.upcast(), path);
|
||||
items.iter_items().map(|(item, _)| item.into())
|
||||
}
|
||||
|
@ -780,7 +780,8 @@ fn fill_lint_attrs(
|
||||
}
|
||||
});
|
||||
|
||||
let all_matching_groups = lint_groups(&diag.code, edition)
|
||||
let lints = lint_groups(&diag.code, edition);
|
||||
let all_matching_groups = lints
|
||||
.iter()
|
||||
.filter_map(|lint_group| cached.get(lint_group));
|
||||
let cached_severity =
|
||||
|
@ -268,13 +268,13 @@ fn hints_(
|
||||
ctx.lifetime_stacks.iter().flat_map(|it| it.iter()).cloned().zip(iter::repeat(0)).collect();
|
||||
// allocate names
|
||||
let mut gen_idx_name = {
|
||||
let mut gen = (0u8..).map(|idx| match idx {
|
||||
let mut generic = (0u8..).map(|idx| match idx {
|
||||
idx if idx < 10 => SmolStr::from_iter(['\'', (idx + 48) as char]),
|
||||
idx => format_smolstr!("'{idx}"),
|
||||
});
|
||||
let ctx = &*ctx;
|
||||
move || {
|
||||
gen.by_ref()
|
||||
generic.by_ref()
|
||||
.find(|s| ctx.lifetime_stacks.iter().flat_map(|it| it.iter()).all(|n| n != s))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
@ -123,13 +123,15 @@ fn setup_logging(log_file_flag: Option<PathBuf>) -> anyhow::Result<()> {
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-syminitialize
|
||||
if let Ok(path) = env::current_exe() {
|
||||
if let Some(path) = path.parent() {
|
||||
env::set_var("_NT_SYMBOL_PATH", path);
|
||||
// SAFETY: This is safe because this is single-threaded.
|
||||
unsafe { env::set_var("_NT_SYMBOL_PATH", path); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if env::var("RUST_BACKTRACE").is_err() {
|
||||
env::set_var("RUST_BACKTRACE", "short");
|
||||
// SAFETY: This is safe because this is single-threaded.
|
||||
unsafe { env::set_var("RUST_BACKTRACE", "short"); }
|
||||
}
|
||||
|
||||
let log_file = env::var("RA_LOG_FILE").ok().map(PathBuf::from).or(log_file_flag);
|
||||
|
@ -148,7 +148,8 @@ impl Project<'_> {
|
||||
let guard = CONFIG_DIR_LOCK.lock();
|
||||
let test_dir = TestDir::new();
|
||||
let value = test_dir.path().to_owned();
|
||||
env::set_var("__TEST_RA_USER_CONFIG_DIR", &value);
|
||||
// SAFETY: This is safe because this is single-threaded.
|
||||
unsafe { env::set_var("__TEST_RA_USER_CONFIG_DIR", &value); }
|
||||
(guard, test_dir)
|
||||
})
|
||||
} else {
|
||||
|
@ -1066,7 +1066,7 @@ impl ast::GenericParamList {
|
||||
ast::GenericParam::TypeParam(_) | ast::GenericParam::ConstParam(_) => None,
|
||||
})
|
||||
}
|
||||
pub fn type_or_const_params(&self) -> impl Iterator<Item = ast::TypeOrConstParam> {
|
||||
pub fn type_or_const_params(&self) -> impl Iterator<Item = ast::TypeOrConstParam> + use<> {
|
||||
self.generic_params().filter_map(|param| match param {
|
||||
ast::GenericParam::TypeParam(it) => Some(ast::TypeOrConstParam::Type(it)),
|
||||
ast::GenericParam::LifetimeParam(_) => None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user