From 9a72170184ac2c6b540282c26379b4d00f51377b Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Sat, 18 Apr 2026 23:55:32 +0200 Subject: [PATCH 1/3] misc improvements --- crates/hir-ty/src/next_solver/infer/mod.rs | 2 +- crates/ide-completion/src/render.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/hir-ty/src/next_solver/infer/mod.rs b/crates/hir-ty/src/next_solver/infer/mod.rs index 6b6dd549b34e..2c2f7dbf6730 100644 --- a/crates/hir-ty/src/next_solver/infer/mod.rs +++ b/crates/hir-ty/src/next_solver/infer/mod.rs @@ -843,7 +843,7 @@ impl<'db> InferCtxt<'db> { GenericArgs::for_item(self.interner, def_id, |_index, kind, _| self.var_for_def(kind, span)) } - /// Like `fresh_args_for_item()`, but first uses the args from `first`. + /// Like [`Self::fresh_args_for_item`], but first uses the args from `first`. pub fn fill_rest_fresh_args( &self, span: Span, diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs index e48847c983b4..7cb1eaa061f3 100644 --- a/crates/ide-completion/src/render.rs +++ b/crates/ide-completion/src/render.rs @@ -2372,7 +2372,7 @@ impl S { } fn foo(s: S) { s.$0 } "#, - CompletionItemKind::SymbolKind(SymbolKind::Method), + SymbolKind::Method, expect![[r#" [ CompletionItem { From fc704308f8560438998bc6bd1610179365d87778 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Sat, 18 Apr 2026 23:55:32 +0200 Subject: [PATCH 2/3] add failing test --- crates/ide-completion/src/completions/dot.rs | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs index 59c6c55c22b9..3bf3f8c92ab1 100644 --- a/crates/ide-completion/src/completions/dot.rs +++ b/crates/ide-completion/src/completions/dot.rs @@ -307,7 +307,7 @@ fn complete_methods( mod tests { use expect_test::expect; - use crate::tests::{check_edit, check_no_kw, check_with_private_editable}; + use crate::tests::{check, check_edit, check_no_kw, check_with_private_editable}; #[test] fn test_struct_field_and_method_completion() { @@ -1807,4 +1807,33 @@ fn main() { "#]], ); } + + #[test] + fn no_await_on_error_type() { + check( + r#" +//- minicore: future +fn foo(t: T) { + let _ = t.$0; +} + "#, + expect![[r#" + kw await expr.await + sn box Box::new(expr) + sn call function(expr) + sn const const {} + sn dbg dbg!(expr) + sn dbgr dbg!(&expr) + sn deref *expr + sn if if expr {} + sn match match expr {} + sn not !expr + sn ref &expr + sn refm &mut expr + sn return return expr + sn unsafe unsafe {} + sn while while expr {} + "#]], + ); + } } From 0f3c0ec73d0b9456098fa5002ab6d473e48b808d Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Fri, 29 May 2026 17:53:12 +0200 Subject: [PATCH 3/3] fix: return `false` from `implements_trait_unique` for error types --- crates/hir-ty/src/traits.rs | 5 ++++- crates/ide-completion/src/completions/dot.rs | 1 - .../test_data/highlight_general.html | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/hir-ty/src/traits.rs b/crates/hir-ty/src/traits.rs index f6b5adfb6fff..14b5539c2810 100644 --- a/crates/hir-ty/src/traits.rs +++ b/crates/hir-ty/src/traits.rs @@ -17,7 +17,7 @@ use hir_expand::name::Name; use intern::sym; use rustc_type_ir::{ TypingMode, - inherent::{BoundExistentialPredicates, IntoKind}, + inherent::{BoundExistentialPredicates, IntoKind, Ty as _}, }; use crate::{ @@ -148,6 +148,9 @@ pub fn implements_trait_unique_with_infcx<'db>( let args = create_args(&infcx); let trait_ref = rustc_type_ir::TraitRef::new_from_args(interner, trait_.into(), args); + if trait_ref.self_ty().is_ty_error() { + return false; + } let obligation = Obligation::new(interner, ObligationCause::dummy(), env.param_env, trait_ref); infcx.predicate_must_hold_modulo_regions(&obligation) diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs index 3bf3f8c92ab1..97315ab96c3c 100644 --- a/crates/ide-completion/src/completions/dot.rs +++ b/crates/ide-completion/src/completions/dot.rs @@ -1818,7 +1818,6 @@ fn foo(t: T) { } "#, expect![[r#" - kw await expr.await sn box Box::new(expr) sn call function(expr) sn const const {} diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_general.html b/crates/ide/src/syntax_highlighting/test_data/highlight_general.html index 1184739cc258..2f2c7f251a70 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_general.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_general.html @@ -128,9 +128,9 @@ let y = &mut x; let z = &y; - let Foo { x: z, y } = Foo { x: z, y }; + let Foo { x: z, y } = Foo { x: z, y }; - y; + y; let mut foo = Foo { x, y: x }; let foo2 = Foo { x, y: x }; @@ -143,7 +143,7 @@ copy.qux(); copy.baz(copy); - let a = |x| x; + let a = |x| x; let bar = Foo::baz; let baz = (-42,); @@ -173,13 +173,13 @@ } async fn learn_and_sing() { - let song = learn_song().await; - sing_song(song).await; + let song = learn_song().await; + sing_song(song).await; } async fn async_main() { let f1 = learn_and_sing(); - let f2 = dance(); + let f2 = dance(); futures::join!(f1, f2); }