Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/context.rs')
-rw-r--r--crates/ide-completion/src/context.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index 9deaaf6631..4032329ac6 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -15,6 +15,7 @@ use ide_db::{
FilePosition, FxHashMap, FxHashSet, RootDatabase, famous_defs::FamousDefs,
helpers::is_editable_crate,
};
+use itertools::Either;
use syntax::{
AstNode, Edition, SmolStr,
SyntaxKind::{self, *},
@@ -142,7 +143,7 @@ pub(crate) struct AttrCtx {
#[derive(Debug, PartialEq, Eq)]
pub(crate) struct PathExprCtx<'db> {
pub(crate) in_block_expr: bool,
- pub(crate) in_breakable: BreakableKind,
+ pub(crate) in_breakable: Option<BreakableKind>,
pub(crate) after_if_expr: bool,
pub(crate) before_else_kw: bool,
/// Whether this expression is the direct condition of an if or while expression
@@ -156,6 +157,7 @@ pub(crate) struct PathExprCtx<'db> {
pub(crate) is_func_update: Option<ast::RecordExpr>,
pub(crate) self_param: Option<hir::SelfParam>,
pub(crate) innermost_ret_ty: Option<hir::Type<'db>>,
+ pub(crate) innermost_breakable_ty: Option<hir::Type<'db>>,
pub(crate) impl_: Option<ast::Impl>,
/// Whether this expression occurs in match arm guard position: before the
/// fat arrow token
@@ -282,7 +284,7 @@ pub(crate) struct PatternContext {
pub(crate) mut_token: Option<SyntaxToken>,
/// The record pattern this name or ref is a field of
pub(crate) record_pat: Option<ast::RecordPat>,
- pub(crate) impl_: Option<ast::Impl>,
+ pub(crate) impl_or_trait: Option<Either<ast::Impl, ast::Trait>>,
/// List of missing variants in a match expr
pub(crate) missing_variants: Vec<hir::Variant>,
}
@@ -411,12 +413,11 @@ pub(crate) enum DotAccessKind {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct DotAccessExprCtx {
pub(crate) in_block_expr: bool,
- pub(crate) in_breakable: BreakableKind,
+ pub(crate) in_breakable: Option<BreakableKind>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub(crate) enum BreakableKind {
- None,
Loop,
For,
While,