File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
src/tools/rust-analyzer/crates 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(
1252
1252
node : InFile < & SyntaxNode > ,
1253
1253
) -> Option < ScopeId > {
1254
1254
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
+ } )
1256
1260
. filter_map ( |it| it. map ( ast:: Expr :: cast) . transpose ( ) )
1257
1261
. filter_map ( |it| source_map. node_expr ( it. as_ref ( ) ) ?. as_expr ( ) )
1258
1262
. find_map ( |it| scopes. scope_for ( it) )
Original file line number Diff line number Diff line change @@ -3272,4 +3272,22 @@ fn f() {
3272
3272
"# ,
3273
3273
) ;
3274
3274
}
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
+ }
3275
3293
}
You can’t perform that action at this time.
0 commit comments