Revert "feat: Implement module_path macro"

This commit is contained in:
Lukas Wirth 2024-08-27 08:19:09 +02:00 committed by GitHub
parent 095926ea6f
commit fa48bc216c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 71 additions and 278 deletions

View file

@ -24,11 +24,9 @@ pub(crate) fn goto_type_definition(
let file: ast::SourceFile = sema.parse_guess_edition(file_id);
let token: SyntaxToken =
pick_best_token(file.syntax().token_at_offset(offset), |kind| match kind {
IDENT | INT_NUMBER | T![self] => 3,
// operators
T!['('] | T!['['] | T!['{'] | T![')'] | T![']'] | T!['}'] | T![!] | T![?] => 2,
kind if !kind.is_trivia() => 1,
_ => 0,
IDENT | INT_NUMBER | T![self] => 2,
kind if kind.is_trivia() => 0,
_ => 1,
})?;
let mut res = Vec::new();

View file

@ -8702,68 +8702,3 @@ fn foo() {
"#]],
);
}
#[test]
fn module_path_macro() {
check(
r##"
//- minicore: module_path
const C$0: &'static str = module_path!();
"##,
expect![[r#"
*C*
```rust
test
```
```rust
const C: &'static str = "test"
```
"#]],
);
check(
r##"
//- minicore: module_path
mod foo {
const C$0: &'static str = module_path!();
}
"##,
expect![[r#"
*C*
```rust
test::foo
```
```rust
const C: &'static str = "test::foo"
```
"#]],
);
check(
r##"
//- minicore: module_path
mod baz {
const _: () = {
mod bar {
const C$0: &'static str = module_path!();
}
}
}
"##,
expect![[r#"
*C*
```rust
test::bar
```
```rust
const C: &'static str = "test::baz::bar"
```
"#]],
);
}

View file

@ -69,7 +69,6 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
dependencies,
origin,
is_proc_macro,
..
} = &crate_graph[crate_id];
format_to!(
buf,