mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Auto merge of #17954 - Noratrieb:rustc-blazing-hash, r=Veykril
Update rustc-hash to version 2 This brings in the new optimized algorithm that was shown to have small performance benefits for rustc. I haven't run the rust-analyzer benchmarks. See https://github.com/rust-lang/rustc-hash/pull/37.
This commit is contained in:
commit
fb832ff2ba
13 changed files with 245 additions and 236 deletions
54
Cargo.lock
generated
54
Cargo.lock
generated
|
@ -73,7 +73,7 @@ dependencies = [
|
||||||
"intern",
|
"intern",
|
||||||
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lz4_flex",
|
"lz4_flex",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"salsa",
|
"salsa",
|
||||||
"semver",
|
"semver",
|
||||||
"span",
|
"span",
|
||||||
|
@ -161,7 +161,7 @@ dependencies = [
|
||||||
"expect-test",
|
"expect-test",
|
||||||
"intern",
|
"intern",
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"syntax",
|
"syntax",
|
||||||
"syntax-bridge",
|
"syntax-bridge",
|
||||||
"tt",
|
"tt",
|
||||||
|
@ -216,7 +216,7 @@ dependencies = [
|
||||||
"chalk-derive",
|
"chalk-derive",
|
||||||
"chalk-ir",
|
"chalk-ir",
|
||||||
"chalk-solve",
|
"chalk-solve",
|
||||||
"rustc-hash",
|
"rustc-hash 1.1.0",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itertools",
|
"itertools",
|
||||||
"petgraph",
|
"petgraph",
|
||||||
"rustc-hash",
|
"rustc-hash 1.1.0",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ dependencies = [
|
||||||
"hir-ty",
|
"hir-ty",
|
||||||
"intern",
|
"intern",
|
||||||
"itertools",
|
"itertools",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"span",
|
"span",
|
||||||
"stdx",
|
"stdx",
|
||||||
|
@ -547,7 +547,7 @@ dependencies = [
|
||||||
"mbe",
|
"mbe",
|
||||||
"ra-ap-rustc_abi",
|
"ra-ap-rustc_abi",
|
||||||
"ra-ap-rustc_parse_format",
|
"ra-ap-rustc_parse_format",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"span",
|
"span",
|
||||||
|
@ -577,7 +577,7 @@ dependencies = [
|
||||||
"limit",
|
"limit",
|
||||||
"mbe",
|
"mbe",
|
||||||
"parser",
|
"parser",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"span",
|
"span",
|
||||||
"stdx",
|
"stdx",
|
||||||
|
@ -616,7 +616,7 @@ dependencies = [
|
||||||
"ra-ap-rustc_abi",
|
"ra-ap-rustc_abi",
|
||||||
"ra-ap-rustc_index",
|
"ra-ap-rustc_index",
|
||||||
"ra-ap-rustc_pattern_analysis",
|
"ra-ap-rustc_pattern_analysis",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"scoped-tls",
|
"scoped-tls",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
|
@ -737,7 +737,7 @@ dependencies = [
|
||||||
"parser",
|
"parser",
|
||||||
"profile",
|
"profile",
|
||||||
"rayon",
|
"rayon",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"span",
|
"span",
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
|
@ -834,7 +834,7 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dashmap",
|
"dashmap",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"sptr",
|
"sptr",
|
||||||
"triomphe",
|
"triomphe",
|
||||||
]
|
]
|
||||||
|
@ -1051,7 +1051,7 @@ dependencies = [
|
||||||
"intern",
|
"intern",
|
||||||
"parser",
|
"parser",
|
||||||
"ra-ap-rustc_lexer",
|
"ra-ap-rustc_lexer",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"span",
|
"span",
|
||||||
"stdx",
|
"stdx",
|
||||||
|
@ -1345,7 +1345,7 @@ dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"intern",
|
"intern",
|
||||||
"paths",
|
"paths",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"span",
|
"span",
|
||||||
|
@ -1435,7 +1435,7 @@ dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"paths",
|
"paths",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1555,7 +1555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "273d5f72926a58c7eea27aebc898d1d5b32d23d2342f692a94a2cf8746aa4a2f"
|
checksum = "273d5f72926a58c7eea27aebc898d1d5b32d23d2342f692a94a2cf8746aa4a2f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ra-ap-rustc_index",
|
"ra-ap-rustc_index",
|
||||||
"rustc-hash",
|
"rustc-hash 1.1.0",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -1640,7 +1640,7 @@ dependencies = [
|
||||||
"countme",
|
"countme",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"memoffset",
|
"memoffset",
|
||||||
"rustc-hash",
|
"rustc-hash 1.1.0",
|
||||||
"text-size",
|
"text-size",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1680,7 +1680,7 @@ dependencies = [
|
||||||
"profile",
|
"profile",
|
||||||
"project-model",
|
"project-model",
|
||||||
"rayon",
|
"rayon",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"scip",
|
"scip",
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -1717,6 +1717,12 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-hash"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_apfloat"
|
name = "rustc_apfloat"
|
||||||
version = "0.2.1+llvm-462a31f5a5ab"
|
version = "0.2.1+llvm-462a31f5a5ab"
|
||||||
|
@ -1746,7 +1752,7 @@ dependencies = [
|
||||||
"oorandom",
|
"oorandom",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rand",
|
"rand",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"salsa-macros",
|
"salsa-macros",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -1898,7 +1904,7 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"salsa",
|
"salsa",
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
|
@ -1967,7 +1973,7 @@ dependencies = [
|
||||||
"ra-ap-rustc_lexer",
|
"ra-ap-rustc_lexer",
|
||||||
"rayon",
|
"rayon",
|
||||||
"rowan",
|
"rowan",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"stdx",
|
"stdx",
|
||||||
|
@ -1983,7 +1989,7 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"intern",
|
"intern",
|
||||||
"parser",
|
"parser",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"span",
|
"span",
|
||||||
"stdx",
|
"stdx",
|
||||||
"syntax",
|
"syntax",
|
||||||
|
@ -2000,7 +2006,7 @@ dependencies = [
|
||||||
"cfg",
|
"cfg",
|
||||||
"hir-expand",
|
"hir-expand",
|
||||||
"intern",
|
"intern",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"span",
|
"span",
|
||||||
"stdx",
|
"stdx",
|
||||||
"test-utils",
|
"test-utils",
|
||||||
|
@ -2014,7 +2020,7 @@ dependencies = [
|
||||||
"dissimilar",
|
"dissimilar",
|
||||||
"paths",
|
"paths",
|
||||||
"profile",
|
"profile",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"stdx",
|
"stdx",
|
||||||
"text-size",
|
"text-size",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
@ -2361,7 +2367,7 @@ dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
"paths",
|
"paths",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"stdx",
|
"stdx",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
@ -2374,7 +2380,7 @@ dependencies = [
|
||||||
"notify",
|
"notify",
|
||||||
"paths",
|
"paths",
|
||||||
"rayon",
|
"rayon",
|
||||||
"rustc-hash",
|
"rustc-hash 2.0.0",
|
||||||
"stdx",
|
"stdx",
|
||||||
"tracing",
|
"tracing",
|
||||||
"vfs",
|
"vfs",
|
||||||
|
|
|
@ -136,7 +136,7 @@ process-wrap = { version = "8.0.2", features = ["std"] }
|
||||||
pulldown-cmark-to-cmark = "10.0.4"
|
pulldown-cmark-to-cmark = "10.0.4"
|
||||||
pulldown-cmark = { version = "0.9.0", default-features = false }
|
pulldown-cmark = { version = "0.9.0", default-features = false }
|
||||||
rayon = "1.8.0"
|
rayon = "1.8.0"
|
||||||
rustc-hash = "1.1.0"
|
rustc-hash = "2.0.0"
|
||||||
semver = "1.0.14"
|
semver = "1.0.14"
|
||||||
serde = { version = "1.0.192", features = ["derive"] }
|
serde = { version = "1.0.192", features = ["derive"] }
|
||||||
serde_json = "1.0.108"
|
serde_json = "1.0.108"
|
||||||
|
|
|
@ -95,7 +95,8 @@ fn check_answer(ra_fixture: &str, check: impl FnOnce(&[u8], &MemoryMap)) {
|
||||||
fn pretty_print_err(e: ConstEvalError, db: TestDB) -> String {
|
fn pretty_print_err(e: ConstEvalError, db: TestDB) -> String {
|
||||||
let mut err = String::new();
|
let mut err = String::new();
|
||||||
let span_formatter = |file, range| format!("{file:?} {range:?}");
|
let span_formatter = |file, range| format!("{file:?} {range:?}");
|
||||||
let edition = db.crate_graph()[db.test_crate()].edition;
|
let edition =
|
||||||
|
db.crate_graph()[*db.crate_graph().crates_in_topological_order().last().unwrap()].edition;
|
||||||
match e {
|
match e {
|
||||||
ConstEvalError::MirLowerError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
|
ConstEvalError::MirLowerError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
|
||||||
ConstEvalError::MirEvalError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
|
ConstEvalError::MirEvalError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
|
||||||
|
@ -2896,7 +2897,7 @@ fn recursive_adt() {
|
||||||
{
|
{
|
||||||
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
|
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
|
||||||
&[
|
&[
|
||||||
TagTree::Leaf,
|
TAG_TREE,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
VARIANT_TAG_TREE
|
VARIANT_TAG_TREE
|
||||||
|
@ -2905,6 +2906,6 @@ fn recursive_adt() {
|
||||||
TAG_TREE
|
TAG_TREE
|
||||||
};
|
};
|
||||||
"#,
|
"#,
|
||||||
|e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
|
|e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,7 @@ mod test_db;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use std::{
|
use std::hash::Hash;
|
||||||
collections::hash_map::Entry,
|
|
||||||
hash::{BuildHasherDefault, Hash},
|
|
||||||
};
|
|
||||||
|
|
||||||
use base_db::ra_salsa::InternValueTrivial;
|
use base_db::ra_salsa::InternValueTrivial;
|
||||||
use chalk_ir::{
|
use chalk_ir::{
|
||||||
|
@ -65,10 +62,11 @@ use chalk_ir::{
|
||||||
use either::Either;
|
use either::Either;
|
||||||
use hir_def::{hir::ExprId, type_ref::Rawness, CallableDefId, GeneralConstId, TypeOrConstParamId};
|
use hir_def::{hir::ExprId, type_ref::Rawness, CallableDefId, GeneralConstId, TypeOrConstParamId};
|
||||||
use hir_expand::name::Name;
|
use hir_expand::name::Name;
|
||||||
|
use indexmap::{map::Entry, IndexMap};
|
||||||
use intern::{sym, Symbol};
|
use intern::{sym, Symbol};
|
||||||
use la_arena::{Arena, Idx};
|
use la_arena::{Arena, Idx};
|
||||||
use mir::{MirEvalError, VTableMap};
|
use mir::{MirEvalError, VTableMap};
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
|
||||||
use span::Edition;
|
use span::Edition;
|
||||||
use syntax::ast::{make, ConstArg};
|
use syntax::ast::{make, ConstArg};
|
||||||
use traits::FnTrait;
|
use traits::FnTrait;
|
||||||
|
@ -199,7 +197,7 @@ pub enum MemoryMap {
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
pub struct ComplexMemoryMap {
|
pub struct ComplexMemoryMap {
|
||||||
memory: FxHashMap<usize, Box<[u8]>>,
|
memory: IndexMap<usize, Box<[u8]>, FxBuildHasher>,
|
||||||
vtable: VTableMap,
|
vtable: VTableMap,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +243,7 @@ impl MemoryMap {
|
||||||
match self {
|
match self {
|
||||||
MemoryMap::Empty => Ok(Default::default()),
|
MemoryMap::Empty => Ok(Default::default()),
|
||||||
MemoryMap::Simple(m) => transform((&0, m)).map(|(addr, val)| {
|
MemoryMap::Simple(m) => transform((&0, m)).map(|(addr, val)| {
|
||||||
let mut map = FxHashMap::with_capacity_and_hasher(1, BuildHasherDefault::default());
|
let mut map = FxHashMap::with_capacity_and_hasher(1, rustc_hash::FxBuildHasher);
|
||||||
map.insert(addr, val);
|
map.insert(addr, val);
|
||||||
map
|
map
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1095,6 +1095,7 @@ fn main() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn field_enum_cross_file() {
|
fn field_enum_cross_file() {
|
||||||
|
// FIXME: The import is missing
|
||||||
check_assist(
|
check_assist(
|
||||||
bool_to_enum,
|
bool_to_enum,
|
||||||
r#"
|
r#"
|
||||||
|
@ -1132,7 +1133,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
use foo::{Bool, Foo};
|
use foo::Foo;
|
||||||
|
|
||||||
mod foo;
|
mod foo;
|
||||||
|
|
||||||
|
|
|
@ -1853,8 +1853,8 @@ fn f() { A { bar: b$0 }; }
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
fn bar() [type+name]
|
fn bar() [type+name]
|
||||||
fn baz() [type]
|
fn baz() [type]
|
||||||
ex baz() [type]
|
|
||||||
ex bar() [type]
|
ex bar() [type]
|
||||||
|
ex baz() [type]
|
||||||
st A []
|
st A []
|
||||||
fn f() []
|
fn f() []
|
||||||
"#]],
|
"#]],
|
||||||
|
|
|
@ -286,6 +286,20 @@ fn main() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Annotation {
|
||||||
|
range: 53..57,
|
||||||
|
kind: HasReferences {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 53,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 53..57,
|
range: 53..57,
|
||||||
kind: Runnable(
|
kind: Runnable(
|
||||||
|
@ -305,20 +319,6 @@ fn main() {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 53..57,
|
|
||||||
kind: HasReferences {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 53,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -336,6 +336,20 @@ fn main() {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
|
Annotation {
|
||||||
|
range: 7..11,
|
||||||
|
kind: HasImpls {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 7,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 7..11,
|
range: 7..11,
|
||||||
kind: HasReferences {
|
kind: HasReferences {
|
||||||
|
@ -358,13 +372,13 @@ fn main() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 7..11,
|
range: 17..21,
|
||||||
kind: HasImpls {
|
kind: HasReferences {
|
||||||
pos: FilePositionWrapper {
|
pos: FilePositionWrapper {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
offset: 7,
|
offset: 17,
|
||||||
},
|
},
|
||||||
data: Some(
|
data: Some(
|
||||||
[],
|
[],
|
||||||
|
@ -390,20 +404,6 @@ fn main() {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 17..21,
|
|
||||||
kind: HasReferences {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 17,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -425,6 +425,30 @@ fn main() {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
|
Annotation {
|
||||||
|
range: 7..11,
|
||||||
|
kind: HasImpls {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 7,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[
|
||||||
|
NavigationTarget {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
full_range: 36..64,
|
||||||
|
focus_range: 57..61,
|
||||||
|
name: "impl",
|
||||||
|
kind: Impl,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 7..11,
|
range: 7..11,
|
||||||
kind: HasReferences {
|
kind: HasReferences {
|
||||||
|
@ -452,30 +476,6 @@ fn main() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 7..11,
|
|
||||||
kind: HasImpls {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 7,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[
|
|
||||||
NavigationTarget {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
full_range: 36..64,
|
|
||||||
focus_range: 57..61,
|
|
||||||
name: "impl",
|
|
||||||
kind: Impl,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 20..31,
|
range: 20..31,
|
||||||
kind: HasImpls {
|
kind: HasImpls {
|
||||||
|
@ -521,20 +521,6 @@ fn main() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 69..73,
|
|
||||||
kind: HasReferences {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 69,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 69..73,
|
range: 69..73,
|
||||||
kind: Runnable(
|
kind: Runnable(
|
||||||
|
@ -554,6 +540,20 @@ fn main() {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
Annotation {
|
||||||
|
range: 69..73,
|
||||||
|
kind: HasReferences {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 69,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -567,6 +567,20 @@ fn main() {}
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
|
Annotation {
|
||||||
|
range: 3..7,
|
||||||
|
kind: HasReferences {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 3,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 3..7,
|
range: 3..7,
|
||||||
kind: Runnable(
|
kind: Runnable(
|
||||||
|
@ -586,20 +600,6 @@ fn main() {}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 3..7,
|
|
||||||
kind: HasReferences {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 3,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -621,6 +621,30 @@ fn main() {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
|
Annotation {
|
||||||
|
range: 7..11,
|
||||||
|
kind: HasImpls {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 7,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[
|
||||||
|
NavigationTarget {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
full_range: 14..56,
|
||||||
|
focus_range: 19..23,
|
||||||
|
name: "impl",
|
||||||
|
kind: Impl,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 7..11,
|
range: 7..11,
|
||||||
kind: HasReferences {
|
kind: HasReferences {
|
||||||
|
@ -648,30 +672,6 @@ fn main() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 7..11,
|
|
||||||
kind: HasImpls {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 7,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[
|
|
||||||
NavigationTarget {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
full_range: 14..56,
|
|
||||||
focus_range: 19..23,
|
|
||||||
name: "impl",
|
|
||||||
kind: Impl,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 33..44,
|
range: 33..44,
|
||||||
kind: HasReferences {
|
kind: HasReferences {
|
||||||
|
@ -693,20 +693,6 @@ fn main() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Annotation {
|
|
||||||
range: 61..65,
|
|
||||||
kind: HasReferences {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 61,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 61..65,
|
range: 61..65,
|
||||||
kind: Runnable(
|
kind: Runnable(
|
||||||
|
@ -726,6 +712,20 @@ fn main() {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
Annotation {
|
||||||
|
range: 61..65,
|
||||||
|
kind: HasReferences {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 61,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
@ -744,20 +744,6 @@ mod tests {
|
||||||
"#,
|
"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
[
|
[
|
||||||
Annotation {
|
|
||||||
range: 3..7,
|
|
||||||
kind: HasReferences {
|
|
||||||
pos: FilePositionWrapper {
|
|
||||||
file_id: FileId(
|
|
||||||
0,
|
|
||||||
),
|
|
||||||
offset: 3,
|
|
||||||
},
|
|
||||||
data: Some(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 3..7,
|
range: 3..7,
|
||||||
kind: Runnable(
|
kind: Runnable(
|
||||||
|
@ -777,6 +763,20 @@ mod tests {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
Annotation {
|
||||||
|
range: 3..7,
|
||||||
|
kind: HasReferences {
|
||||||
|
pos: FilePositionWrapper {
|
||||||
|
file_id: FileId(
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
offset: 3,
|
||||||
|
},
|
||||||
|
data: Some(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 18..23,
|
range: 18..23,
|
||||||
kind: Runnable(
|
kind: Runnable(
|
||||||
|
@ -876,7 +876,7 @@ struct Foo;
|
||||||
[
|
[
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 0..71,
|
range: 0..71,
|
||||||
kind: HasReferences {
|
kind: HasImpls {
|
||||||
pos: FilePositionWrapper {
|
pos: FilePositionWrapper {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
0,
|
0,
|
||||||
|
@ -890,7 +890,7 @@ struct Foo;
|
||||||
},
|
},
|
||||||
Annotation {
|
Annotation {
|
||||||
range: 0..71,
|
range: 0..71,
|
||||||
kind: HasImpls {
|
kind: HasReferences {
|
||||||
pos: FilePositionWrapper {
|
pos: FilePositionWrapper {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -1350,18 +1350,18 @@ mod tests {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
full_range: 121..185,
|
full_range: 52..115,
|
||||||
focus_range: 136..145,
|
focus_range: 67..75,
|
||||||
name: "foo2_test",
|
name: "foo_test",
|
||||||
kind: Function,
|
kind: Function,
|
||||||
},
|
},
|
||||||
NavigationTarget {
|
NavigationTarget {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
full_range: 52..115,
|
full_range: 121..185,
|
||||||
focus_range: 67..75,
|
focus_range: 136..145,
|
||||||
name: "foo_test",
|
name: "foo2_test",
|
||||||
kind: Function,
|
kind: Function,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -46,14 +46,14 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
|
||||||
.unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
|
.unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
|
||||||
</style>
|
</style>
|
||||||
<pre><code><span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
<pre><code><span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
||||||
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
|
||||||
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="17360984456076382725" style="color: hsl(95,79%,86%);">x</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="10753541418856619067" style="color: hsl(51,52%,47%);">x</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="17186414787327620935" style="color: hsl(196,64%,89%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="9865812862466303869" style="color: hsl(329,86%,55%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
|
|
||||||
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="4786021388930833562" style="color: hsl(137,61%,87%);">x</span> <span class="operator">=</span> <span class="string_literal">"other color please!"</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration reference" data-binding-hash="4890670724659097491" style="color: hsl(330,46%,45%);">x</span> <span class="operator">=</span> <span class="string_literal">"other color please!"</span><span class="semicolon">;</span>
|
||||||
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="18017815841345165192" style="color: hsl(39,76%,89%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="4786021388930833562" style="color: hsl(137,61%,87%);">x</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="variable declaration" data-binding-hash="4002942168268782293" style="color: hsl(114,87%,67%);">y</span> <span class="operator">=</span> <span class="variable reference" data-binding-hash="4890670724659097491" style="color: hsl(330,46%,45%);">x</span><span class="operator">.</span><span class="unresolved_reference">to_string</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span>
|
||||||
<span class="brace">}</span>
|
<span class="brace">}</span>
|
||||||
|
|
||||||
<span class="keyword">fn</span> <span class="function declaration">bar</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
<span class="keyword">fn</span> <span class="function declaration">bar</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span>
|
||||||
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable reference" data-binding-hash="8384512769119783714" style="color: hsl(59,93%,58%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
|
<span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable reference" data-binding-hash="16711699953829236520" style="color: hsl(345,54%,46%);">hello</span> <span class="operator">=</span> <span class="string_literal">"hello"</span><span class="semicolon">;</span>
|
||||||
<span class="brace">}</span></code></pre>
|
<span class="brace">}</span></code></pre>
|
|
@ -3,6 +3,7 @@
|
||||||
use intern::Symbol;
|
use intern::Symbol;
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use span::{Edition, Span};
|
use span::{Edition, Span};
|
||||||
|
use stdx::itertools::Itertools;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, HasName},
|
ast::{self, HasName},
|
||||||
AstNode,
|
AstNode,
|
||||||
|
@ -27,9 +28,10 @@ fn benchmark_parse_macro_rules() {
|
||||||
let hash: usize = {
|
let hash: usize = {
|
||||||
let _pt = bench("mbe parse macro rules");
|
let _pt = bench("mbe parse macro rules");
|
||||||
rules
|
rules
|
||||||
.values()
|
.into_iter()
|
||||||
.map(|it| {
|
.sorted_by_key(|(id, _)| id.clone())
|
||||||
DeclarativeMacro::parse_macro_rules(it, |_| span::Edition::CURRENT).rules.len()
|
.map(|(_, it)| {
|
||||||
|
DeclarativeMacro::parse_macro_rules(&it, |_| span::Edition::CURRENT).rules.len()
|
||||||
})
|
})
|
||||||
.sum()
|
.sum()
|
||||||
};
|
};
|
||||||
|
@ -55,12 +57,13 @@ fn benchmark_expand_macro_rules() {
|
||||||
})
|
})
|
||||||
.sum()
|
.sum()
|
||||||
};
|
};
|
||||||
assert_eq!(hash, 69413);
|
assert_eq!(hash, 65720);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn macro_rules_fixtures() -> FxHashMap<String, DeclarativeMacro> {
|
fn macro_rules_fixtures() -> FxHashMap<String, DeclarativeMacro> {
|
||||||
macro_rules_fixtures_tt()
|
macro_rules_fixtures_tt()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.sorted_by_key(|(id, _)| id.clone())
|
||||||
.map(|(id, tt)| (id, DeclarativeMacro::parse_macro_rules(&tt, |_| span::Edition::CURRENT)))
|
.map(|(id, tt)| (id, DeclarativeMacro::parse_macro_rules(&tt, |_| span::Edition::CURRENT)))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -93,7 +96,7 @@ fn invocation_fixtures(
|
||||||
let mut seed = 123456789;
|
let mut seed = 123456789;
|
||||||
let mut res = Vec::new();
|
let mut res = Vec::new();
|
||||||
|
|
||||||
for (name, it) in rules {
|
for (name, it) in rules.iter().sorted_by_key(|&(id, _)| id) {
|
||||||
for rule in it.rules.iter() {
|
for rule in it.rules.iter() {
|
||||||
// Generate twice
|
// Generate twice
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
|
|
|
@ -17,7 +17,7 @@ indexmap = "2.1.0"
|
||||||
lock_api = "0.4"
|
lock_api = "0.4"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
rustc-hash = "1.0"
|
rustc-hash = "2.0.0"
|
||||||
smallvec = "1.0.0"
|
smallvec = "1.0.0"
|
||||||
oorandom = "11"
|
oorandom = "11"
|
||||||
triomphe = "0.1.11"
|
triomphe = "0.1.11"
|
||||||
|
|
|
@ -95,8 +95,8 @@ avoid checking unnecessary things.
|
||||||
Default:
|
Default:
|
||||||
----
|
----
|
||||||
{
|
{
|
||||||
"debug_assertions": null,
|
"miri": null,
|
||||||
"miri": null
|
"debug_assertions": null
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
List of cfg options to enable with the given values.
|
List of cfg options to enable with the given values.
|
||||||
|
@ -321,18 +321,10 @@ Enables completions of private items and fields that are defined in the current
|
||||||
Default:
|
Default:
|
||||||
----
|
----
|
||||||
{
|
{
|
||||||
"Arc::new": {
|
"Ok": {
|
||||||
"postfix": "arc",
|
"postfix": "ok",
|
||||||
"body": "Arc::new(${receiver})",
|
"body": "Ok(${receiver})",
|
||||||
"requires": "std::sync::Arc",
|
"description": "Wrap the expression in a `Result::Ok`",
|
||||||
"description": "Put the expression into an `Arc`",
|
|
||||||
"scope": "expr"
|
|
||||||
},
|
|
||||||
"Rc::new": {
|
|
||||||
"postfix": "rc",
|
|
||||||
"body": "Rc::new(${receiver})",
|
|
||||||
"requires": "std::rc::Rc",
|
|
||||||
"description": "Put the expression into an `Rc`",
|
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Box::pin": {
|
"Box::pin": {
|
||||||
|
@ -342,10 +334,11 @@ Default:
|
||||||
"description": "Put the expression into a pinned `Box`",
|
"description": "Put the expression into a pinned `Box`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Err": {
|
"Arc::new": {
|
||||||
"postfix": "err",
|
"postfix": "arc",
|
||||||
"body": "Err(${receiver})",
|
"body": "Arc::new(${receiver})",
|
||||||
"description": "Wrap the expression in a `Result::Err`",
|
"requires": "std::sync::Arc",
|
||||||
|
"description": "Put the expression into an `Arc`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Some": {
|
"Some": {
|
||||||
|
@ -354,10 +347,17 @@ Default:
|
||||||
"description": "Wrap the expression in an `Option::Some`",
|
"description": "Wrap the expression in an `Option::Some`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Ok": {
|
"Err": {
|
||||||
"postfix": "ok",
|
"postfix": "err",
|
||||||
"body": "Ok(${receiver})",
|
"body": "Err(${receiver})",
|
||||||
"description": "Wrap the expression in a `Result::Ok`",
|
"description": "Wrap the expression in a `Result::Err`",
|
||||||
|
"scope": "expr"
|
||||||
|
},
|
||||||
|
"Rc::new": {
|
||||||
|
"postfix": "rc",
|
||||||
|
"body": "Rc::new(${receiver})",
|
||||||
|
"requires": "std::rc::Rc",
|
||||||
|
"description": "Put the expression into an `Rc`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -728,8 +728,8 @@
|
||||||
"rust-analyzer.cargo.cfgs": {
|
"rust-analyzer.cargo.cfgs": {
|
||||||
"markdownDescription": "List of cfg options to enable with the given values.",
|
"markdownDescription": "List of cfg options to enable with the given values.",
|
||||||
"default": {
|
"default": {
|
||||||
"debug_assertions": null,
|
"miri": null,
|
||||||
"miri": null
|
"debug_assertions": null
|
||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
|
@ -1152,18 +1152,10 @@
|
||||||
"rust-analyzer.completion.snippets.custom": {
|
"rust-analyzer.completion.snippets.custom": {
|
||||||
"markdownDescription": "Custom completion snippets.",
|
"markdownDescription": "Custom completion snippets.",
|
||||||
"default": {
|
"default": {
|
||||||
"Arc::new": {
|
"Ok": {
|
||||||
"postfix": "arc",
|
"postfix": "ok",
|
||||||
"body": "Arc::new(${receiver})",
|
"body": "Ok(${receiver})",
|
||||||
"requires": "std::sync::Arc",
|
"description": "Wrap the expression in a `Result::Ok`",
|
||||||
"description": "Put the expression into an `Arc`",
|
|
||||||
"scope": "expr"
|
|
||||||
},
|
|
||||||
"Rc::new": {
|
|
||||||
"postfix": "rc",
|
|
||||||
"body": "Rc::new(${receiver})",
|
|
||||||
"requires": "std::rc::Rc",
|
|
||||||
"description": "Put the expression into an `Rc`",
|
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Box::pin": {
|
"Box::pin": {
|
||||||
|
@ -1173,10 +1165,11 @@
|
||||||
"description": "Put the expression into a pinned `Box`",
|
"description": "Put the expression into a pinned `Box`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Err": {
|
"Arc::new": {
|
||||||
"postfix": "err",
|
"postfix": "arc",
|
||||||
"body": "Err(${receiver})",
|
"body": "Arc::new(${receiver})",
|
||||||
"description": "Wrap the expression in a `Result::Err`",
|
"requires": "std::sync::Arc",
|
||||||
|
"description": "Put the expression into an `Arc`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Some": {
|
"Some": {
|
||||||
|
@ -1185,10 +1178,17 @@
|
||||||
"description": "Wrap the expression in an `Option::Some`",
|
"description": "Wrap the expression in an `Option::Some`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
},
|
},
|
||||||
"Ok": {
|
"Err": {
|
||||||
"postfix": "ok",
|
"postfix": "err",
|
||||||
"body": "Ok(${receiver})",
|
"body": "Err(${receiver})",
|
||||||
"description": "Wrap the expression in a `Result::Ok`",
|
"description": "Wrap the expression in a `Result::Err`",
|
||||||
|
"scope": "expr"
|
||||||
|
},
|
||||||
|
"Rc::new": {
|
||||||
|
"postfix": "rc",
|
||||||
|
"body": "Rc::new(${receiver})",
|
||||||
|
"requires": "std::rc::Rc",
|
||||||
|
"description": "Put the expression into an `Rc`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue