File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -1252,7 +1252,11 @@ fn scope_for(
12521252 node : InFile < & SyntaxNode > ,
12531253) -> Option < ScopeId > {
12541254 node. ancestors_with_macros ( db. upcast ( ) )
1255- . take_while ( |it| !ast:: Item :: can_cast ( it. kind ( ) ) || ast:: MacroCall :: can_cast ( it. kind ( ) ) )
1255+ . take_while ( |it| {
1256+ !ast:: Item :: can_cast ( it. kind ( ) )
1257+ || ast:: MacroCall :: can_cast ( it. kind ( ) )
1258+ || ast:: Use :: can_cast ( it. kind ( ) )
1259+ } )
12561260 . filter_map ( |it| it. map ( ast:: Expr :: cast) . transpose ( ) )
12571261 . filter_map ( |it| source_map. node_expr ( it. as_ref ( ) ) ?. as_expr ( ) )
12581262 . find_map ( |it| scopes. scope_for ( it) )
Original file line number Diff line number Diff line change @@ -3272,4 +3272,22 @@ fn f() {
32723272 "# ,
32733273 ) ;
32743274 }
3275+
3276+ #[ test]
3277+ fn use_inside_body ( ) {
3278+ check (
3279+ r#"
3280+ fn main() {
3281+ mod nice_module {
3282+ pub(super) struct NiceStruct;
3283+ // ^^^^^^^^^^
3284+ }
3285+
3286+ use nice_module::NiceStruct$0;
3287+
3288+ let _ = NiceStruct;
3289+ }
3290+ "# ,
3291+ ) ;
3292+ }
32753293}
You can’t perform that action at this time.
0 commit comments