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/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 59c6c55c22b9..97315ab96c3c 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,32 @@ fn main() { "#]], ); } + + #[test] + fn no_await_on_error_type() { + check( + r#" +//- minicore: future +fn foo(t: T) { + let _ = t.$0; +} + "#, + expect![[r#" + 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 {} + "#]], + ); + } } 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 { 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); }