aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml2
-rw-r--r--.github/workflows/metrics.yaml2
-rw-r--r--.github/workflows/release.yaml2
-rw-r--r--.github/workflows/rustdoc.yaml2
-rw-r--r--crates/assists/src/utils/import_assets.rs6
-rw-r--r--crates/assists/src/utils/insert_use.rs4
-rw-r--r--crates/completion/src/completions/postfix/format_like.rs6
-rw-r--r--crates/hir/src/code_model.rs14
-rw-r--r--crates/hir/src/from_id.rs8
-rw-r--r--crates/hir/src/has_source.rs3
-rw-r--r--crates/hir/src/lib.rs3
-rw-r--r--crates/hir_def/src/body/diagnostics.rs4
-rw-r--r--crates/hir_expand/src/test_db.rs2
-rw-r--r--crates/hir_ty/src/infer.rs2
-rw-r--r--crates/hir_ty/src/infer/unify.rs2
-rw-r--r--crates/hir_ty/src/traits/chalk.rs2
-rw-r--r--crates/hir_ty/src/traits/chalk/interner.rs30
-rw-r--r--crates/hir_ty/src/traits/chalk/mapping.rs6
-rw-r--r--crates/ide/src/diagnostics/fixes.rs2
-rw-r--r--crates/ide/src/doc_links.rs9
-rw-r--r--crates/ide/src/file_structure.rs2
-rw-r--r--crates/ide/src/join_lines.rs2
-rw-r--r--crates/ide/src/lib.rs14
-rw-r--r--crates/ide/src/markdown_remove.rs3
-rw-r--r--crates/ide/src/matching_brace.rs2
-rw-r--r--crates/ide/src/references.rs8
-rw-r--r--crates/ide/src/syntax_highlighting.rs9
-rw-r--r--crates/mbe/src/subtree_source.rs2
-rw-r--r--crates/project_model/src/cargo_workspace.rs4
-rw-r--r--crates/project_model/src/sysroot.rs2
-rw-r--r--crates/rust-analyzer/src/bin/main.rs2
-rw-r--r--crates/rust-analyzer/src/cli/progress_report.rs16
-rw-r--r--crates/rust-analyzer/src/document.rs4
-rw-r--r--crates/rust-analyzer/src/global_state.rs2
-rw-r--r--crates/rust-analyzer/src/semantic_tokens.rs10
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/support.rs28
-rw-r--r--crates/rust-analyzer/tests/rust-analyzer/testdir.rs8
-rw-r--r--crates/ssr/src/parsing.rs2
-rw-r--r--crates/vfs/src/vfs_path.rs4
39 files changed, 114 insertions, 121 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 83b1d33a1..1850068a3 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -12,7 +12,7 @@ env:
12 CARGO_NET_RETRY: 10 12 CARGO_NET_RETRY: 10
13 CI: 1 13 CI: 1
14 RUST_BACKTRACE: short 14 RUST_BACKTRACE: short
15 RUSTFLAGS: "-D warnings " # -W unreachable-pub" 15 RUSTFLAGS: "-D warnings -W unreachable-pub"
16 RUSTUP_MAX_RETRIES: 10 16 RUSTUP_MAX_RETRIES: 10
17 17
18jobs: 18jobs:
diff --git a/.github/workflows/metrics.yaml b/.github/workflows/metrics.yaml
index 72050a527..d189ce9c9 100644
--- a/.github/workflows/metrics.yaml
+++ b/.github/workflows/metrics.yaml
@@ -7,7 +7,7 @@ on:
7env: 7env:
8 CARGO_INCREMENTAL: 0 8 CARGO_INCREMENTAL: 0
9 CARGO_NET_RETRY: 10 9 CARGO_NET_RETRY: 10
10 RUSTFLAGS: "-D warnings " # -W unreachable-pub" 10 RUSTFLAGS: "-D warnings -W unreachable-pub"
11 RUSTUP_MAX_RETRIES: 10 11 RUSTUP_MAX_RETRIES: 10
12 12
13jobs: 13jobs:
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index fbefbd9eb..919d58925 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -11,7 +11,7 @@ on:
11env: 11env:
12 CARGO_INCREMENTAL: 0 12 CARGO_INCREMENTAL: 0
13 CARGO_NET_RETRY: 10 13 CARGO_NET_RETRY: 10
14 RUSTFLAGS: "-D warnings " # -W unreachable-pub" 14 RUSTFLAGS: "-D warnings -W unreachable-pub"
15 RUSTUP_MAX_RETRIES: 10 15 RUSTUP_MAX_RETRIES: 10
16 16
17jobs: 17jobs:
diff --git a/.github/workflows/rustdoc.yaml b/.github/workflows/rustdoc.yaml
index 29ca3d3b2..897f64df0 100644
--- a/.github/workflows/rustdoc.yaml
+++ b/.github/workflows/rustdoc.yaml
@@ -7,7 +7,7 @@ on:
7env: 7env:
8 CARGO_INCREMENTAL: 0 8 CARGO_INCREMENTAL: 0
9 CARGO_NET_RETRY: 10 9 CARGO_NET_RETRY: 10
10 RUSTFLAGS: "-D warnings " # -W unreachable-pub" 10 RUSTFLAGS: "-D warnings -W unreachable-pub"
11 RUSTUP_MAX_RETRIES: 10 11 RUSTUP_MAX_RETRIES: 10
12 12
13jobs: 13jobs:
diff --git a/crates/assists/src/utils/import_assets.rs b/crates/assists/src/utils/import_assets.rs
index 23db3a74b..f47edbb76 100644
--- a/crates/assists/src/utils/import_assets.rs
+++ b/crates/assists/src/utils/import_assets.rs
@@ -26,13 +26,13 @@ pub(crate) enum ImportCandidate {
26 26
27#[derive(Debug)] 27#[derive(Debug)]
28pub(crate) struct TraitImportCandidate { 28pub(crate) struct TraitImportCandidate {
29 pub ty: hir::Type, 29 pub(crate) ty: hir::Type,
30 pub name: ast::NameRef, 30 pub(crate) name: ast::NameRef,
31} 31}
32 32
33#[derive(Debug)] 33#[derive(Debug)]
34pub(crate) struct PathImportCandidate { 34pub(crate) struct PathImportCandidate {
35 pub name: ast::NameRef, 35 pub(crate) name: ast::NameRef,
36} 36}
37 37
38#[derive(Debug)] 38#[derive(Debug)]
diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs
index 033fbcedc..a76bd5ebf 100644
--- a/crates/assists/src/utils/insert_use.rs
+++ b/crates/assists/src/utils/insert_use.rs
@@ -17,13 +17,13 @@ use syntax::{
17use test_utils::mark; 17use test_utils::mark;
18 18
19#[derive(Debug)] 19#[derive(Debug)]
20pub enum ImportScope { 20pub(crate) enum ImportScope {
21 File(ast::SourceFile), 21 File(ast::SourceFile),
22 Module(ast::ItemList), 22 Module(ast::ItemList),
23} 23}
24 24
25impl ImportScope { 25impl ImportScope {
26 pub fn from(syntax: SyntaxNode) -> Option<Self> { 26 pub(crate) fn from(syntax: SyntaxNode) -> Option<Self> {
27 if let Some(module) = ast::Module::cast(syntax.clone()) { 27 if let Some(module) = ast::Module::cast(syntax.clone()) {
28 module.item_list().map(ImportScope::Module) 28 module.item_list().map(ImportScope::Module)
29 } else if let this @ Some(_) = ast::SourceFile::cast(syntax.clone()) { 29 } else if let this @ Some(_) = ast::SourceFile::cast(syntax.clone()) {
diff --git a/crates/completion/src/completions/postfix/format_like.rs b/crates/completion/src/completions/postfix/format_like.rs
index f35114ed1..88ba86acb 100644
--- a/crates/completion/src/completions/postfix/format_like.rs
+++ b/crates/completion/src/completions/postfix/format_like.rs
@@ -88,7 +88,7 @@ enum State {
88} 88}
89 89
90impl FormatStrParser { 90impl FormatStrParser {
91 pub fn new(input: String) -> Self { 91 pub(crate) fn new(input: String) -> Self {
92 Self { 92 Self {
93 input: input.into(), 93 input: input.into(),
94 output: String::new(), 94 output: String::new(),
@@ -98,7 +98,7 @@ impl FormatStrParser {
98 } 98 }
99 } 99 }
100 100
101 pub fn parse(&mut self) -> Result<(), ()> { 101 pub(crate) fn parse(&mut self) -> Result<(), ()> {
102 let mut current_expr = String::new(); 102 let mut current_expr = String::new();
103 103
104 let mut placeholder_id = 1; 104 let mut placeholder_id = 1;
@@ -194,7 +194,7 @@ impl FormatStrParser {
194 Ok(()) 194 Ok(())
195 } 195 }
196 196
197 pub fn into_suggestion(&self, macro_name: &str) -> String { 197 pub(crate) fn into_suggestion(&self, macro_name: &str) -> String {
198 assert!(self.parsed, "Attempt to get a suggestion from not parsed expression"); 198 assert!(self.parsed, "Attempt to get a suggestion from not parsed expression");
199 199
200 let expressions_as_string = self.extracted_expressions.join(", "); 200 let expressions_as_string = self.extracted_expressions.join(", ");
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 563145f92..30a5e4580 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -4,7 +4,6 @@ use std::{iter, sync::Arc};
4use arrayvec::ArrayVec; 4use arrayvec::ArrayVec;
5use base_db::{CrateDisplayName, CrateId, Edition, FileId}; 5use base_db::{CrateDisplayName, CrateId, Edition, FileId};
6use either::Either; 6use either::Either;
7use hir_def::find_path::PrefixKind;
8use hir_def::{ 7use hir_def::{
9 adt::ReprKind, 8 adt::ReprKind,
10 adt::StructKind, 9 adt::StructKind,
@@ -12,16 +11,18 @@ use hir_def::{
12 builtin_type::BuiltinType, 11 builtin_type::BuiltinType,
13 expr::{BindingAnnotation, Pat, PatId}, 12 expr::{BindingAnnotation, Pat, PatId},
14 import_map, 13 import_map,
14 item_tree::ItemTreeNode,
15 lang_item::LangItemTarget, 15 lang_item::LangItemTarget,
16 path::ModPath, 16 path::ModPath,
17 per_ns::PerNs, 17 per_ns::PerNs,
18 resolver::{HasResolver, Resolver}, 18 resolver::{HasResolver, Resolver},
19 src::HasSource as _, 19 src::HasSource as _,
20 type_ref::{Mutability, TypeRef}, 20 type_ref::{Mutability, TypeRef},
21 AdtId, AssocContainerId, AttrDefId, ConstId, DefWithBodyId, EnumId, FunctionId, GenericDefId, 21 AdtId, AssocContainerId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, DefWithBodyId, EnumId,
22 HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId, Lookup, ModuleId, StaticId, 22 FunctionId, GenericDefId, HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId,
23 StructId, TraitId, TypeAliasId, TypeParamId, UnionId, 23 Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, TypeParamId, UnionId,
24}; 24};
25use hir_def::{find_path::PrefixKind, item_scope::ItemInNs, visibility::Visibility};
25use hir_expand::{ 26use hir_expand::{
26 diagnostics::DiagnosticSink, 27 diagnostics::DiagnosticSink,
27 name::{name, AsName}, 28 name::{name, AsName},
@@ -275,11 +276,6 @@ impl ModuleDef {
275 } 276 }
276} 277}
277 278
278pub use hir_def::{
279 attr::Attrs, item_scope::ItemInNs, item_tree::ItemTreeNode, visibility::Visibility,
280 AssocItemId, AssocItemLoc,
281};
282
283impl Module { 279impl Module {
284 pub(crate) fn new(krate: Crate, crate_module_id: LocalModuleId) -> Module { 280 pub(crate) fn new(krate: Crate, crate_module_id: LocalModuleId) -> Module {
285 Module { id: ModuleId { krate: krate.id, local_id: crate_module_id } } 281 Module { id: ModuleId { krate: krate.id, local_id: crate_module_id } }
diff --git a/crates/hir/src/from_id.rs b/crates/hir/src/from_id.rs
index 033f53ac2..265ef6d1f 100644
--- a/crates/hir/src/from_id.rs
+++ b/crates/hir/src/from_id.rs
@@ -4,13 +4,13 @@
4//! are splitting the hir. 4//! are splitting the hir.
5 5
6use hir_def::{ 6use hir_def::{
7 expr::PatId, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId, GenericDefId, 7 expr::PatId, item_scope::ItemInNs, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId,
8 ModuleDefId, VariantId, 8 GenericDefId, ModuleDefId, VariantId,
9}; 9};
10 10
11use crate::{ 11use crate::{
12 code_model::ItemInNs, Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, 12 Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, MacroDef, ModuleDef,
13 MacroDef, ModuleDef, VariantDef, 13 VariantDef,
14}; 14};
15 15
16macro_rules! from_id { 16macro_rules! from_id {
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 3bad2338a..c77494152 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -6,6 +6,7 @@ use hir_def::{
6 src::{HasChildSource, HasSource as _}, 6 src::{HasChildSource, HasSource as _},
7 Lookup, VariantId, 7 Lookup, VariantId,
8}; 8};
9use hir_expand::InFile;
9use syntax::ast; 10use syntax::ast;
10 11
11use crate::{ 12use crate::{
@@ -13,8 +14,6 @@ use crate::{
13 Module, Static, Struct, Trait, TypeAlias, TypeParam, Union, 14 Module, Static, Struct, Trait, TypeAlias, TypeParam, Union,
14}; 15};
15 16
16pub use hir_expand::InFile;
17
18pub trait HasSource { 17pub trait HasSource {
19 type Ast; 18 type Ast;
20 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>; 19 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>;
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 4094a76cb..0d184379f 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -36,7 +36,7 @@ pub use crate::{
36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const, 36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const,
37 Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function, 37 Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function,
38 GenericDef, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, 38 GenericDef, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static,
39 Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility, 39 Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
40 }, 40 },
41 has_source::HasSource, 41 has_source::HasSource,
42 semantics::{original_range, PathResolution, Semantics, SemanticsScope}, 42 semantics::{original_range, PathResolution, Semantics, SemanticsScope},
@@ -53,6 +53,7 @@ pub use hir_def::{
53 nameres::ModuleSource, 53 nameres::ModuleSource,
54 path::{ModPath, PathKind}, 54 path::{ModPath, PathKind},
55 type_ref::{Mutability, TypeRef}, 55 type_ref::{Mutability, TypeRef},
56 visibility::Visibility,
56}; 57};
57pub use hir_expand::{ 58pub use hir_expand::{
58 name::known, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, 59 name::known, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc,
diff --git a/crates/hir_def/src/body/diagnostics.rs b/crates/hir_def/src/body/diagnostics.rs
index cfa47d189..e57bdc133 100644
--- a/crates/hir_def/src/body/diagnostics.rs
+++ b/crates/hir_def/src/body/diagnostics.rs
@@ -5,12 +5,12 @@ use hir_expand::diagnostics::DiagnosticSink;
5use crate::diagnostics::InactiveCode; 5use crate::diagnostics::InactiveCode;
6 6
7#[derive(Debug, Eq, PartialEq)] 7#[derive(Debug, Eq, PartialEq)]
8pub enum BodyDiagnostic { 8pub(crate) enum BodyDiagnostic {
9 InactiveCode(InactiveCode), 9 InactiveCode(InactiveCode),
10} 10}
11 11
12impl BodyDiagnostic { 12impl BodyDiagnostic {
13 pub fn add_to(&self, sink: &mut DiagnosticSink<'_>) { 13 pub(crate) fn add_to(&self, sink: &mut DiagnosticSink<'_>) {
14 match self { 14 match self {
15 BodyDiagnostic::InactiveCode(diag) => { 15 BodyDiagnostic::InactiveCode(diag) => {
16 sink.push(diag.clone()); 16 sink.push(diag.clone());
diff --git a/crates/hir_expand/src/test_db.rs b/crates/hir_expand/src/test_db.rs
index 86a5d867e..fca501e1f 100644
--- a/crates/hir_expand/src/test_db.rs
+++ b/crates/hir_expand/src/test_db.rs
@@ -14,7 +14,7 @@ use rustc_hash::FxHashSet;
14 crate::db::AstDatabaseStorage 14 crate::db::AstDatabaseStorage
15)] 15)]
16#[derive(Default)] 16#[derive(Default)]
17pub struct TestDB { 17pub(crate) struct TestDB {
18 storage: salsa::Storage<TestDB>, 18 storage: salsa::Storage<TestDB>,
19 events: Mutex<Option<Vec<salsa::Event>>>, 19 events: Mutex<Option<Vec<salsa::Event>>>,
20} 20}
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
index f4c1fa2f2..a14d67c06 100644
--- a/crates/hir_ty/src/infer.rs
+++ b/crates/hir_ty/src/infer.rs
@@ -94,7 +94,7 @@ enum BindingMode {
94} 94}
95 95
96impl BindingMode { 96impl BindingMode {
97 pub fn convert(annotation: BindingAnnotation) -> BindingMode { 97 fn convert(annotation: BindingAnnotation) -> BindingMode {
98 match annotation { 98 match annotation {
99 BindingAnnotation::Unannotated | BindingAnnotation::Mutable => BindingMode::Move, 99 BindingAnnotation::Unannotated | BindingAnnotation::Mutable => BindingMode::Move,
100 BindingAnnotation::Ref => BindingMode::Ref(Mutability::Shared), 100 BindingAnnotation::Ref => BindingMode::Ref(Mutability::Shared),
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index 2406a7361..76984242e 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -35,7 +35,7 @@ where
35 35
36#[derive(Debug)] 36#[derive(Debug)]
37pub(super) struct Canonicalized<T> { 37pub(super) struct Canonicalized<T> {
38 pub value: Canonical<T>, 38 pub(super) value: Canonical<T>,
39 free_vars: Vec<InferTy>, 39 free_vars: Vec<InferTy>,
40} 40}
41 41
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs
index a6c247f87..55e2c3a3e 100644
--- a/crates/hir_ty/src/traits/chalk.rs
+++ b/crates/hir_ty/src/traits/chalk.rs
@@ -27,7 +27,7 @@ use mapping::{
27 TypeAliasAsValue, 27 TypeAliasAsValue,
28}; 28};
29 29
30pub use self::interner::*; 30pub(crate) use self::interner::*;
31 31
32pub(super) mod tls; 32pub(super) mod tls;
33mod interner; 33mod interner;
diff --git a/crates/hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs
index f65873872..39569e690 100644
--- a/crates/hir_ty/src/traits/chalk/interner.rs
+++ b/crates/hir_ty/src/traits/chalk/interner.rs
@@ -10,21 +10,21 @@ use std::{fmt, sync::Arc};
10#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] 10#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
11pub struct Interner; 11pub struct Interner;
12 12
13pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>; 13pub(crate) type AssocTypeId = chalk_ir::AssocTypeId<Interner>;
14pub type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>; 14pub(crate) type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>;
15pub type ForeignDefId = chalk_ir::ForeignDefId<Interner>; 15pub(crate) type ForeignDefId = chalk_ir::ForeignDefId<Interner>;
16pub type TraitId = chalk_ir::TraitId<Interner>; 16pub(crate) type TraitId = chalk_ir::TraitId<Interner>;
17pub type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>; 17pub(crate) type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>;
18pub type AdtId = chalk_ir::AdtId<Interner>; 18pub(crate) type AdtId = chalk_ir::AdtId<Interner>;
19pub type StructDatum = chalk_solve::rust_ir::AdtDatum<Interner>; 19pub(crate) type StructDatum = chalk_solve::rust_ir::AdtDatum<Interner>;
20pub type ImplId = chalk_ir::ImplId<Interner>; 20pub(crate) type ImplId = chalk_ir::ImplId<Interner>;
21pub type ImplDatum = chalk_solve::rust_ir::ImplDatum<Interner>; 21pub(crate) type ImplDatum = chalk_solve::rust_ir::ImplDatum<Interner>;
22pub type AssociatedTyValueId = chalk_solve::rust_ir::AssociatedTyValueId<Interner>; 22pub(crate) type AssociatedTyValueId = chalk_solve::rust_ir::AssociatedTyValueId<Interner>;
23pub type AssociatedTyValue = chalk_solve::rust_ir::AssociatedTyValue<Interner>; 23pub(crate) type AssociatedTyValue = chalk_solve::rust_ir::AssociatedTyValue<Interner>;
24pub type FnDefId = chalk_ir::FnDefId<Interner>; 24pub(crate) type FnDefId = chalk_ir::FnDefId<Interner>;
25pub type FnDefDatum = chalk_solve::rust_ir::FnDefDatum<Interner>; 25pub(crate) type FnDefDatum = chalk_solve::rust_ir::FnDefDatum<Interner>;
26pub type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>; 26pub(crate) type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>;
27pub type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>; 27pub(crate) type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>;
28 28
29impl chalk_ir::interner::Interner for Interner { 29impl chalk_ir::interner::Interner for Interner {
30 type InternedType = Arc<chalk_ir::TyData<Self>>; 30 type InternedType = Arc<chalk_ir::TyData<Self>>;
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs
index 58c337b40..86cbc4c7e 100644
--- a/crates/hir_ty/src/traits/chalk/mapping.rs
+++ b/crates/hir_ty/src/traits/chalk/mapping.rs
@@ -464,7 +464,7 @@ impl ToChalk for CallableDefId {
464 } 464 }
465} 465}
466 466
467pub struct TypeAliasAsAssocType(pub TypeAliasId); 467pub(crate) struct TypeAliasAsAssocType(pub(crate) TypeAliasId);
468 468
469impl ToChalk for TypeAliasAsAssocType { 469impl ToChalk for TypeAliasAsAssocType {
470 type Chalk = AssocTypeId; 470 type Chalk = AssocTypeId;
@@ -478,7 +478,7 @@ impl ToChalk for TypeAliasAsAssocType {
478 } 478 }
479} 479}
480 480
481pub struct TypeAliasAsForeignType(pub TypeAliasId); 481pub(crate) struct TypeAliasAsForeignType(pub(crate) TypeAliasId);
482 482
483impl ToChalk for TypeAliasAsForeignType { 483impl ToChalk for TypeAliasAsForeignType {
484 type Chalk = ForeignDefId; 484 type Chalk = ForeignDefId;
@@ -492,7 +492,7 @@ impl ToChalk for TypeAliasAsForeignType {
492 } 492 }
493} 493}
494 494
495pub struct TypeAliasAsValue(pub TypeAliasId); 495pub(crate) struct TypeAliasAsValue(pub(crate) TypeAliasId);
496 496
497impl ToChalk for TypeAliasAsValue { 497impl ToChalk for TypeAliasAsValue {
498 type Chalk = AssociatedTyValueId; 498 type Chalk = AssociatedTyValueId;
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index 0c950003e..02e17ba43 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -25,7 +25,7 @@ use crate::{diagnostics::Fix, references::rename::rename_with_semantics, FilePos
25/// A [Diagnostic] that potentially has a fix available. 25/// A [Diagnostic] that potentially has a fix available.
26/// 26///
27/// [Diagnostic]: hir::diagnostics::Diagnostic 27/// [Diagnostic]: hir::diagnostics::Diagnostic
28pub trait DiagnosticWithFix: Diagnostic { 28pub(crate) trait DiagnosticWithFix: Diagnostic {
29 fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix>; 29 fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix>;
30} 30}
31 31
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index 250f10f9f..10263537a 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -1,7 +1,6 @@
1//! Resolves and rewrites links in markdown documentation. 1//! Resolves and rewrites links in markdown documentation.
2 2
3use std::convert::TryFrom; 3use std::{convert::TryFrom, iter::once};
4use std::iter::once;
5 4
6use itertools::Itertools; 5use itertools::Itertools;
7use pulldown_cmark::{BrokenLink, CowStr, Event, InlineStr, LinkType, Options, Parser, Tag}; 6use pulldown_cmark::{BrokenLink, CowStr, Event, InlineStr, LinkType, Options, Parser, Tag};
@@ -21,10 +20,10 @@ use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset,
21 20
22use crate::{FilePosition, Semantics}; 21use crate::{FilePosition, Semantics};
23 22
24pub type DocumentationLink = String; 23pub(crate) type DocumentationLink = String;
25 24
26/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs) 25/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)
27pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String { 26pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {
28 let mut cb = |link: BrokenLink| { 27 let mut cb = |link: BrokenLink| {
29 Some(( 28 Some((
30 /*url*/ link.reference.to_owned().into(), 29 /*url*/ link.reference.to_owned().into(),
@@ -63,7 +62,7 @@ pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition)
63} 62}
64 63
65/// Remove all links in markdown documentation. 64/// Remove all links in markdown documentation.
66pub fn remove_links(markdown: &str) -> String { 65pub(crate) fn remove_links(markdown: &str) -> String {
67 let mut drop_link = false; 66 let mut drop_link = false;
68 67
69 let mut opts = Options::empty(); 68 let mut opts = Options::empty();
diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs
index 6168fb837..415795e8c 100644
--- a/crates/ide/src/file_structure.rs
+++ b/crates/ide/src/file_structure.rs
@@ -27,7 +27,7 @@ pub struct StructureNode {
27// 27//
28// | VS Code | kbd:[Ctrl+Shift+O] 28// | VS Code | kbd:[Ctrl+Shift+O]
29// |=== 29// |===
30pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> { 30pub(crate) fn file_structure(file: &SourceFile) -> Vec<StructureNode> {
31 let mut res = Vec::new(); 31 let mut res = Vec::new();
32 let mut stack = Vec::new(); 32 let mut stack = Vec::new();
33 33
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index e37702acd..b5a6f66fd 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -18,7 +18,7 @@ use text_edit::{TextEdit, TextEditBuilder};
18// 18//
19// | VS Code | **Rust Analyzer: Join lines** 19// | VS Code | **Rust Analyzer: Join lines**
20// |=== 20// |===
21pub fn join_lines(file: &SourceFile, range: TextRange) -> TextEdit { 21pub(crate) fn join_lines(file: &SourceFile, range: TextRange) -> TextEdit {
22 let range = if range.is_empty() { 22 let range = if range.is_empty() {
23 let syntax = file.syntax(); 23 let syntax = file.syntax();
24 let text = syntax.text().slice(range.start()..); 24 let text = syntax.text().slice(range.start()..);
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 4bc733b70..6288f7ea7 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -72,18 +72,20 @@ pub use crate::{
72 inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, 72 inlay_hints::{InlayHint, InlayHintsConfig, InlayKind},
73 markup::Markup, 73 markup::Markup,
74 prime_caches::PrimeCachesProgress, 74 prime_caches::PrimeCachesProgress,
75 references::{ 75 references::{rename::RenameError, Declaration, ReferenceSearchResult},
76 Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, RenameError,
77 },
78 runnables::{Runnable, RunnableKind, TestId}, 76 runnables::{Runnable, RunnableKind, TestId},
79 syntax_highlighting::{ 77 syntax_highlighting::{
80 Highlight, HighlightModifier, HighlightModifiers, HighlightTag, HighlightedRange, 78 tags::{Highlight, HighlightModifier, HighlightModifiers, HighlightTag},
79 HighlightedRange,
81 }, 80 },
82}; 81};
83pub use completion::{ 82pub use completion::{
84 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, 83 CompletionConfig, CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat,
85}; 84};
86pub use ide_db::call_info::CallInfo; 85pub use ide_db::{
86 call_info::CallInfo,
87 search::{Reference, ReferenceAccess, ReferenceKind},
88};
87 89
88pub use assists::{ 90pub use assists::{
89 utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, 91 utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist,
@@ -503,7 +505,7 @@ impl Analysis {
503 position: FilePosition, 505 position: FilePosition,
504 new_name: &str, 506 new_name: &str,
505 ) -> Cancelable<Result<RangeInfo<SourceChange>, RenameError>> { 507 ) -> Cancelable<Result<RangeInfo<SourceChange>, RenameError>> {
506 self.with_db(|db| references::rename(db, position, new_name)) 508 self.with_db(|db| references::rename::rename(db, position, new_name))
507 } 509 }
508 510
509 pub fn structural_search_replace( 511 pub fn structural_search_replace(
diff --git a/crates/ide/src/markdown_remove.rs b/crates/ide/src/markdown_remove.rs
index 02ad39dfb..3ec5c629e 100644
--- a/crates/ide/src/markdown_remove.rs
+++ b/crates/ide/src/markdown_remove.rs
@@ -1,11 +1,10 @@
1//! Removes markdown from strings. 1//! Removes markdown from strings.
2
3use pulldown_cmark::{Event, Parser, Tag}; 2use pulldown_cmark::{Event, Parser, Tag};
4 3
5/// Removes all markdown, keeping the text and code blocks 4/// Removes all markdown, keeping the text and code blocks
6/// 5///
7/// Currently limited in styling, i.e. no ascii tables or lists 6/// Currently limited in styling, i.e. no ascii tables or lists
8pub fn remove_markdown(markdown: &str) -> String { 7pub(crate) fn remove_markdown(markdown: &str) -> String {
9 let mut out = String::new(); 8 let mut out = String::new();
10 let parser = Parser::new(markdown); 9 let parser = Parser::new(markdown);
11 10
diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs
index cb6abb0db..d70248afe 100644
--- a/crates/ide/src/matching_brace.rs
+++ b/crates/ide/src/matching_brace.rs
@@ -15,7 +15,7 @@ use test_utils::mark;
15// 15//
16// | VS Code | **Rust Analyzer: Find matching brace** 16// | VS Code | **Rust Analyzer: Find matching brace**
17// |=== 17// |===
18pub fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> { 18pub(crate) fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> {
19 const BRACES: &[SyntaxKind] = 19 const BRACES: &[SyntaxKind] =
20 &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>], T![|], T![|]]; 20 &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>], T![|], T![|]];
21 let (brace_token, brace_idx) = file 21 let (brace_token, brace_idx) = file
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index a517081d5..e05465b32 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -14,7 +14,8 @@ pub(crate) mod rename;
14use hir::Semantics; 14use hir::Semantics;
15use ide_db::{ 15use ide_db::{
16 defs::{Definition, NameClass, NameRefClass}, 16 defs::{Definition, NameClass, NameRefClass},
17 search::SearchScope, 17 search::Reference,
18 search::{ReferenceAccess, ReferenceKind, SearchScope},
18 RootDatabase, 19 RootDatabase,
19}; 20};
20use syntax::{ 21use syntax::{
@@ -25,11 +26,6 @@ use syntax::{
25 26
26use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo}; 27use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeInfo};
27 28
28pub(crate) use self::rename::rename;
29pub use self::rename::RenameError;
30
31pub use ide_db::search::{Reference, ReferenceAccess, ReferenceKind};
32
33#[derive(Debug, Clone)] 29#[derive(Debug, Clone)]
34pub struct ReferenceSearchResult { 30pub struct ReferenceSearchResult {
35 declaration: Declaration, 31 declaration: Declaration,
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs
index 624a63075..efcc8ecfe 100644
--- a/crates/ide/src/syntax_highlighting.rs
+++ b/crates/ide/src/syntax_highlighting.rs
@@ -2,7 +2,7 @@ mod format;
2mod html; 2mod html;
3mod injection; 3mod injection;
4mod macro_rules; 4mod macro_rules;
5mod tags; 5pub(crate) mod tags;
6#[cfg(test)] 6#[cfg(test)]
7mod tests; 7mod tests;
8 8
@@ -20,12 +20,13 @@ use syntax::{
20}; 20};
21 21
22use crate::{ 22use crate::{
23 syntax_highlighting::{format::FormatStringHighlighter, macro_rules::MacroRulesHighlighter}, 23 syntax_highlighting::{
24 FileId, 24 format::FormatStringHighlighter, macro_rules::MacroRulesHighlighter, tags::Highlight,
25 },
26 FileId, HighlightModifier, HighlightTag,
25}; 27};
26 28
27pub(crate) use html::highlight_as_html; 29pub(crate) use html::highlight_as_html;
28pub use tags::{Highlight, HighlightModifier, HighlightModifiers, HighlightTag};
29 30
30#[derive(Debug, Clone)] 31#[derive(Debug, Clone)]
31pub struct HighlightedRange { 32pub struct HighlightedRange {
diff --git a/crates/mbe/src/subtree_source.rs b/crates/mbe/src/subtree_source.rs
index 38237cdcf..ccc56c479 100644
--- a/crates/mbe/src/subtree_source.rs
+++ b/crates/mbe/src/subtree_source.rs
@@ -21,7 +21,7 @@ pub(crate) struct SubtreeTokenSource<'a> {
21impl<'a> SubtreeTokenSource<'a> { 21impl<'a> SubtreeTokenSource<'a> {
22 // Helper function used in test 22 // Helper function used in test
23 #[cfg(test)] 23 #[cfg(test)]
24 pub fn text(&self) -> SmolStr { 24 pub(crate) fn text(&self) -> SmolStr {
25 match *self.get(self.curr.1) { 25 match *self.get(self.curr.1) {
26 Some(ref tt) => tt.text.clone(), 26 Some(ref tt) => tt.text.clone(),
27 _ => SmolStr::new(""), 27 _ => SmolStr::new(""),
diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs
index e5c2d2b25..d5f6a4025 100644
--- a/crates/project_model/src/cargo_workspace.rs
+++ b/crates/project_model/src/cargo_workspace.rs
@@ -278,13 +278,13 @@ impl CargoWorkspace {
278} 278}
279 279
280#[derive(Debug, Clone, Default)] 280#[derive(Debug, Clone, Default)]
281pub struct ExternResources { 281pub(crate) struct ExternResources {
282 out_dirs: FxHashMap<PackageId, AbsPathBuf>, 282 out_dirs: FxHashMap<PackageId, AbsPathBuf>,
283 proc_dylib_paths: FxHashMap<PackageId, AbsPathBuf>, 283 proc_dylib_paths: FxHashMap<PackageId, AbsPathBuf>,
284 cfgs: FxHashMap<PackageId, Vec<CfgFlag>>, 284 cfgs: FxHashMap<PackageId, Vec<CfgFlag>>,
285} 285}
286 286
287pub fn load_extern_resources( 287pub(crate) fn load_extern_resources(
288 cargo_toml: &Path, 288 cargo_toml: &Path,
289 cargo_features: &CargoConfig, 289 cargo_features: &CargoConfig,
290) -> Result<ExternResources> { 290) -> Result<ExternResources> {
diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs
index f6e883ad1..3fe494729 100644
--- a/crates/project_model/src/sysroot.rs
+++ b/crates/project_model/src/sysroot.rs
@@ -17,7 +17,7 @@ pub struct Sysroot {
17 crates: Arena<SysrootCrateData>, 17 crates: Arena<SysrootCrateData>,
18} 18}
19 19
20pub type SysrootCrate = Idx<SysrootCrateData>; 20pub(crate) type SysrootCrate = Idx<SysrootCrateData>;
21 21
22#[derive(Debug, Clone, Eq, PartialEq)] 22#[derive(Debug, Clone, Eq, PartialEq)]
23pub struct SysrootCrateData { 23pub struct SysrootCrateData {
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 4175e569e..21fba8302 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -81,7 +81,7 @@ mod tracing_setup {
81 use tracing_subscriber::Registry; 81 use tracing_subscriber::Registry;
82 use tracing_tree::HierarchicalLayer; 82 use tracing_tree::HierarchicalLayer;
83 83
84 pub fn setup_tracing() -> super::Result<()> { 84 pub(crate) fn setup_tracing() -> super::Result<()> {
85 let filter = EnvFilter::from_env("CHALK_DEBUG"); 85 let filter = EnvFilter::from_env("CHALK_DEBUG");
86 let layer = HierarchicalLayer::default() 86 let layer = HierarchicalLayer::default()
87 .with_indent_lines(true) 87 .with_indent_lines(true)
diff --git a/crates/rust-analyzer/src/cli/progress_report.rs b/crates/rust-analyzer/src/cli/progress_report.rs
index 31867a1e9..bdbe565e6 100644
--- a/crates/rust-analyzer/src/cli/progress_report.rs
+++ b/crates/rust-analyzer/src/cli/progress_report.rs
@@ -4,7 +4,7 @@
4use std::io::Write; 4use std::io::Write;
5 5
6/// A Simple ASCII Progress Bar 6/// A Simple ASCII Progress Bar
7pub struct ProgressReport { 7pub(crate) struct ProgressReport {
8 curr: f32, 8 curr: f32,
9 text: String, 9 text: String,
10 hidden: bool, 10 hidden: bool,
@@ -15,7 +15,7 @@ pub struct ProgressReport {
15} 15}
16 16
17impl ProgressReport { 17impl ProgressReport {
18 pub fn new(len: u64) -> ProgressReport { 18 pub(crate) fn new(len: u64) -> ProgressReport {
19 ProgressReport { 19 ProgressReport {
20 curr: 0.0, 20 curr: 0.0,
21 text: String::new(), 21 text: String::new(),
@@ -26,7 +26,7 @@ impl ProgressReport {
26 } 26 }
27 } 27 }
28 28
29 pub fn hidden() -> ProgressReport { 29 pub(crate) fn hidden() -> ProgressReport {
30 ProgressReport { 30 ProgressReport {
31 curr: 0.0, 31 curr: 0.0,
32 text: String::new(), 32 text: String::new(),
@@ -37,18 +37,18 @@ impl ProgressReport {
37 } 37 }
38 } 38 }
39 39
40 pub fn set_message(&mut self, msg: &str) { 40 pub(crate) fn set_message(&mut self, msg: &str) {
41 self.msg = msg.to_string(); 41 self.msg = msg.to_string();
42 self.tick(); 42 self.tick();
43 } 43 }
44 44
45 pub fn println<I: Into<String>>(&mut self, msg: I) { 45 pub(crate) fn println<I: Into<String>>(&mut self, msg: I) {
46 self.clear(); 46 self.clear();
47 println!("{}", msg.into()); 47 println!("{}", msg.into());
48 self.tick(); 48 self.tick();
49 } 49 }
50 50
51 pub fn inc(&mut self, delta: u64) { 51 pub(crate) fn inc(&mut self, delta: u64) {
52 self.pos += delta; 52 self.pos += delta;
53 if self.len == 0 { 53 if self.len == 0 {
54 self.set_value(0.0) 54 self.set_value(0.0)
@@ -58,11 +58,11 @@ impl ProgressReport {
58 self.tick(); 58 self.tick();
59 } 59 }
60 60
61 pub fn finish_and_clear(&mut self) { 61 pub(crate) fn finish_and_clear(&mut self) {
62 self.clear(); 62 self.clear();
63 } 63 }
64 64
65 pub fn tick(&mut self) { 65 pub(crate) fn tick(&mut self) {
66 if self.hidden { 66 if self.hidden {
67 return; 67 return;
68 } 68 }
diff --git a/crates/rust-analyzer/src/document.rs b/crates/rust-analyzer/src/document.rs
index e882c9865..04c7ee150 100644
--- a/crates/rust-analyzer/src/document.rs
+++ b/crates/rust-analyzer/src/document.rs
@@ -6,11 +6,11 @@
6/// client notifications. 6/// client notifications.
7#[derive(Debug, Clone)] 7#[derive(Debug, Clone)]
8pub(crate) struct DocumentData { 8pub(crate) struct DocumentData {
9 pub version: Option<i64>, 9 pub(crate) version: Option<i64>,
10} 10}
11 11
12impl DocumentData { 12impl DocumentData {
13 pub fn new(version: i64) -> Self { 13 pub(crate) fn new(version: i64) -> Self {
14 DocumentData { version: Some(version) } 14 DocumentData { version: Some(version) }
15 } 15 }
16} 16}
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 673a2eebc..63c70a09d 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -87,7 +87,7 @@ pub(crate) struct GlobalStateSnapshot {
87 pub(crate) check_fixes: CheckFixes, 87 pub(crate) check_fixes: CheckFixes,
88 pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, 88 pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
89 mem_docs: FxHashMap<VfsPath, DocumentData>, 89 mem_docs: FxHashMap<VfsPath, DocumentData>,
90 pub semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>, 90 pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
91 vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, 91 vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
92 pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>, 92 pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
93} 93}
diff --git a/crates/rust-analyzer/src/semantic_tokens.rs b/crates/rust-analyzer/src/semantic_tokens.rs
index 7df28c9dd..e7991fd28 100644
--- a/crates/rust-analyzer/src/semantic_tokens.rs
+++ b/crates/rust-analyzer/src/semantic_tokens.rs
@@ -101,12 +101,12 @@ pub(crate) struct SemanticTokensBuilder {
101} 101}
102 102
103impl SemanticTokensBuilder { 103impl SemanticTokensBuilder {
104 pub fn new(id: String) -> Self { 104 pub(crate) fn new(id: String) -> Self {
105 SemanticTokensBuilder { id, prev_line: 0, prev_char: 0, data: Default::default() } 105 SemanticTokensBuilder { id, prev_line: 0, prev_char: 0, data: Default::default() }
106 } 106 }
107 107
108 /// Push a new token onto the builder 108 /// Push a new token onto the builder
109 pub fn push(&mut self, range: Range, token_index: u32, modifier_bitset: u32) { 109 pub(crate) fn push(&mut self, range: Range, token_index: u32, modifier_bitset: u32) {
110 let mut push_line = range.start.line as u32; 110 let mut push_line = range.start.line as u32;
111 let mut push_char = range.start.character as u32; 111 let mut push_char = range.start.character as u32;
112 112
@@ -134,12 +134,12 @@ impl SemanticTokensBuilder {
134 self.prev_char = range.start.character as u32; 134 self.prev_char = range.start.character as u32;
135 } 135 }
136 136
137 pub fn build(self) -> SemanticTokens { 137 pub(crate) fn build(self) -> SemanticTokens {
138 SemanticTokens { result_id: Some(self.id), data: self.data } 138 SemanticTokens { result_id: Some(self.id), data: self.data }
139 } 139 }
140} 140}
141 141
142pub fn diff_tokens(old: &[SemanticToken], new: &[SemanticToken]) -> Vec<SemanticTokensEdit> { 142pub(crate) fn diff_tokens(old: &[SemanticToken], new: &[SemanticToken]) -> Vec<SemanticTokensEdit> {
143 let offset = new.iter().zip(old.iter()).take_while(|&(n, p)| n == p).count(); 143 let offset = new.iter().zip(old.iter()).take_while(|&(n, p)| n == p).count();
144 144
145 let (_, old) = old.split_at(offset); 145 let (_, old) = old.split_at(offset);
@@ -165,7 +165,7 @@ pub fn diff_tokens(old: &[SemanticToken], new: &[SemanticToken]) -> Vec<Semantic
165 } 165 }
166} 166}
167 167
168pub fn type_index(type_: SemanticTokenType) -> u32 { 168pub(crate) fn type_index(type_: SemanticTokenType) -> u32 {
169 SUPPORTED_TYPES.iter().position(|it| *it == type_).unwrap() as u32 169 SUPPORTED_TYPES.iter().position(|it| *it == type_).unwrap() as u32
170} 170}
171 171
diff --git a/crates/rust-analyzer/tests/rust-analyzer/support.rs b/crates/rust-analyzer/tests/rust-analyzer/support.rs
index 784cbda79..fe9362bc0 100644
--- a/crates/rust-analyzer/tests/rust-analyzer/support.rs
+++ b/crates/rust-analyzer/tests/rust-analyzer/support.rs
@@ -24,7 +24,7 @@ use vfs::AbsPathBuf;
24 24
25use crate::testdir::TestDir; 25use crate::testdir::TestDir;
26 26
27pub struct Project<'a> { 27pub(crate) struct Project<'a> {
28 fixture: &'a str, 28 fixture: &'a str,
29 with_sysroot: bool, 29 with_sysroot: bool,
30 tmp_dir: Option<TestDir>, 30 tmp_dir: Option<TestDir>,
@@ -33,11 +33,11 @@ pub struct Project<'a> {
33} 33}
34 34
35impl<'a> Project<'a> { 35impl<'a> Project<'a> {
36 pub fn with_fixture(fixture: &str) -> Project { 36 pub(crate) fn with_fixture(fixture: &str) -> Project {
37 Project { fixture, tmp_dir: None, roots: vec![], with_sysroot: false, config: None } 37 Project { fixture, tmp_dir: None, roots: vec![], with_sysroot: false, config: None }
38 } 38 }
39 39
40 pub fn tmp_dir(mut self, tmp_dir: TestDir) -> Project<'a> { 40 pub(crate) fn tmp_dir(mut self, tmp_dir: TestDir) -> Project<'a> {
41 self.tmp_dir = Some(tmp_dir); 41 self.tmp_dir = Some(tmp_dir);
42 self 42 self
43 } 43 }
@@ -47,17 +47,17 @@ impl<'a> Project<'a> {
47 self 47 self
48 } 48 }
49 49
50 pub fn with_sysroot(mut self, sysroot: bool) -> Project<'a> { 50 pub(crate) fn with_sysroot(mut self, sysroot: bool) -> Project<'a> {
51 self.with_sysroot = sysroot; 51 self.with_sysroot = sysroot;
52 self 52 self
53 } 53 }
54 54
55 pub fn with_config(mut self, config: impl Fn(&mut Config) + 'static) -> Project<'a> { 55 pub(crate) fn with_config(mut self, config: impl Fn(&mut Config) + 'static) -> Project<'a> {
56 self.config = Some(Box::new(config)); 56 self.config = Some(Box::new(config));
57 self 57 self
58 } 58 }
59 59
60 pub fn server(self) -> Server { 60 pub(crate) fn server(self) -> Server {
61 let tmp_dir = self.tmp_dir.unwrap_or_else(|| TestDir::new()); 61 let tmp_dir = self.tmp_dir.unwrap_or_else(|| TestDir::new());
62 static INIT: Once = Once::new(); 62 static INIT: Once = Once::new();
63 INIT.call_once(|| { 63 INIT.call_once(|| {
@@ -103,11 +103,11 @@ impl<'a> Project<'a> {
103 } 103 }
104} 104}
105 105
106pub fn project(fixture: &str) -> Server { 106pub(crate) fn project(fixture: &str) -> Server {
107 Project::with_fixture(fixture).server() 107 Project::with_fixture(fixture).server()
108} 108}
109 109
110pub struct Server { 110pub(crate) struct Server {
111 req_id: Cell<u64>, 111 req_id: Cell<u64>,
112 messages: RefCell<Vec<Message>>, 112 messages: RefCell<Vec<Message>>,
113 _thread: jod_thread::JoinHandle<()>, 113 _thread: jod_thread::JoinHandle<()>,
@@ -128,12 +128,12 @@ impl Server {
128 Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread } 128 Server { req_id: Cell::new(1), dir, messages: Default::default(), client, _thread }
129 } 129 }
130 130
131 pub fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier { 131 pub(crate) fn doc_id(&self, rel_path: &str) -> TextDocumentIdentifier {
132 let path = self.dir.path().join(rel_path); 132 let path = self.dir.path().join(rel_path);
133 TextDocumentIdentifier { uri: Url::from_file_path(path).unwrap() } 133 TextDocumentIdentifier { uri: Url::from_file_path(path).unwrap() }
134 } 134 }
135 135
136 pub fn notification<N>(&self, params: N::Params) 136 pub(crate) fn notification<N>(&self, params: N::Params)
137 where 137 where
138 N: lsp_types::notification::Notification, 138 N: lsp_types::notification::Notification,
139 N::Params: Serialize, 139 N::Params: Serialize,
@@ -142,7 +142,7 @@ impl Server {
142 self.send_notification(r) 142 self.send_notification(r)
143 } 143 }
144 144
145 pub fn request<R>(&self, params: R::Params, expected_resp: Value) 145 pub(crate) fn request<R>(&self, params: R::Params, expected_resp: Value)
146 where 146 where
147 R: lsp_types::request::Request, 147 R: lsp_types::request::Request,
148 R::Params: Serialize, 148 R::Params: Serialize,
@@ -159,7 +159,7 @@ impl Server {
159 } 159 }
160 } 160 }
161 161
162 pub fn send_request<R>(&self, params: R::Params) -> Value 162 pub(crate) fn send_request<R>(&self, params: R::Params) -> Value
163 where 163 where
164 R: lsp_types::request::Request, 164 R: lsp_types::request::Request,
165 R::Params: Serialize, 165 R::Params: Serialize,
@@ -202,7 +202,7 @@ impl Server {
202 } 202 }
203 panic!("no response"); 203 panic!("no response");
204 } 204 }
205 pub fn wait_until_workspace_is_loaded(self) -> Server { 205 pub(crate) fn wait_until_workspace_is_loaded(self) -> Server {
206 self.wait_for_message_cond(1, &|msg: &Message| match msg { 206 self.wait_for_message_cond(1, &|msg: &Message| match msg {
207 Message::Notification(n) if n.method == "$/progress" => { 207 Message::Notification(n) if n.method == "$/progress" => {
208 match n.clone().extract::<ProgressParams>("$/progress").unwrap() { 208 match n.clone().extract::<ProgressParams>("$/progress").unwrap() {
@@ -241,7 +241,7 @@ impl Server {
241 self.client.sender.send(Message::Notification(not)).unwrap(); 241 self.client.sender.send(Message::Notification(not)).unwrap();
242 } 242 }
243 243
244 pub fn path(&self) -> &Path { 244 pub(crate) fn path(&self) -> &Path {
245 self.dir.path() 245 self.dir.path()
246 } 246 }
247} 247}
diff --git a/crates/rust-analyzer/tests/rust-analyzer/testdir.rs b/crates/rust-analyzer/tests/rust-analyzer/testdir.rs
index 7487e7429..36271344b 100644
--- a/crates/rust-analyzer/tests/rust-analyzer/testdir.rs
+++ b/crates/rust-analyzer/tests/rust-analyzer/testdir.rs
@@ -4,13 +4,13 @@ use std::{
4 sync::atomic::{AtomicUsize, Ordering}, 4 sync::atomic::{AtomicUsize, Ordering},
5}; 5};
6 6
7pub struct TestDir { 7pub(crate) struct TestDir {
8 path: PathBuf, 8 path: PathBuf,
9 keep: bool, 9 keep: bool,
10} 10}
11 11
12impl TestDir { 12impl TestDir {
13 pub fn new() -> TestDir { 13 pub(crate) fn new() -> TestDir {
14 let base = std::env::temp_dir().join("testdir"); 14 let base = std::env::temp_dir().join("testdir");
15 let pid = std::process::id(); 15 let pid = std::process::id();
16 16
@@ -27,11 +27,11 @@ impl TestDir {
27 panic!("Failed to create a temporary directory") 27 panic!("Failed to create a temporary directory")
28 } 28 }
29 #[allow(unused)] 29 #[allow(unused)]
30 pub fn keep(mut self) -> TestDir { 30 pub(crate) fn keep(mut self) -> TestDir {
31 self.keep = true; 31 self.keep = true;
32 self 32 self
33 } 33 }
34 pub fn path(&self) -> &Path { 34 pub(crate) fn path(&self) -> &Path {
35 &self.path 35 &self.path
36 } 36 }
37} 37}
diff --git a/crates/ssr/src/parsing.rs b/crates/ssr/src/parsing.rs
index 05b66dcd7..f3b084baf 100644
--- a/crates/ssr/src/parsing.rs
+++ b/crates/ssr/src/parsing.rs
@@ -42,7 +42,7 @@ pub(crate) struct Placeholder {
42 42
43/// Represents a `$var` in an SSR query. 43/// Represents a `$var` in an SSR query.
44#[derive(Debug, Clone, PartialEq, Eq, Hash)] 44#[derive(Debug, Clone, PartialEq, Eq, Hash)]
45pub(crate) struct Var(pub String); 45pub(crate) struct Var(pub(crate) String);
46 46
47#[derive(Clone, Debug, PartialEq, Eq)] 47#[derive(Clone, Debug, PartialEq, Eq)]
48pub(crate) enum Constraint { 48pub(crate) enum Constraint {
diff --git a/crates/vfs/src/vfs_path.rs b/crates/vfs/src/vfs_path.rs
index 7a213fc3e..815697597 100644
--- a/crates/vfs/src/vfs_path.rs
+++ b/crates/vfs/src/vfs_path.rs
@@ -120,7 +120,7 @@ impl VfsPath {
120 120
121#[cfg(windows)] 121#[cfg(windows)]
122mod windows_paths { 122mod windows_paths {
123 pub trait Encode { 123 pub(crate) trait Encode {
124 fn encode(&self, buf: &mut Vec<u8>); 124 fn encode(&self, buf: &mut Vec<u8>);
125 } 125 }
126 126
@@ -149,7 +149,7 @@ mod windows_paths {
149 } 149 }
150 } 150 }
151 151
152 pub const SEP: &str = "\\"; 152 pub(crate) const SEP: &str = "\\";
153 const VERBATIM: &str = "\\\\?\\"; 153 const VERBATIM: &str = "\\\\?\\";
154 const UNC: &str = "UNC"; 154 const UNC: &str = "UNC";
155 const DEVICE: &str = "\\\\.\\"; 155 const DEVICE: &str = "\\\\.\\";