aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock8
-rw-r--r--crates/completion/src/completions/qualified_path.rs34
-rw-r--r--crates/hir/src/code_model.rs20
-rw-r--r--crates/hir/src/from_id.rs21
-rw-r--r--crates/hir/src/semantics.rs2
-rw-r--r--crates/hir/src/source_analyzer.rs9
-rw-r--r--crates/hir_def/src/resolver.rs1
-rw-r--r--crates/hir_ty/src/lib.rs10
-rw-r--r--crates/hir_ty/src/lower.rs14
-rw-r--r--crates/ide/src/doc_links.rs5
-rw-r--r--crates/ide/src/hover.rs2
-rw-r--r--crates/proc_macro_srv/Cargo.toml2
-rw-r--r--crates/proc_macro_srv/src/dylib.rs4
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs2
-rw-r--r--docs/dev/lsp-extensions.md2
15 files changed, 98 insertions, 38 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 25f312faf..99b7ccf69 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -791,9 +791,9 @@ checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
791 791
792[[package]] 792[[package]]
793name = "libloading" 793name = "libloading"
794version = "0.6.7" 794version = "0.7.0"
795source = "registry+https://github.com/rust-lang/crates.io-index" 795source = "registry+https://github.com/rust-lang/crates.io-index"
796checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" 796checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a"
797dependencies = [ 797dependencies = [
798 "cfg-if", 798 "cfg-if",
799 "winapi", 799 "winapi",
@@ -1841,9 +1841,9 @@ dependencies = [
1841 1841
1842[[package]] 1842[[package]]
1843name = "unicode-normalization" 1843name = "unicode-normalization"
1844version = "0.1.16" 1844version = "0.1.17"
1845source = "registry+https://github.com/rust-lang/crates.io-index" 1845source = "registry+https://github.com/rust-lang/crates.io-index"
1846checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" 1846checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef"
1847dependencies = [ 1847dependencies = [
1848 "tinyvec", 1848 "tinyvec",
1849] 1849]
diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/completion/src/completions/qualified_path.rs
index bbeaab496..2afa6979e 100644
--- a/crates/completion/src/completions/qualified_path.rs
+++ b/crates/completion/src/completions/qualified_path.rs
@@ -50,7 +50,8 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
50 } 50 }
51 } 51 }
52 PathResolution::Def(def @ hir::ModuleDef::Adt(_)) 52 PathResolution::Def(def @ hir::ModuleDef::Adt(_))
53 | PathResolution::Def(def @ hir::ModuleDef::TypeAlias(_)) => { 53 | PathResolution::Def(def @ hir::ModuleDef::TypeAlias(_))
54 | PathResolution::Def(def @ hir::ModuleDef::BuiltinType(_)) => {
54 if let hir::ModuleDef::Adt(Adt::Enum(e)) = def { 55 if let hir::ModuleDef::Adt(Adt::Enum(e)) = def {
55 for variant in e.variants(ctx.db) { 56 for variant in e.variants(ctx.db) {
56 acc.add_enum_variant(ctx, variant, None); 57 acc.add_enum_variant(ctx, variant, None);
@@ -59,6 +60,13 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
59 let ty = match def { 60 let ty = match def {
60 hir::ModuleDef::Adt(adt) => adt.ty(ctx.db), 61 hir::ModuleDef::Adt(adt) => adt.ty(ctx.db),
61 hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db), 62 hir::ModuleDef::TypeAlias(a) => a.ty(ctx.db),
63 hir::ModuleDef::BuiltinType(builtin) => {
64 let module = match ctx.scope.module() {
65 Some(it) => it,
66 None => return,
67 };
68 builtin.ty(ctx.db, module)
69 }
62 _ => unreachable!(), 70 _ => unreachable!(),
63 }; 71 };
64 72
@@ -780,4 +788,28 @@ impl Foo {
780 "#]], 788 "#]],
781 ); 789 );
782 } 790 }
791
792 #[test]
793 fn completes_primitive_assoc_const() {
794 check(
795 r#"
796//- /lib.rs crate:lib deps:core
797fn f() {
798 u8::$0
799}
800
801//- /core.rs crate:core
802#[lang = "u8"]
803impl u8 {
804 pub const MAX: Self = 255;
805
806 pub fn func(self) {}
807}
808"#,
809 expect![[r#"
810 ct MAX pub const MAX: Self = 255;
811 me func(…) -> ()
812 "#]],
813 );
814 }
783} 815}
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index e9bb4f541..35b532602 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -6,7 +6,6 @@ use base_db::{CrateDisplayName, CrateId, Edition, FileId};
6use either::Either; 6use either::Either;
7use hir_def::{ 7use hir_def::{
8 adt::{ReprKind, StructKind, VariantData}, 8 adt::{ReprKind, StructKind, VariantData},
9 builtin_type::BuiltinType,
10 expr::{BindingAnnotation, LabelId, Pat, PatId}, 9 expr::{BindingAnnotation, LabelId, Pat, PatId},
11 import_map, 10 import_map,
12 item_tree::ItemTreeNode, 11 item_tree::ItemTreeNode,
@@ -245,7 +244,7 @@ impl ModuleDef {
245 ModuleDef::Const(it) => it.name(db), 244 ModuleDef::Const(it) => it.name(db),
246 ModuleDef::Static(it) => it.name(db), 245 ModuleDef::Static(it) => it.name(db),
247 246
248 ModuleDef::BuiltinType(it) => Some(it.as_name()), 247 ModuleDef::BuiltinType(it) => Some(it.name()),
249 } 248 }
250 } 249 }
251 250
@@ -995,6 +994,23 @@ impl HasVisibility for TypeAlias {
995} 994}
996 995
997#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 996#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
997pub struct BuiltinType {
998 pub(crate) inner: hir_def::builtin_type::BuiltinType,
999}
1000
1001impl BuiltinType {
1002 pub fn ty(self, db: &dyn HirDatabase, module: Module) -> Type {
1003 let resolver = module.id.resolver(db.upcast());
1004 Type::new_with_resolver(db, &resolver, Ty::builtin(self.inner))
1005 .expect("crate not present in resolver")
1006 }
1007
1008 pub fn name(self) -> Name {
1009 self.inner.as_name()
1010 }
1011}
1012
1013#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
998pub struct MacroDef { 1014pub struct MacroDef {
999 pub(crate) id: MacroDefId, 1015 pub(crate) id: MacroDefId,
1000} 1016}
diff --git a/crates/hir/src/from_id.rs b/crates/hir/src/from_id.rs
index c8c5fecd7..b5814da11 100644
--- a/crates/hir/src/from_id.rs
+++ b/crates/hir/src/from_id.rs
@@ -11,8 +11,9 @@ use hir_def::{
11}; 11};
12 12
13use crate::{ 13use crate::{
14 code_model::GenericParam, Adt, AssocItem, DefWithBody, Field, GenericDef, Label, Local, 14 code_model::{BuiltinType, GenericParam},
15 MacroDef, ModuleDef, Variant, VariantDef, 15 Adt, AssocItem, DefWithBody, Field, GenericDef, Label, Local, MacroDef, ModuleDef, Variant,
16 VariantDef,
16}; 17};
17 18
18macro_rules! from_id { 19macro_rules! from_id {
@@ -111,7 +112,7 @@ impl From<ModuleDefId> for ModuleDef {
111 ModuleDefId::StaticId(it) => ModuleDef::Static(it.into()), 112 ModuleDefId::StaticId(it) => ModuleDef::Static(it.into()),
112 ModuleDefId::TraitId(it) => ModuleDef::Trait(it.into()), 113 ModuleDefId::TraitId(it) => ModuleDef::Trait(it.into()),
113 ModuleDefId::TypeAliasId(it) => ModuleDef::TypeAlias(it.into()), 114 ModuleDefId::TypeAliasId(it) => ModuleDef::TypeAlias(it.into()),
114 ModuleDefId::BuiltinType(it) => ModuleDef::BuiltinType(it), 115 ModuleDefId::BuiltinType(it) => ModuleDef::BuiltinType(it.into()),
115 } 116 }
116 } 117 }
117} 118}
@@ -127,7 +128,7 @@ impl From<ModuleDef> for ModuleDefId {
127 ModuleDef::Static(it) => ModuleDefId::StaticId(it.into()), 128 ModuleDef::Static(it) => ModuleDefId::StaticId(it.into()),
128 ModuleDef::Trait(it) => ModuleDefId::TraitId(it.into()), 129 ModuleDef::Trait(it) => ModuleDefId::TraitId(it.into()),
129 ModuleDef::TypeAlias(it) => ModuleDefId::TypeAliasId(it.into()), 130 ModuleDef::TypeAlias(it) => ModuleDefId::TypeAliasId(it.into()),
130 ModuleDef::BuiltinType(it) => ModuleDefId::BuiltinType(it), 131 ModuleDef::BuiltinType(it) => ModuleDefId::BuiltinType(it.into()),
131 } 132 }
132 } 133 }
133} 134}
@@ -274,3 +275,15 @@ impl From<ModuleDef> for ItemInNs {
274 } 275 }
275 } 276 }
276} 277}
278
279impl From<hir_def::builtin_type::BuiltinType> for BuiltinType {
280 fn from(inner: hir_def::builtin_type::BuiltinType) -> Self {
281 Self { inner }
282 }
283}
284
285impl From<BuiltinType> for hir_def::builtin_type::BuiltinType {
286 fn from(it: BuiltinType) -> Self {
287 it.inner
288 }
289}
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 0a30b4f5b..59292d5a2 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -49,7 +49,7 @@ impl PathResolution {
49 match self { 49 match self {
50 PathResolution::Def(ModuleDef::Adt(adt)) => Some(TypeNs::AdtId((*adt).into())), 50 PathResolution::Def(ModuleDef::Adt(adt)) => Some(TypeNs::AdtId((*adt).into())),
51 PathResolution::Def(ModuleDef::BuiltinType(builtin)) => { 51 PathResolution::Def(ModuleDef::BuiltinType(builtin)) => {
52 Some(TypeNs::BuiltinType(*builtin)) 52 Some(TypeNs::BuiltinType((*builtin).into()))
53 } 53 }
54 PathResolution::Def(ModuleDef::Const(_)) 54 PathResolution::Def(ModuleDef::Const(_))
55 | PathResolution::Def(ModuleDef::Variant(_)) 55 | PathResolution::Def(ModuleDef::Variant(_))
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index bed3fa50f..dc21f6051 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -28,8 +28,9 @@ use syntax::{
28}; 28};
29 29
30use crate::{ 30use crate::{
31 db::HirDatabase, semantics::PathResolution, Adt, Const, Field, Function, Local, MacroDef, 31 code_model::BuiltinType, db::HirDatabase, semantics::PathResolution, Adt, Const, Field,
32 ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Variant, 32 Function, Local, MacroDef, ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam,
33 Variant,
33}; 34};
34use base_db::CrateId; 35use base_db::CrateId;
35 36
@@ -479,7 +480,7 @@ fn resolve_hir_path_(
479 } 480 }
480 TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()), 481 TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
481 TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()), 482 TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()),
482 TypeNs::BuiltinType(it) => PathResolution::Def(it.into()), 483 TypeNs::BuiltinType(it) => PathResolution::Def(BuiltinType::from(it).into()),
483 TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()), 484 TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()),
484 }) 485 })
485 }; 486 };
@@ -555,7 +556,7 @@ fn resolve_hir_path_qualifier(
555 TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => PathResolution::Def(Adt::from(it).into()), 556 TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => PathResolution::Def(Adt::from(it).into()),
556 TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()), 557 TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
557 TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()), 558 TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()),
558 TypeNs::BuiltinType(it) => PathResolution::Def(it.into()), 559 TypeNs::BuiltinType(it) => PathResolution::Def(BuiltinType::from(it).into()),
559 TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()), 560 TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()),
560 }) 561 })
561} 562}
diff --git a/crates/hir_def/src/resolver.rs b/crates/hir_def/src/resolver.rs
index a8467c88e..e85f85e49 100644
--- a/crates/hir_def/src/resolver.rs
+++ b/crates/hir_def/src/resolver.rs
@@ -361,6 +361,7 @@ impl Resolver {
361 } 361 }
362 362
363 pub fn krate(&self) -> Option<CrateId> { 363 pub fn krate(&self) -> Option<CrateId> {
364 // FIXME: can this ever be `None`?
364 self.module_scope().map(|t| t.0.krate()) 365 self.module_scope().map(|t| t.0.krate())
365 } 366 }
366 367
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 6bec389f8..50d248674 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -27,6 +27,7 @@ use std::{iter, mem, ops::Deref, sync::Arc};
27 27
28use base_db::{salsa, CrateId}; 28use base_db::{salsa, CrateId};
29use hir_def::{ 29use hir_def::{
30 builtin_type::BuiltinType,
30 expr::ExprId, 31 expr::ExprId,
31 type_ref::{Mutability, Rawness}, 32 type_ref::{Mutability, Rawness},
32 AdtId, AssocContainerId, DefWithBodyId, FunctionId, GenericDefId, HasModule, LifetimeParamId, 33 AdtId, AssocContainerId, DefWithBodyId, FunctionId, GenericDefId, HasModule, LifetimeParamId,
@@ -738,6 +739,15 @@ impl Ty {
738 Substs(sig.params_and_return), 739 Substs(sig.params_and_return),
739 ) 740 )
740 } 741 }
742 pub fn builtin(builtin: BuiltinType) -> Self {
743 Ty::simple(match builtin {
744 BuiltinType::Char => TypeCtor::Char,
745 BuiltinType::Bool => TypeCtor::Bool,
746 BuiltinType::Str => TypeCtor::Str,
747 BuiltinType::Int(t) => TypeCtor::Int(IntTy::from(t).into()),
748 BuiltinType::Float(t) => TypeCtor::Float(FloatTy::from(t).into()),
749 })
750 }
741 751
742 pub fn as_reference(&self) -> Option<(&Ty, Mutability)> { 752 pub fn as_reference(&self) -> Option<(&Ty, Mutability)> {
743 match self { 753 match self {
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index dfb573ff3..f9dc832bd 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -27,7 +27,6 @@ use test_utils::mark;
27 27
28use crate::{ 28use crate::{
29 db::HirDatabase, 29 db::HirDatabase,
30 primitive::{FloatTy, IntTy},
31 utils::{ 30 utils::{
32 all_super_trait_refs, associated_type_by_name_including_super_traits, generics, 31 all_super_trait_refs, associated_type_by_name_including_super_traits, generics,
33 make_mut_slice, variant_data, 32 make_mut_slice, variant_data,
@@ -1051,17 +1050,6 @@ fn type_for_static(db: &dyn HirDatabase, def: StaticId) -> Binders<Ty> {
1051 Binders::new(0, Ty::from_hir(&ctx, &data.type_ref)) 1050 Binders::new(0, Ty::from_hir(&ctx, &data.type_ref))
1052} 1051}
1053 1052
1054/// Build the declared type of a static.
1055fn type_for_builtin(def: BuiltinType) -> Ty {
1056 Ty::simple(match def {
1057 BuiltinType::Char => TypeCtor::Char,
1058 BuiltinType::Bool => TypeCtor::Bool,
1059 BuiltinType::Str => TypeCtor::Str,
1060 BuiltinType::Int(t) => TypeCtor::Int(IntTy::from(t).into()),
1061 BuiltinType::Float(t) => TypeCtor::Float(FloatTy::from(t).into()),
1062 })
1063}
1064
1065fn fn_sig_for_struct_constructor(db: &dyn HirDatabase, def: StructId) -> PolyFnSig { 1053fn fn_sig_for_struct_constructor(db: &dyn HirDatabase, def: StructId) -> PolyFnSig {
1066 let struct_data = db.struct_data(def); 1054 let struct_data = db.struct_data(def);
1067 let fields = struct_data.variant_data.fields(); 1055 let fields = struct_data.variant_data.fields();
@@ -1186,7 +1174,7 @@ impl_from!(FunctionId, StructId, UnionId, EnumVariantId, ConstId, StaticId for V
1186/// namespace. 1174/// namespace.
1187pub(crate) fn ty_query(db: &dyn HirDatabase, def: TyDefId) -> Binders<Ty> { 1175pub(crate) fn ty_query(db: &dyn HirDatabase, def: TyDefId) -> Binders<Ty> {
1188 match def { 1176 match def {
1189 TyDefId::BuiltinType(it) => Binders::new(0, type_for_builtin(it)), 1177 TyDefId::BuiltinType(it) => Binders::new(0, Ty::builtin(it)),
1190 TyDefId::AdtId(it) => type_for_adt(db, it), 1178 TyDefId::AdtId(it) => type_for_adt(db, it),
1191 TyDefId::TypeAliasId(it) => type_for_type_alias(db, it), 1179 TyDefId::TypeAliasId(it) => type_for_type_alias(db, it),
1192 } 1180 }
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 730e0dd0a..f94adec9b 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -9,8 +9,7 @@ use url::Url;
9 9
10use hir::{ 10use hir::{
11 db::{DefDatabase, HirDatabase}, 11 db::{DefDatabase, HirDatabase},
12 Adt, AsAssocItem, AsName, AssocItem, AssocItemContainer, Crate, Field, HasAttrs, ItemInNs, 12 Adt, AsAssocItem, AssocItem, AssocItemContainer, Crate, Field, HasAttrs, ItemInNs, ModuleDef,
13 ModuleDef,
14}; 13};
15use ide_db::{ 14use ide_db::{
16 defs::{Definition, NameClass, NameRefClass}, 15 defs::{Definition, NameClass, NameRefClass},
@@ -429,7 +428,7 @@ fn get_symbol_filename(db: &dyn HirDatabase, definition: &ModuleDef) -> Option<S
429 ModuleDef::Module(_) => "index.html".to_string(), 428 ModuleDef::Module(_) => "index.html".to_string(),
430 ModuleDef::Trait(t) => format!("trait.{}.html", t.name(db)), 429 ModuleDef::Trait(t) => format!("trait.{}.html", t.name(db)),
431 ModuleDef::TypeAlias(t) => format!("type.{}.html", t.name(db)), 430 ModuleDef::TypeAlias(t) => format!("type.{}.html", t.name(db)),
432 ModuleDef::BuiltinType(t) => format!("primitive.{}.html", t.as_name()), 431 ModuleDef::BuiltinType(t) => format!("primitive.{}.html", t.name()),
433 ModuleDef::Function(f) => format!("fn.{}.html", f.name(db)), 432 ModuleDef::Function(f) => format!("fn.{}.html", f.name(db)),
434 ModuleDef::Variant(ev) => { 433 ModuleDef::Variant(ev) => {
435 format!("enum.{}.html#variant.{}", ev.parent_enum(db).name(db), ev.name(db)) 434 format!("enum.{}.html#variant.{}", ev.parent_enum(db).name(db), ev.name(db))
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 5d2d072b1..00745238a 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -334,7 +334,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
334 ModuleDef::Static(it) => from_def_source(db, it, mod_path), 334 ModuleDef::Static(it) => from_def_source(db, it, mod_path),
335 ModuleDef::Trait(it) => from_def_source(db, it, mod_path), 335 ModuleDef::Trait(it) => from_def_source(db, it, mod_path),
336 ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path), 336 ModuleDef::TypeAlias(it) => from_def_source(db, it, mod_path),
337 ModuleDef::BuiltinType(it) => Some(Markup::fenced_block(&it)), 337 ModuleDef::BuiltinType(it) => Some(Markup::fenced_block(&it.name())),
338 }, 338 },
339 Definition::Local(it) => Some(Markup::fenced_block(&it.ty(db).display(db))), 339 Definition::Local(it) => Some(Markup::fenced_block(&it.ty(db).display(db))),
340 Definition::SelfType(impl_def) => { 340 Definition::SelfType(impl_def) => {
diff --git a/crates/proc_macro_srv/Cargo.toml b/crates/proc_macro_srv/Cargo.toml
index 208489e0d..6c8c28980 100644
--- a/crates/proc_macro_srv/Cargo.toml
+++ b/crates/proc_macro_srv/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
11 11
12[dependencies] 12[dependencies]
13object = { version = "0.23", default-features = false, features = ["std", "read_core", "elf", "macho", "pe"] } 13object = { version = "0.23", default-features = false, features = ["std", "read_core", "elf", "macho", "pe"] }
14libloading = "0.6.0" 14libloading = "0.7.0"
15memmap2 = "0.2.0" 15memmap2 = "0.2.0"
16 16
17tt = { path = "../tt", version = "0.0.0" } 17tt = { path = "../tt", version = "0.0.0" }
diff --git a/crates/proc_macro_srv/src/dylib.rs b/crates/proc_macro_srv/src/dylib.rs
index 00fcc7bdf..28a6ee547 100644
--- a/crates/proc_macro_srv/src/dylib.rs
+++ b/crates/proc_macro_srv/src/dylib.rs
@@ -60,7 +60,7 @@ fn find_registrar_symbol(file: &Path) -> io::Result<Option<String>> {
60/// It seems that on Windows that behaviour is default, so we do nothing in that case. 60/// It seems that on Windows that behaviour is default, so we do nothing in that case.
61#[cfg(windows)] 61#[cfg(windows)]
62fn load_library(file: &Path) -> Result<Library, libloading::Error> { 62fn load_library(file: &Path) -> Result<Library, libloading::Error> {
63 Library::new(file) 63 unsafe { Library::new(file) }
64} 64}
65 65
66#[cfg(unix)] 66#[cfg(unix)]
@@ -71,7 +71,7 @@ fn load_library(file: &Path) -> Result<Library, libloading::Error> {
71 const RTLD_NOW: c_int = 0x00002; 71 const RTLD_NOW: c_int = 0x00002;
72 const RTLD_DEEPBIND: c_int = 0x00008; 72 const RTLD_DEEPBIND: c_int = 0x00008;
73 73
74 UnixLibrary::open(Some(file), RTLD_NOW | RTLD_DEEPBIND).map(|lib| lib.into()) 74 unsafe { UnixLibrary::open(Some(file), RTLD_NOW | RTLD_DEEPBIND).map(|lib| lib.into()) }
75} 75}
76 76
77struct ProcMacroLibraryLibloading { 77struct ProcMacroLibraryLibloading {
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs
index 670ca9a45..ce5a0e822 100644
--- a/crates/rust-analyzer/src/lsp_ext.rs
+++ b/crates/rust-analyzer/src/lsp_ext.rs
@@ -230,8 +230,8 @@ pub struct SsrParams {
230 230
231pub enum StatusNotification {} 231pub enum StatusNotification {}
232 232
233#[serde(rename_all = "camelCase")]
234#[derive(Serialize, Deserialize)] 233#[derive(Serialize, Deserialize)]
234#[serde(rename_all = "camelCase")]
235pub enum Status { 235pub enum Status {
236 Loading, 236 Loading,
237 ReadyPartial, 237 ReadyPartial,
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index b2defa737..2a966a96d 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
1<!--- 1<!---
2lsp_ext.rs hash: 7609fd6d7b4ab231 2lsp_ext.rs hash: 8f1ae8530f69e3a3
3 3
4If you need to change the above hash to make the test pass, please check if you 4If you need to change the above hash to make the test pass, please check if you
5need to adjust this doc as well and ping this issue: 5need to adjust this doc as well and ping this issue: