Skip to content

Commit 0160933

Browse files
committed
Auto merge of #150015 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@3d78b3f. Created using https://github.com/rust-lang/josh-sync. r? `@ghost`
2 parents ee44706 + 4e8f58c commit 0160933

File tree

75 files changed

+3069
-1496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3069
-1496
lines changed

src/tools/rust-analyzer/crates/base-db/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,28 @@ macro_rules! impl_intern_key {
6464
};
6565
}
6666

67+
/// # SAFETY
68+
///
69+
/// `old_pointer` must be valid for unique writes
70+
pub unsafe fn unsafe_update_eq<T>(old_pointer: *mut T, new_value: T) -> bool
71+
where
72+
T: PartialEq,
73+
{
74+
// SAFETY: Caller obligation
75+
let old_ref: &mut T = unsafe { &mut *old_pointer };
76+
77+
if *old_ref != new_value {
78+
*old_ref = new_value;
79+
true
80+
} else {
81+
// Subtle but important: Eq impls can be buggy or define equality
82+
// in surprising ways. If it says that the value has not changed,
83+
// we do not modify the existing value, and thus do not have to
84+
// update the revision, as downstream code will not see the new value.
85+
false
86+
}
87+
}
88+
6789
pub const DEFAULT_FILE_TEXT_LRU_CAP: u16 = 16;
6890
pub const DEFAULT_PARSE_LRU_CAP: u16 = 128;
6991
pub const DEFAULT_BORROWCK_LRU_CAP: u16 = 2024;

src/tools/rust-analyzer/crates/hir-def/src/attrs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ fn match_attr_flags(attr_flags: &mut AttrFlags, attr: Meta) -> ControlFlow<Infal
155155
"rustc_skip_during_method_dispatch" => {
156156
extract_rustc_skip_during_method_dispatch(attr_flags, tt)
157157
}
158+
"rustc_deprecated_safe_2024" => {
159+
attr_flags.insert(AttrFlags::RUSTC_DEPRECATED_SAFE_2024)
160+
}
158161
_ => {}
159162
},
160163
2 => match path.segments[0].text() {

src/tools/rust-analyzer/crates/hir-def/src/db.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ use la_arena::ArenaMap;
88
use triomphe::Arc;
99

1010
use crate::{
11-
AssocItemId, AttrDefId, ConstId, ConstLoc, DefWithBodyId, EnumId, EnumLoc, EnumVariantId,
12-
EnumVariantLoc, ExternBlockId, ExternBlockLoc, ExternCrateId, ExternCrateLoc, FunctionId,
13-
FunctionLoc, GenericDefId, ImplId, ImplLoc, LocalFieldId, Macro2Id, Macro2Loc, MacroExpander,
14-
MacroId, MacroRulesId, MacroRulesLoc, MacroRulesLocFlags, ProcMacroId, ProcMacroLoc, StaticId,
15-
StaticLoc, StructId, StructLoc, TraitId, TraitLoc, TypeAliasId, TypeAliasLoc, UnionId,
16-
UnionLoc, UseId, UseLoc, VariantId,
11+
AssocItemId, AttrDefId, BlockId, BlockLoc, ConstId, ConstLoc, DefWithBodyId, EnumId, EnumLoc,
12+
EnumVariantId, EnumVariantLoc, ExternBlockId, ExternBlockLoc, ExternCrateId, ExternCrateLoc,
13+
FunctionId, FunctionLoc, GenericDefId, ImplId, ImplLoc, LocalFieldId, Macro2Id, Macro2Loc,
14+
MacroExpander, MacroId, MacroRulesId, MacroRulesLoc, MacroRulesLocFlags, ProcMacroId,
15+
ProcMacroLoc, StaticId, StaticLoc, StructId, StructLoc, TraitId, TraitLoc, TypeAliasId,
16+
TypeAliasLoc, UnionId, UnionLoc, UseId, UseLoc, VariantId,
1717
attrs::AttrFlags,
1818
expr_store::{
1919
Body, BodySourceMap, ExpressionStore, ExpressionStoreSourceMap, scope::ExprScopes,
@@ -82,6 +82,9 @@ pub trait InternDatabase: RootQueryDb {
8282
#[salsa::interned]
8383
fn intern_macro_rules(&self, loc: MacroRulesLoc) -> MacroRulesId;
8484
// endregion: items
85+
86+
#[salsa::interned]
87+
fn intern_block(&self, loc: BlockLoc) -> BlockId;
8588
}
8689

8790
#[query_group::query_group]

0 commit comments

Comments
 (0)