File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -781,6 +781,31 @@ impl Test for () {
781781 ${0:todo!()}
782782 }
783783}
784+ "# ,
785+ )
786+ }
787+
788+ #[ test]
789+ fn missing_generic_type ( ) {
790+ check_assist (
791+ add_missing_impl_members,
792+ r#"
793+ trait Foo<BAR> {
794+ fn foo(&self, bar: BAR);
795+ }
796+ impl Foo for () {
797+ <|>
798+ }
799+ "# ,
800+ r#"
801+ trait Foo<BAR> {
802+ fn foo(&self, bar: BAR);
803+ }
804+ impl Foo for () {
805+ fn foo(&self, bar: BAR) {
806+ ${0:todo!()}
807+ }
808+ }
784809"# ,
785810 )
786811 }
Original file line number Diff line number Diff line change @@ -178,6 +178,7 @@ impl DisplayTarget {
178178#[ derive( Debug ) ]
179179pub enum DisplaySourceCodeError {
180180 PathNotFound ,
181+ UnknownType ,
181182}
182183
183184pub enum HirDisplayError {
@@ -558,7 +559,14 @@ impl HirDisplay for Ty {
558559 }
559560 } ;
560561 }
561- Ty :: Unknown => write ! ( f, "{{unknown}}" ) ?,
562+ Ty :: Unknown => {
563+ if f. display_target . is_source_code ( ) {
564+ return Err ( HirDisplayError :: DisplaySourceCodeError (
565+ DisplaySourceCodeError :: UnknownType ,
566+ ) ) ;
567+ }
568+ write ! ( f, "{{unknown}}" ) ?;
569+ }
562570 Ty :: Infer ( ..) => write ! ( f, "_" ) ?,
563571 }
564572 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments