This commit is contained in:
Lukas Wirth 2023-12-08 13:19:34 +01:00
parent 6abba17a5b
commit 1475848250
15 changed files with 516 additions and 550 deletions

View file

@ -940,9 +940,9 @@ impl Foo { fn foo(&self) { $0 } }"#,
expect![[r#" expect![[r#"
fd self.field i32 fd self.field i32
lc self &Foo lc self &Foo
sp Self sp Self Foo
st Foo st Foo Foo
bt u32 bt u32 u32
me self.foo() fn(&self) me self.foo() fn(&self)
"#]], "#]],
); );
@ -954,9 +954,9 @@ impl Foo { fn foo(&mut self) { $0 } }"#,
expect![[r#" expect![[r#"
fd self.0 i32 fd self.0 i32
lc self &mut Foo lc self &mut Foo
sp Self sp Self Foo
st Foo st Foo Foo
bt u32 bt u32 u32
me self.foo() fn(&mut self) me self.foo() fn(&mut self)
"#]], "#]],
); );

View file

@ -417,10 +417,10 @@ impl Test for T {
} }
", ",
expect![[r#" expect![[r#"
sp Self sp Self T
st T st T T
tt Test tt Test
bt u32 bt u32 u32
"#]], "#]],
); );
@ -526,10 +526,10 @@ impl Test for T {
} }
", ",
expect![[r#" expect![[r#"
sp Self sp Self T
st T st T T
tt Test tt Test
bt u32 bt u32 u32
"#]], "#]],
); );
@ -543,10 +543,10 @@ impl Test for T {
} }
", ",
expect![[r#" expect![[r#"
sp Self sp Self T
st T st T T
tt Test tt Test
bt u32 bt u32 u32
"#]], "#]],
); );
@ -562,10 +562,10 @@ impl Test for T {
} }
", ",
expect![[r#" expect![[r#"
sp Self sp Self T
st T st T T
tt Test tt Test
bt u32 bt u32 u32
"#]], "#]],
); );
@ -610,10 +610,10 @@ impl Test for T {
} }
", ",
expect![[r#" expect![[r#"
sp Self sp Self T
st T st T T
tt Test tt Test
bt u32 bt u32 u32
"#]], "#]],
); );

View file

@ -71,9 +71,9 @@ pub(crate) fn complete_use_path(
if add_resolution { if add_resolution {
let mut builder = Builder::from_resolution(ctx, path_ctx, name, def); let mut builder = Builder::from_resolution(ctx, path_ctx, name, def);
builder.set_relevance(CompletionRelevance { builder.with_relevance(|r| CompletionRelevance {
is_name_already_imported, is_name_already_imported,
..Default::default() ..r
}); });
acc.add(builder.build(ctx.db)); acc.add(builder.build(ctx.db));
} }

View file

@ -1,6 +1,6 @@
//! See `CompletionItem` structure. //! See `CompletionItem` structure.
use std::fmt; use std::{fmt, mem};
use hir::Mutability; use hir::Mutability;
use ide_db::{ use ide_db::{
@ -570,6 +570,13 @@ impl Builder {
self.relevance = relevance; self.relevance = relevance;
self self
} }
pub(crate) fn with_relevance(
&mut self,
relevance: impl FnOnce(CompletionRelevance) -> CompletionRelevance,
) -> &mut Builder {
self.relevance = relevance(mem::take(&mut self.relevance));
self
}
pub(crate) fn trigger_call_info(&mut self) -> &mut Builder { pub(crate) fn trigger_call_info(&mut self) -> &mut Builder {
self.trigger_call_info = true; self.trigger_call_info = true;
self self

View file

@ -10,7 +10,7 @@ pub(crate) mod variant;
pub(crate) mod union_literal; pub(crate) mod union_literal;
pub(crate) mod literal; pub(crate) mod literal;
use hir::{AsAssocItem, Function, HasAttrs, HirDisplay, ModuleDef, ScopeDef, Type}; use hir::{AsAssocItem, HasAttrs, HirDisplay, ModuleDef, ScopeDef, Type};
use ide_db::{ use ide_db::{
documentation::{Documentation, HasDocs}, documentation::{Documentation, HasDocs},
helpers::item_name, helpers::item_name,
@ -393,10 +393,10 @@ fn render_resolution_path(
ScopeDef::ModuleDef(ModuleDef::Adt(adt)) | ScopeDef::AdtSelfType(adt) => { ScopeDef::ModuleDef(ModuleDef::Adt(adt)) | ScopeDef::AdtSelfType(adt) => {
set_item_relevance(adt.ty(db)) set_item_relevance(adt.ty(db))
} }
// Functions are handled at the start of the function. // Filtered out above
ScopeDef::ModuleDef(ModuleDef::Function(_)) => (), // TODO: Should merge with the match case earlier in the function? ScopeDef::ModuleDef(
// Enum variants are handled at the start of the function. ModuleDef::Function(_) | ModuleDef::Variant(_) | ModuleDef::Macro(_),
ScopeDef::ModuleDef(ModuleDef::Variant(_)) => (), ) => (),
ScopeDef::ModuleDef(ModuleDef::Const(konst)) => set_item_relevance(konst.ty(db)), ScopeDef::ModuleDef(ModuleDef::Const(konst)) => set_item_relevance(konst.ty(db)),
ScopeDef::ModuleDef(ModuleDef::Static(stat)) => set_item_relevance(stat.ty(db)), ScopeDef::ModuleDef(ModuleDef::Static(stat)) => set_item_relevance(stat.ty(db)),
ScopeDef::ModuleDef(ModuleDef::BuiltinType(bt)) => set_item_relevance(bt.ty(db)), ScopeDef::ModuleDef(ModuleDef::BuiltinType(bt)) => set_item_relevance(bt.ty(db)),
@ -404,11 +404,12 @@ fn render_resolution_path(
ScopeDef::GenericParam(_) ScopeDef::GenericParam(_)
| ScopeDef::Label(_) | ScopeDef::Label(_)
| ScopeDef::Unknown | ScopeDef::Unknown
| ScopeDef::ModuleDef(ModuleDef::Trait(_)) | ScopeDef::ModuleDef(
| ScopeDef::ModuleDef(ModuleDef::TraitAlias(_)) ModuleDef::Trait(_)
| ScopeDef::ModuleDef(ModuleDef::Macro(_)) | ModuleDef::TraitAlias(_)
| ScopeDef::ModuleDef(ModuleDef::Module(_)) | ModuleDef::Module(_)
| ScopeDef::ModuleDef(ModuleDef::TypeAlias(_)) => (), | ModuleDef::TypeAlias(_),
) => (),
}; };
item item
@ -497,6 +498,7 @@ fn scope_def_is_deprecated(ctx: &RenderContext<'_>, resolution: ScopeDef) -> boo
} }
} }
// FIXME: This checks types without possible coercions which some completions might want to do
fn match_types( fn match_types(
ctx: &CompletionContext<'_>, ctx: &CompletionContext<'_>,
ty1: &hir::Type, ty1: &hir::Type,
@ -526,41 +528,6 @@ fn compute_type_match(
match_types(ctx, expected_type, completion_ty) match_types(ctx, expected_type, completion_ty)
} }
fn compute_function_type_match(
ctx: &CompletionContext<'_>,
func: &Function,
) -> Option<CompletionRelevanceTypeMatch> {
// We compute a vec of function parameters + the return type for the expected
// type as well as the function we are matching with. Doing this allows for
// matching all of the types in one iterator.
let expected_callable = ctx.expected_type.as_ref()?.as_callable(ctx.db)?;
let expected_types = expected_callable.params(ctx.db).into_iter().map(|param| param.1);
let actual_types =
func.ty(ctx.db).as_callable(ctx.db)?.params(ctx.db).into_iter().map(|param| param.1);
if expected_types.len() != actual_types.len() {
return None;
}
let mut matches = expected_types
.zip(actual_types)
.chain([(expected_callable.return_type(), func.ret_type(ctx.db))])
.map(|(expected_type, actual_type)| match_types(ctx, &expected_type, &actual_type));
// Any missing type match indicates that these types can not be unified.
if matches.any(|type_match| type_match.is_none()) {
return None;
}
// If any of the types are unifiable but not exact we consider the function types as a whole
// to be unifiable. Otherwise if every pair of types is an exact match the functions are an
// exact type match.
matches
.find(|type_match| matches!(type_match, Some(CompletionRelevanceTypeMatch::CouldUnify)))
.unwrap_or(Some(CompletionRelevanceTypeMatch::Exact))
}
fn compute_exact_name_match(ctx: &CompletionContext<'_>, completion_name: &str) -> bool { fn compute_exact_name_match(ctx: &CompletionContext<'_>, completion_name: &str) -> bool {
ctx.expected_name.as_ref().map_or(false, |name| name.text() == completion_name) ctx.expected_name.as_ref().map_or(false, |name| name.text() == completion_name)
} }
@ -745,16 +712,16 @@ fn main() {
pub mod test_mod_b { pub mod test_mod_b {
pub union Union { pub union Union {
a: i32, a: i32,
b: i32 b: i32
} }
} }
pub mod test_mod_a { pub mod test_mod_a {
pub enum Union { pub enum Union {
a: i32, a: i32,
b: i32 b: i32
} }
} }
//- /main.rs crate:main deps:dep //- /main.rs crate:main deps:dep
@ -783,14 +750,14 @@ fn main() {
pub mod test_mod_b { pub mod test_mod_b {
pub enum Enum { pub enum Enum {
variant variant
} }
} }
pub mod test_mod_a { pub mod test_mod_a {
pub enum Enum { pub enum Enum {
variant variant
} }
} }
//- /main.rs crate:main deps:dep //- /main.rs crate:main deps:dep
@ -812,7 +779,6 @@ fn main() {
); );
} }
// TODO: How dowe test ModuleDef::Variant(Variant?)
#[test] #[test]
fn set_enum_variant_type_completion_info() { fn set_enum_variant_type_completion_info() {
check_relevance( check_relevance(
@ -821,14 +787,14 @@ fn main() {
pub mod test_mod_b { pub mod test_mod_b {
pub enum Enum { pub enum Enum {
Variant Variant
} }
} }
pub mod test_mod_a { pub mod test_mod_a {
pub enum Enum { pub enum Enum {
Variant Variant
} }
} }
//- /main.rs crate:main deps:dep //- /main.rs crate:main deps:dep
@ -836,16 +802,14 @@ pub mod test_mod_a {
fn test(input: dep::test_mod_b::Enum) { } fn test(input: dep::test_mod_b::Enum) { }
fn main() { fn main() {
test(Enum::Variant$0); test(Variant$0);
} }
"#, "#,
expect![[r#" expect![[r#"
ev dep::test_mod_b::Enum::Variant [type_could_unify] ev dep::test_mod_b::Enum::Variant [type_could_unify]
en Enum (use dep::test_mod_b::Enum) [type_could_unify+requires_import]
fn main() [] fn main() []
fn test() [] fn test() []
md dep [] md dep []
en Enum (use dep::test_mod_a::Enum) [requires_import]
"#]], "#]],
); );
} }
@ -857,13 +821,11 @@ fn main() {
//- /lib.rs crate:dep //- /lib.rs crate:dep
pub mod test_mod_b { pub mod test_mod_b {
pub fn Function(j: isize) -> i32 { pub fn function(j: isize) -> i32 {}
}
} }
pub mod test_mod_a { pub mod test_mod_a {
pub fn Function(i: usize) -> i32 { pub fn function(i: usize) -> i32 {}
}
} }
//- /main.rs crate:main deps:dep //- /main.rs crate:main deps:dep
@ -871,15 +833,15 @@ pub mod test_mod_b {
fn test(input: fn(usize) -> i32) { } fn test(input: fn(usize) -> i32) { }
fn main() { fn main() {
test(Function$0); test(function$0);
} }
"#, "#,
expect![[r#" expect![[r#"
fn Function (use dep::test_mod_a::Function) [type+requires_import]
fn main [] fn main []
fn test [] fn test []
md dep [] md dep []
fn Function (use dep::test_mod_b::Function) [requires_import] fn function (use dep::test_mod_a::function) [requires_import]
fn function (use dep::test_mod_b::function) [requires_import]
"#]], "#]],
); );
} }
@ -891,11 +853,11 @@ fn main() {
//- /lib.rs crate:dep //- /lib.rs crate:dep
pub mod test_mod_b { pub mod test_mod_b {
pub const CONST: i32 = 1; pub const CONST: i32 = 1;
} }
pub mod test_mod_a { pub mod test_mod_a {
pub const CONST: i64 = 2; pub const CONST: i64 = 2;
} }
//- /main.rs crate:main deps:dep //- /main.rs crate:main deps:dep
@ -923,11 +885,11 @@ fn main() {
//- /lib.rs crate:dep //- /lib.rs crate:dep
pub mod test_mod_b { pub mod test_mod_b {
pub static STATIC: i32 = 5; pub static STATIC: i32 = 5;
} }
pub mod test_mod_a { pub mod test_mod_a {
pub static STATIC: i64 = 5; pub static STATIC: i64 = 5;
} }
//- /main.rs crate:main deps:dep //- /main.rs crate:main deps:dep
@ -975,7 +937,7 @@ fn main() {
"#, "#,
expect![[r#" expect![[r#"
me Function [type] me Function []
"#]], "#]],
); );
} }
@ -990,7 +952,7 @@ struct Struct;
impl Struct { impl Struct {
fn test(&self) { fn test(&self) {
func(Self$0); func(Self$0);
} }
} }
@ -1013,14 +975,14 @@ fn func(input: Struct) { }
fn set_builtin_type_completion_info() { fn set_builtin_type_completion_info() {
check_relevance( check_relevance(
r#" r#"
//- /main.rs crate:main //- /main.rs crate:main
fn test(input: bool) { } fn test(input: bool) { }
pub Input: bool = false; pub Input: bool = false;
fn main() { fn main() {
let input = false; let input = false;
let inputbad = 3; let inputbad = 3;
test(inp$0); test(inp$0);
} }
"#, "#,
@ -1424,6 +1386,7 @@ use self::E::*;
kind: SymbolKind( kind: SymbolKind(
Enum, Enum,
), ),
detail: "E",
documentation: Documentation( documentation: Documentation(
"enum docs", "enum docs",
), ),
@ -1668,6 +1631,7 @@ fn go(world: &WorldSnapshot) { go(w$0) }
st WorldSnapshot {} [] st WorldSnapshot {} []
st &WorldSnapshot {} [type] st &WorldSnapshot {} [type]
st WorldSnapshot [] st WorldSnapshot []
st &WorldSnapshot [type]
fn go() [] fn go() []
"#]], "#]],
); );
@ -1767,6 +1731,7 @@ fn main() {
st S [] st S []
st &mut S [type] st &mut S [type]
st S [] st S []
st &mut S [type]
fn foo() [] fn foo() []
fn main() [] fn main() []
"#]], "#]],
@ -1783,7 +1748,7 @@ fn main() {
expect![[r#" expect![[r#"
lc s [type+name+local] lc s [type+name+local]
st S [type] st S [type]
st S [] st S [type]
fn foo() [] fn foo() []
fn main() [] fn main() []
"#]], "#]],
@ -1800,7 +1765,7 @@ fn main() {
expect![[r#" expect![[r#"
lc ssss [type+local] lc ssss [type+local]
st S [type] st S [type]
st S [] st S [type]
fn foo() [] fn foo() []
fn main() [] fn main() []
"#]], "#]],
@ -1839,7 +1804,9 @@ fn main() {
st S [] st S []
st &S [type] st &S [type]
st S [] st S []
st &S [type]
st T [] st T []
st &T [type]
fn foo() [] fn foo() []
fn main() [] fn main() []
md core [] md core []
@ -1885,7 +1852,9 @@ fn main() {
st S [] st S []
st &mut S [type] st &mut S [type]
st S [] st S []
st &mut S [type]
st T [] st T []
st &mut T [type]
fn foo() [] fn foo() []
fn main() [] fn main() []
md core [] md core []
@ -1924,7 +1893,7 @@ fn bar(t: Foo) {}
expect![[r#" expect![[r#"
ev Foo::A [type] ev Foo::A [type]
ev Foo::B [type] ev Foo::B [type]
en Foo [] en Foo [type]
fn bar() [] fn bar() []
fn foo() [] fn foo() []
"#]], "#]],
@ -1947,6 +1916,7 @@ fn bar(t: &Foo) {}
ev Foo::B [] ev Foo::B []
ev &Foo::B [type] ev &Foo::B [type]
en Foo [] en Foo []
en &Foo [type]
fn bar() [] fn bar() []
fn foo() [] fn foo() []
"#]], "#]],
@ -1980,7 +1950,9 @@ fn main() {
st S [] st S []
st &S [type] st &S [type]
st S [] st S []
st &S [type]
st T [] st T []
st &T [type]
fn bar() [] fn bar() []
fn &bar() [type] fn &bar() [type]
fn foo() [] fn foo() []
@ -2189,8 +2161,8 @@ fn foo() {
lc foo [type+local] lc foo [type+local]
ev Foo::A() [type_could_unify] ev Foo::A() [type_could_unify]
ev Foo::B [type_could_unify] ev Foo::B [type_could_unify]
en Foo [type_could_unify]
fn foo() [] fn foo() []
en Foo []
fn bar() [] fn bar() []
fn baz() [] fn baz() []
"#]], "#]],

View file

@ -9,9 +9,7 @@ use syntax::{AstNode, SmolStr};
use crate::{ use crate::{
context::{CompletionContext, DotAccess, DotAccessKind, PathCompletionCtx, PathKind}, context::{CompletionContext, DotAccess, DotAccessKind, PathCompletionCtx, PathKind},
item::{Builder, CompletionItem, CompletionItemKind, CompletionRelevance}, item::{Builder, CompletionItem, CompletionItemKind, CompletionRelevance},
render::{ render::{compute_exact_name_match, compute_ref_match, compute_type_match, RenderContext},
compute_exact_name_match, compute_function_type_match, compute_ref_match, RenderContext,
},
CallableSnippets, CallableSnippets,
}; };
@ -81,8 +79,30 @@ fn render(
.and_then(|trait_| trait_.containing_trait_or_trait_impl(ctx.db())) .and_then(|trait_| trait_.containing_trait_or_trait_impl(ctx.db()))
.map_or(false, |trait_| completion.is_ops_trait(trait_)); .map_or(false, |trait_| completion.is_ops_trait(trait_));
let (has_dot_receiver, has_call_parens, cap) = match func_kind {
FuncKind::Function(&PathCompletionCtx {
kind: PathKind::Expr { .. },
has_call_parens,
..
}) => (false, has_call_parens, ctx.completion.config.snippet_cap),
FuncKind::Method(&DotAccess { kind: DotAccessKind::Method { has_parens }, .. }, _) => {
(true, has_parens, ctx.completion.config.snippet_cap)
}
FuncKind::Method(DotAccess { kind: DotAccessKind::Field { .. }, .. }, _) => {
(true, false, ctx.completion.config.snippet_cap)
}
_ => (false, false, None),
};
let complete_call_parens = cap
.filter(|_| !has_call_parens)
.and_then(|cap| Some((cap, params(ctx.completion, func, &func_kind, has_dot_receiver)?)));
item.set_relevance(CompletionRelevance { item.set_relevance(CompletionRelevance {
type_match: compute_function_type_match(completion, &func), type_match: if has_call_parens || complete_call_parens.is_some() {
compute_type_match(completion, &ret_type)
} else {
compute_type_match(completion, &func.ty(db))
},
exact_name_match: compute_exact_name_match(completion, &call), exact_name_match: compute_exact_name_match(completion, &call),
is_op_method, is_op_method,
..ctx.completion_relevance() ..ctx.completion_relevance()
@ -112,42 +132,9 @@ fn render(
.detail(detail) .detail(detail)
.lookup_by(name.unescaped().to_smol_str()); .lookup_by(name.unescaped().to_smol_str());
match ctx.completion.config.snippet_cap { if let Some((cap, (self_param, params))) = complete_call_parens {
Some(cap) => { add_call_parens(&mut item, completion, cap, call, escaped_call, self_param, params);
let complete_params = match func_kind { }
FuncKind::Function(PathCompletionCtx {
kind: PathKind::Expr { .. },
has_call_parens: false,
..
}) => Some(false),
FuncKind::Method(
DotAccess {
kind:
DotAccessKind::Method { has_parens: false } | DotAccessKind::Field { .. },
..
},
_,
) => Some(true),
_ => None,
};
if let Some(has_dot_receiver) = complete_params {
if let Some((self_param, params)) =
params(ctx.completion, func, &func_kind, has_dot_receiver)
{
add_call_parens(
&mut item,
completion,
cap,
call,
escaped_call,
self_param,
params,
);
}
}
}
_ => (),
};
match ctx.import_to_add { match ctx.import_to_add {
Some(import_to_add) => { Some(import_to_add) => {

View file

@ -26,22 +26,22 @@ fn baz() {
"#, "#,
// This should not contain `FooDesc {…}`. // This should not contain `FooDesc {…}`.
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
en Enum en Enum Enum
fn baz() fn() fn baz() fn()
fn create_foo() fn(&FooDesc) fn create_foo() fn(&FooDesc)
fn function() fn() fn function() fn()
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md _69latrick md _69latrick
md module md module
sc STATIC sc STATIC Unit
st FooDesc st FooDesc FooDesc
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
un Union un Union Union
ev TupleV() TupleV(u32) ev TupleV() TupleV(u32)
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -83,7 +83,7 @@ fn func(param0 @ (param1, param2): (i32, i32)) {
lc param0 (i32, i32) lc param0 (i32, i32)
lc param1 i32 lc param1 i32
lc param2 i32 lc param2 i32
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -117,24 +117,24 @@ impl Unit {
"#, "#,
// `self` is in here twice, once as the module, once as the local // `self` is in here twice, once as the module, once as the local
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
cp CONST_PARAM cp CONST_PARAM
en Enum en Enum Enum
fn function() fn() fn function() fn()
fn local_func() fn() fn local_func() fn()
lc self Unit lc self Unit
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
md qualified md qualified
sp Self sp Self Unit
sc STATIC sc STATIC Unit
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tp TypeParam tp TypeParam
un Union un Union Union
ev TupleV() TupleV(u32) ev TupleV() TupleV(u32)
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -181,18 +181,18 @@ impl Unit {
} }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
en Enum en Enum Enum
fn function() fn() fn function() fn()
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
md qualified md qualified
sc STATIC sc STATIC Unit
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
ev TupleV() TupleV(u32) ev TupleV() TupleV(u32)
?? Unresolved ?? Unresolved
"#]], "#]],
@ -211,7 +211,7 @@ fn complete_in_block() {
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -256,7 +256,7 @@ fn complete_after_if_expr() {
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw else kw else
@ -304,7 +304,7 @@ fn complete_in_match_arm() {
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -328,7 +328,7 @@ fn completes_in_loop_ctx() {
r"fn my() { loop { $0 } }", r"fn my() { loop { $0 } }",
expect![[r#" expect![[r#"
fn my() fn() fn my() fn()
bt u32 bt u32 u32
kw break kw break
kw const kw const
kw continue kw continue
@ -370,7 +370,7 @@ fn completes_in_let_initializer() {
r#"fn main() { let _ = $0 }"#, r#"fn main() { let _ = $0 }"#,
expect![[r#" expect![[r#"
fn main() fn() fn main() fn()
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -403,8 +403,8 @@ fn foo() {
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
st Foo st Foo Foo
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -439,7 +439,7 @@ fn foo() {
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
lc bar i32 lc bar i32
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -470,7 +470,7 @@ fn quux(x: i32) {
fn quux() fn(i32) fn quux() fn(i32)
lc x i32 lc x i32
ma m!() macro_rules! m ma m!() macro_rules! m
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -497,7 +497,7 @@ fn quux(x: i32) {
fn quux() fn(i32) fn quux() fn(i32)
lc x i32 lc x i32
ma m!() macro_rules! m ma m!() macro_rules! m
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -683,11 +683,11 @@ fn brr() {
} }
"#, "#,
expect![[r#" expect![[r#"
en HH en HH HH
fn brr() fn() fn brr() fn()
st YoloVariant st YoloVariant YoloVariant
st YoloVariant {} YoloVariant { f: usize } st YoloVariant {} YoloVariant { f: usize }
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -749,7 +749,7 @@ fn foo() { if foo {} $0 }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw else kw else
@ -789,7 +789,7 @@ fn foo() { if foo {} el$0 }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw else kw else
@ -829,7 +829,7 @@ fn foo() { bar(if foo {} $0) }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw crate:: kw crate::
kw else kw else
kw else if kw else if
@ -853,7 +853,7 @@ fn foo() { bar(if foo {} el$0) }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw crate:: kw crate::
kw else kw else
kw else if kw else if
@ -877,7 +877,7 @@ fn foo() { if foo {} $0 let x = 92; }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw else kw else
@ -917,7 +917,7 @@ fn foo() { if foo {} el$0 let x = 92; }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw else kw else
@ -957,7 +957,7 @@ fn foo() { if foo {} el$0 { let x = 92; } }
"#, "#,
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw else kw else
@ -1009,7 +1009,7 @@ pub struct UnstableThisShouldNotBeListed;
expect![[r#" expect![[r#"
fn main() fn() fn main() fn()
md std md std
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -1060,8 +1060,8 @@ pub struct UnstableButWeAreOnNightlyAnyway;
expect![[r#" expect![[r#"
fn main() fn() fn main() fn()
md std md std
st UnstableButWeAreOnNightlyAnyway st UnstableButWeAreOnNightlyAnyway UnstableButWeAreOnNightlyAnyway
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum

View file

@ -139,10 +139,10 @@ fn main() {
} }
"#, "#,
expect![[r#" expect![[r#"
st Rc (use dep::Rc) st Rc (use dep::Rc) Rc
st Rcar (use dep::Rcar) st Rcar (use dep::Rcar) Rcar
st Rc (use dep::some_module::Rc) st Rc (use dep::some_module::Rc) Rc
st Rcar (use dep::some_module::Rcar) st Rcar (use dep::some_module::Rcar) Rcar
"#]], "#]],
); );
check( check(
@ -165,12 +165,12 @@ fn main() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct RC (use dep::RC) ct RC (use dep::RC) ()
st Rc (use dep::Rc) st Rc (use dep::Rc) Rc
st Rcar (use dep::Rcar) st Rcar (use dep::Rcar) Rcar
ct RC (use dep::some_module::RC) ct RC (use dep::some_module::RC) ()
st Rc (use dep::some_module::Rc) st Rc (use dep::some_module::Rc) Rc
st Rcar (use dep::some_module::Rcar) st Rcar (use dep::some_module::Rcar) Rcar
"#]], "#]],
); );
check( check(
@ -193,8 +193,8 @@ fn main() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct RC (use dep::RC) ct RC (use dep::RC) ()
ct RC (use dep::some_module::RC) ct RC (use dep::some_module::RC) ()
"#]], "#]],
); );
} }
@ -227,10 +227,10 @@ fn main() {
} }
"#, "#,
expect![[r#" expect![[r#"
st ThirdStruct (use dep::some_module::ThirdStruct) st ThirdStruct (use dep::some_module::ThirdStruct) ThirdStruct
st AfterThirdStruct (use dep::some_module::AfterThirdStruct) st AfterThirdStruct (use dep::some_module::AfterThirdStruct) AfterThirdStruct
st ThiiiiiirdStruct (use dep::some_module::ThiiiiiirdStruct) st ThiiiiiirdStruct (use dep::some_module::ThiiiiiirdStruct) ThiiiiiirdStruct
"#]], "#]],
); );
} }
@ -309,7 +309,7 @@ fn trait_const_fuzzy_completion() {
check( check(
fixture, fixture,
expect![[r#" expect![[r#"
ct SPECIAL_CONST (use dep::test_mod::TestTrait) ct SPECIAL_CONST (use dep::test_mod::TestTrait) u8
"#]], "#]],
); );
@ -597,7 +597,7 @@ fn main() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct SPECIAL_CONST (use dep::test_mod::TestTrait) DEPRECATED ct SPECIAL_CONST (use dep::test_mod::TestTrait) u8 DEPRECATED
fn weird_function() (use dep::test_mod::TestTrait) fn() DEPRECATED fn weird_function() (use dep::test_mod::TestTrait) fn() DEPRECATED
"#]], "#]],
); );
@ -717,7 +717,7 @@ fn main() {
check( check(
fixture, fixture,
expect![[r#" expect![[r#"
st Item (use foo::bar::baz::Item) st Item (use foo::bar::baz::Item) Item
"#]], "#]],
); );
@ -759,7 +759,7 @@ fn main() {
check( check(
fixture, fixture,
expect![[r#" expect![[r#"
ct TEST_ASSOC (use foo::Item) ct TEST_ASSOC (use foo::Item) usize
"#]], "#]],
); );
@ -803,8 +803,8 @@ fn main() {
check( check(
fixture, fixture,
expect![[r#" expect![[r#"
ct TEST_ASSOC (use foo::bar::Item) ct TEST_ASSOC (use foo::bar::Item) usize
"#]], "#]],
); );
check_edit( check_edit(
@ -897,7 +897,7 @@ fn main() {
TES$0 TES$0
}"#, }"#,
expect![[r#" expect![[r#"
ct TEST_CONST (use foo::TEST_CONST) ct TEST_CONST (use foo::TEST_CONST) usize
"#]], "#]],
); );
@ -914,7 +914,7 @@ fn main() {
tes$0 tes$0
}"#, }"#,
expect![[r#" expect![[r#"
ct TEST_CONST (use foo::TEST_CONST) ct TEST_CONST (use foo::TEST_CONST) usize
fn test_function() (use foo::test_function) fn() -> i32 fn test_function() (use foo::test_function) fn() -> i32
"#]], "#]],
); );
@ -1138,8 +1138,8 @@ mod mud {
} }
"#, "#,
expect![[r#" expect![[r#"
st Struct (use crate::Struct) st Struct (use crate::Struct) Struct
"#]], "#]],
); );
} }
@ -1250,7 +1250,7 @@ enum Foo {
} }
}"#, }"#,
expect![[r#" expect![[r#"
st Barbara (use foo::Barbara) st Barbara (use foo::Barbara) Barbara
"#]], "#]],
) )
} }

View file

@ -18,15 +18,15 @@ fn target_type_or_trait_in_impl_block() {
impl Tra$0 impl Tra$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -40,15 +40,15 @@ fn target_type_in_trait_impl_block() {
impl Trait for Str$0 impl Trait for Str$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],

View file

@ -435,7 +435,7 @@ fn foo() {
} }
"#, "#,
expect![[r#" expect![[r#"
st Bar st Bar Bar
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -450,7 +450,7 @@ fn foo() {
} }
"#, "#,
expect![[r#" expect![[r#"
st Foo st Foo Foo
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],

View file

@ -16,16 +16,16 @@ fn predicate_start() {
struct Foo<'lt, T, const C: usize> where $0 {} struct Foo<'lt, T, const C: usize> where $0 {}
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo<> st Foo<> Foo<'_, {unknown}, _>
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -89,16 +89,16 @@ fn param_list_for_for_pred() {
struct Foo<'lt, T, const C: usize> where for<'a> $0 {} struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo<> st Foo<> Foo<'_, {unknown}, _>
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -114,16 +114,16 @@ impl Record {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
sp Self sp Self Record
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],

View file

@ -186,10 +186,10 @@ fn main() {
lc foo Foo lc foo Foo
lc thing i32 lc thing i32
md core md core
st Foo st Foo Foo
st Foo {} Foo { foo1: u32, foo2: u32 } st Foo {} Foo { foo1: u32, foo2: u32 }
tt Default tt Default
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],

View file

@ -84,10 +84,10 @@ pub mod prelude {
} }
"#, "#,
expect![[r#" expect![[r#"
md std md std
st Option st Option Option
bt u32 bt u32 u32
"#]], "#]],
); );
} }
@ -112,11 +112,11 @@ mod macros {
} }
"#, "#,
expect![[r#" expect![[r#"
fn f() fn() fn f() fn()
ma concat!() macro_rules! concat ma concat!() macro_rules! concat
md std md std
bt u32 bt u32 u32
"#]], "#]],
); );
} }
@ -142,11 +142,11 @@ pub mod prelude {
} }
"#, "#,
expect![[r#" expect![[r#"
md core md core
md std md std
st String st String String
bt u32 bt u32 u32
"#]], "#]],
); );
} }
@ -171,10 +171,10 @@ pub mod prelude {
} }
"#, "#,
expect![[r#" expect![[r#"
fn f() fn() fn f() fn()
md std md std
bt u32 bt u32 u32
"#]], "#]],
); );
} }
@ -446,10 +446,10 @@ mod p {
} }
"#, "#,
expect![[r#" expect![[r#"
ct RIGHT_CONST ct RIGHT_CONST u32
fn right_fn() fn() fn right_fn() fn()
st RightType st RightType WrongType
"#]], "#]],
); );
check_edit( check_edit(
@ -881,7 +881,7 @@ fn main() {
fn main() fn() fn main() fn()
lc foobar i32 lc foobar i32
ma x!() macro_rules! x ma x!() macro_rules! x
bt u32 bt u32 u32
"#]], "#]],
) )
} }
@ -1008,8 +1008,8 @@ fn here_we_go() {
"#, "#,
expect![[r#" expect![[r#"
fn here_we_go() fn() fn here_we_go() fn()
st Foo (alias Bar) st Foo (alias Bar) Foo
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -1057,8 +1057,8 @@ fn here_we_go() {
"#, "#,
expect![[r#" expect![[r#"
fn here_we_go() fn() fn here_we_go() fn()
st Foo (alias Bar, Qux, Baz) st Foo (alias Bar, Qux, Baz) Foo
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -1178,7 +1178,7 @@ fn bar() { qu$0 }
expect![[r#" expect![[r#"
fn bar() fn() fn bar() fn()
fn foo() (alias qux) fn() fn foo() (alias qux) fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -1227,7 +1227,7 @@ fn here_we_go() {
} }
"#, "#,
expect![[r#" expect![[r#"
st Bar (alias Qux) st Bar (alias Qux) Bar
"#]], "#]],
); );
} }
@ -1246,7 +1246,7 @@ fn here_we_go() {
} }
"#, "#,
expect![[r#" expect![[r#"
st Bar (alias Qux) st Bar (alias Qux) Bar
"#]], "#]],
); );
} }
@ -1267,8 +1267,8 @@ fn here_we_go() {
expect![[r#" expect![[r#"
fn here_we_go() fn() fn here_we_go() fn()
md foo md foo
st Bar (alias Qux) (use foo::Bar) st Bar (alias Qux) (use foo::Bar) Bar
bt u32 bt u32 u32
kw crate:: kw crate::
kw false kw false
kw for kw for
@ -1409,7 +1409,7 @@ fn foo() {
Some('_'), Some('_'),
expect![[r#" expect![[r#"
fn foo() fn() fn foo() fn()
bt u32 bt u32 u32
kw const kw const
kw crate:: kw crate::
kw enum kw enum
@ -1461,7 +1461,7 @@ fn foo(_: a_$0) { }
"#, "#,
Some('_'), Some('_'),
expect![[r#" expect![[r#"
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -1475,7 +1475,7 @@ fn foo<T>() {
Some('_'), Some('_'),
expect![[r#" expect![[r#"
tp T tp T
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],

View file

@ -17,18 +17,18 @@ struct Foo<'lt, T, const C: usize> {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
sp Self sp Self Foo<'_, {unknown}, _>
st Foo<> st Foo<> Foo<'_, {unknown}, _>
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -42,18 +42,18 @@ fn tuple_struct_field() {
struct Foo<'lt, T, const C: usize>(f$0); struct Foo<'lt, T, const C: usize>(f$0);
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
sp Self sp Self Foo<'_, {unknown}, _>
st Foo<> st Foo<> Foo<'_, {unknown}, _>
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw pub kw pub
kw pub(crate) kw pub(crate)
@ -70,16 +70,16 @@ fn fn_return_type() {
fn x<'lt, T, const C: usize>() -> $0 fn x<'lt, T, const C: usize>() -> $0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -100,19 +100,19 @@ fn foo() -> B$0 {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
it () it ()
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
) )
} }
@ -124,16 +124,16 @@ struct Foo<T>(T);
const FOO: $0 = Foo(2); const FOO: $0 = Foo(2);
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo<> st Foo<> Foo<{unknown}>
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
it Foo<i32> it Foo<i32>
kw crate:: kw crate::
kw self:: kw self::
@ -151,15 +151,15 @@ fn f2() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
it i32 it i32
kw crate:: kw crate::
kw self:: kw self::
@ -179,15 +179,15 @@ fn f2() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
it u64 it u64
kw crate:: kw crate::
kw self:: kw self::
@ -204,15 +204,15 @@ fn f2(x: u64) -> $0 {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
it u64 it u64
kw crate:: kw crate::
kw self:: kw self::
@ -230,15 +230,15 @@ fn f2(x: $0) {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
it i32 it i32
kw crate:: kw crate::
kw self:: kw self::
@ -262,17 +262,17 @@ fn foo<'lt, T, const C: usize>() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md a md a
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
it a::Foo<a::Foo<i32>> it a::Foo<a::Foo<i32>>
kw crate:: kw crate::
kw self:: kw self::
@ -291,17 +291,17 @@ fn foo<'lt, T, const C: usize>() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo<> st Foo<> Foo<{unknown}>
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
it Foo<i32> it Foo<i32>
kw crate:: kw crate::
kw self:: kw self::
@ -319,16 +319,16 @@ fn foo<'lt, T, const C: usize>() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -341,14 +341,14 @@ fn foo<'lt, T, const C: usize>() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
"#]], "#]],
); );
} }
@ -384,18 +384,18 @@ trait Trait2<T>: Trait1 {
fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {} fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {}
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tt Trait1 tt Trait1
tt Trait2 tt Trait2
tp T tp T
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -409,15 +409,15 @@ trait Trait2<T> {
fn foo<'lt, T: Trait2<self::$0>, const CONST_PARAM: usize>(_: T) {} fn foo<'lt, T: Trait2<self::$0>, const CONST_PARAM: usize>(_: T) {}
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
tt Trait2 tt Trait2
un Union un Union Union
"#]], "#]],
); );
} }
@ -434,18 +434,18 @@ trait Tr<T> {
impl Tr<$0 impl Tr<$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
sp Self sp Self dyn Tr<{unknown}>
st Record st Record Record
st S st S S
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Tr tt Tr
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -481,16 +481,16 @@ trait MyTrait<T, U> {
fn f(t: impl MyTrait<u$0 fn f(t: impl MyTrait<u$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt MyTrait tt MyTrait
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -506,16 +506,16 @@ trait MyTrait<T, U> {
fn f(t: impl MyTrait<u8, u$0 fn f(t: impl MyTrait<u8, u$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt MyTrait tt MyTrait
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -549,16 +549,16 @@ trait MyTrait<T, U = u8> {
fn f(t: impl MyTrait<u$0 fn f(t: impl MyTrait<u$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt MyTrait tt MyTrait
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -574,18 +574,18 @@ trait MyTrait<T, U = u8> {
fn f(t: impl MyTrait<u8, u$0 fn f(t: impl MyTrait<u8, u$0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt MyTrait tt MyTrait
tt Trait tt Trait
ta Item1 = (as MyTrait) type Item1 ta Item1 = (as MyTrait) type Item1
ta Item2 = (as MyTrait) type Item2 ta Item2 = (as MyTrait) type Item2
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -619,16 +619,16 @@ trait MyTrait {
fn f(t: impl MyTrait<Item1 = $0 fn f(t: impl MyTrait<Item1 = $0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt MyTrait tt MyTrait
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -644,16 +644,16 @@ trait MyTrait {
fn f(t: impl MyTrait<Item1 = u8, Item2 = $0 fn f(t: impl MyTrait<Item1 = u8, Item2 = $0
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt MyTrait tt MyTrait
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -668,7 +668,7 @@ trait MyTrait {
fn f(t: impl MyTrait<C = $0 fn f(t: impl MyTrait<C = $0
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
@ -691,9 +691,9 @@ pub struct S;
"#, "#,
expect![[r#" expect![[r#"
md std md std
sp Self sp Self Foo
st Foo st Foo Foo
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -716,10 +716,10 @@ pub struct S;
"#, "#,
expect![[r#" expect![[r#"
md std md std
sp Self sp Self Foo
st Foo st Foo Foo
st S st S S
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
@ -739,19 +739,19 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo st Foo Foo
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// FIXME: This should probably also suggest completions for types, at least those that have // FIXME: This should probably also suggest completions for types, at least those that have
// associated constants usable in this position. For example, a user could be typing // associated constants usable in this position. For example, a user could be typing
@ -766,12 +766,12 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Method generic params // Method generic params
@ -785,19 +785,19 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo st Foo Foo
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
check( check(
r#" r#"
@ -809,12 +809,12 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Associated type generic params // Associated type generic params
@ -828,20 +828,20 @@ fn completes_const_and_type_generics_separately() {
fn foo(_: impl Bar<Baz<F$0, 0> = ()>) {} fn foo(_: impl Bar<Baz<F$0, 0> = ()>) {}
"#, "#,
expect![[r#" expect![[r#"
en Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo st Foo Foo
st Record st Record Record
st Tuple st Tuple Tuple
st Unit st Unit Unit
tt Bar tt Bar
tt Trait tt Trait
un Union un Union Union
bt u32 bt u32 u32
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
check( check(
r#" r#"
@ -853,12 +853,12 @@ fn completes_const_and_type_generics_separately() {
fn foo<T: Bar<Baz<(), $0> = ()>>() {} fn foo<T: Bar<Baz<(), $0> = ()>>() {}
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Type generic params // Type generic params
@ -871,12 +871,12 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Type alias generic params // Type alias generic params
@ -890,12 +890,12 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Enum variant params // Enum variant params
@ -908,12 +908,12 @@ fn completes_const_and_type_generics_separately() {
} }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Trait params // Trait params
@ -924,12 +924,12 @@ fn completes_const_and_type_generics_separately() {
impl Foo<(), $0> for () {} impl Foo<(), $0> for () {}
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Trait alias params // Trait alias params
@ -942,12 +942,12 @@ fn completes_const_and_type_generics_separately() {
fn foo<T: Bar<X$0, ()>>() {} fn foo<T: Bar<X$0, ()>>() {}
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ct X ct X usize
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
"#]], "#]],
); );
// Omitted lifetime params // Omitted lifetime params
@ -957,7 +957,7 @@ struct S<'a, 'b, const C: usize, T>(core::marker::PhantomData<&'a &'b T>);
fn foo<'a>() { S::<F$0, _>; } fn foo<'a>() { S::<F$0, _>; }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::
@ -970,7 +970,7 @@ struct S<'a, 'b, const C: usize, T>(core::marker::PhantomData<&'a &'b T>);
fn foo<'a>() { S::<'static, 'static, F$0, _>; } fn foo<'a>() { S::<'static, 'static, F$0, _>; }
"#, "#,
expect![[r#" expect![[r#"
ct CONST ct CONST Unit
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
kw crate:: kw crate::
kw self:: kw self::

View file

@ -65,7 +65,7 @@ use self::{foo::*, bar$0};
"#, "#,
expect![[r#" expect![[r#"
md foo md foo
st S st S S
"#]], "#]],
); );
} }
@ -82,7 +82,7 @@ mod foo {
use foo::{bar::$0} use foo::{bar::$0}
"#, "#,
expect![[r#" expect![[r#"
st FooBar st FooBar FooBar
"#]], "#]],
); );
check( check(
@ -115,7 +115,7 @@ mod foo {
use foo::{bar::{baz::$0}} use foo::{bar::{baz::$0}}
"#, "#,
expect![[r#" expect![[r#"
st FooBarBaz st FooBarBaz FooBarBaz
"#]], "#]],
); );
check( check(
@ -152,7 +152,7 @@ struct Bar;
"#, "#,
expect![[r#" expect![[r#"
ma foo macro_rules! foo_ ma foo macro_rules! foo_
st Foo st Foo Foo
"#]], "#]],
); );
} }
@ -193,7 +193,7 @@ struct Bar;
"#, "#,
expect![[r#" expect![[r#"
md foo md foo
st Bar st Bar Bar
"#]], "#]],
); );
} }
@ -212,7 +212,7 @@ struct Bar;
expect![[r#" expect![[r#"
md bar md bar
md foo md foo
st Bar st Bar Bar
"#]], "#]],
); );
} }
@ -230,7 +230,7 @@ mod a {
} }
"#, "#,
expect![[r#" expect![[r#"
ct A ct A usize
md b md b
kw super:: kw super::
"#]], "#]],
@ -248,7 +248,7 @@ struct Bar;
"#, "#,
expect![[r#" expect![[r#"
md foo md foo
st Bar st Bar Bar
"#]], "#]],
); );
} }
@ -265,7 +265,7 @@ pub mod foo {}
"#, "#,
expect![[r#" expect![[r#"
md foo md foo
st Foo st Foo Foo
"#]], "#]],
); );
} }
@ -425,7 +425,7 @@ marco_rules! m { () => {} }
expect![[r#" expect![[r#"
fn foo fn() fn foo fn()
md simd md simd
st S st S S
"#]], "#]],
); );
} }