mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Fix suggestions of unstable constants
This commit is contained in:
parent
3825d8bd0f
commit
51c3bd215a
3 changed files with 16 additions and 12 deletions
|
@ -17,8 +17,8 @@ use itertools::Itertools;
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Adt, AssocItem, GenericDef, GenericParam, HasVisibility, Impl, ModuleDef, ScopeDef, Type,
|
Adt, AssocItem, GenericDef, GenericParam, HasAttrs, HasVisibility, Impl, ModuleDef, ScopeDef,
|
||||||
TypeParam,
|
Type, TypeParam,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::term_search::Expr;
|
use crate::term_search::Expr;
|
||||||
|
@ -122,6 +122,10 @@ pub(super) fn assoc_const<'a, DB: HirDatabase>(
|
||||||
.filter(move |it| it.is_visible_from(db, module))
|
.filter(move |it| it.is_visible_from(db, module))
|
||||||
.filter_map(AssocItem::as_const)
|
.filter_map(AssocItem::as_const)
|
||||||
.filter_map(|it| {
|
.filter_map(|it| {
|
||||||
|
if it.attrs(db).is_unstable() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let expr = Expr::Const(it);
|
let expr = Expr::Const(it);
|
||||||
let ty = it.ty(db);
|
let ty = it.ty(db);
|
||||||
|
|
||||||
|
@ -472,7 +476,7 @@ pub(super) fn impl_method<'a, DB: HirDatabase>(
|
||||||
|
|
||||||
// Ignore functions with generics for now as they kill the performance
|
// Ignore functions with generics for now as they kill the performance
|
||||||
// Also checking bounds for generics is problematic
|
// Also checking bounds for generics is problematic
|
||||||
if fn_generics.type_or_const_params(db).len() > 0 {
|
if !fn_generics.type_or_const_params(db).is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +665,7 @@ pub(super) fn impl_static_method<'a, DB: HirDatabase>(
|
||||||
|
|
||||||
// Ignore functions with generics for now as they kill the performance
|
// Ignore functions with generics for now as they kill the performance
|
||||||
// Also checking bounds for generics is problematic
|
// Also checking bounds for generics is problematic
|
||||||
if fn_generics.type_or_const_params(db).len() > 0 {
|
if !fn_generics.type_or_const_params(db).is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ for enum variants.
|
||||||
--
|
--
|
||||||
Placeholder expression to use for missing expressions in assists.
|
Placeholder expression to use for missing expressions in assists.
|
||||||
--
|
--
|
||||||
[[rust-analyzer.assist.termSearch.fuel]]rust-analyzer.assist.termSearch.fuel (default: `400`)::
|
[[rust-analyzer.assist.termSearch.fuel]]rust-analyzer.assist.termSearch.fuel (default: `1800`)::
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
Term search fuel in "units of work" for assists (Defaults to 400).
|
Term search fuel in "units of work" for assists (Defaults to 1800).
|
||||||
--
|
--
|
||||||
[[rust-analyzer.cachePriming.enable]]rust-analyzer.cachePriming.enable (default: `true`)::
|
[[rust-analyzer.cachePriming.enable]]rust-analyzer.cachePriming.enable (default: `true`)::
|
||||||
+
|
+
|
||||||
|
@ -378,10 +378,10 @@ Custom completion snippets.
|
||||||
--
|
--
|
||||||
Whether to enable term search based snippets like `Some(foo.bar().baz())`.
|
Whether to enable term search based snippets like `Some(foo.bar().baz())`.
|
||||||
--
|
--
|
||||||
[[rust-analyzer.completion.termSearch.fuel]]rust-analyzer.completion.termSearch.fuel (default: `200`)::
|
[[rust-analyzer.completion.termSearch.fuel]]rust-analyzer.completion.termSearch.fuel (default: `1000`)::
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
Term search fuel in "units of work" for autocompletion (Defaults to 200).
|
Term search fuel in "units of work" for autocompletion (Defaults to 1000).
|
||||||
--
|
--
|
||||||
[[rust-analyzer.diagnostics.disabled]]rust-analyzer.diagnostics.disabled (default: `[]`)::
|
[[rust-analyzer.diagnostics.disabled]]rust-analyzer.diagnostics.disabled (default: `[]`)::
|
||||||
+
|
+
|
||||||
|
|
|
@ -592,8 +592,8 @@
|
||||||
"title": "assist",
|
"title": "assist",
|
||||||
"properties": {
|
"properties": {
|
||||||
"rust-analyzer.assist.termSearch.fuel": {
|
"rust-analyzer.assist.termSearch.fuel": {
|
||||||
"markdownDescription": "Term search fuel in \"units of work\" for assists (Defaults to 400).",
|
"markdownDescription": "Term search fuel in \"units of work\" for assists (Defaults to 1800).",
|
||||||
"default": 400,
|
"default": 1800,
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
}
|
}
|
||||||
|
@ -1224,8 +1224,8 @@
|
||||||
"title": "completion",
|
"title": "completion",
|
||||||
"properties": {
|
"properties": {
|
||||||
"rust-analyzer.completion.termSearch.fuel": {
|
"rust-analyzer.completion.termSearch.fuel": {
|
||||||
"markdownDescription": "Term search fuel in \"units of work\" for autocompletion (Defaults to 200).",
|
"markdownDescription": "Term search fuel in \"units of work\" for autocompletion (Defaults to 1000).",
|
||||||
"default": 200,
|
"default": 1000,
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue