11436: fix: renaming modules does not change references by super r=Veykril a=TheDoctor314

Fixes #11289.

Co-authored-by: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com>
This commit is contained in:
bors[bot] 2022-02-08 23:19:07 +00:00 committed by GitHub
commit 8ac459501e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -1108,6 +1108,31 @@ pub mod foo$0;
);
}
#[test]
fn test_rename_mod_ref_by_super() {
check(
"baz",
r#"
mod $0foo {
struct X;
mod bar {
use super::X;
}
}
"#,
r#"
mod baz {
struct X;
mod bar {
use super::X;
}
}
"#,
)
}
#[test]
fn test_enum_variant_from_module_1() {
cov_mark::check!(rename_non_local);

View File

@ -343,6 +343,10 @@ fn source_edit_from_name_ref(
new_name: &str,
def: Definition,
) -> bool {
if name_ref.super_token().is_some() {
return true;
}
if let Some(record_field) = ast::RecordExprField::for_name_ref(name_ref) {
let rcf_name_ref = record_field.name_ref();
let rcf_expr = record_field.expr();