mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
Dont diagnose inline mods
This commit is contained in:
@@ -220,6 +220,12 @@ fn ast(&self) -> ast::Module {
|
||||
}
|
||||
|
||||
fn resolve(&mut self, file_resolver: &FileResolver) {
|
||||
if !self.ast().has_semi() {
|
||||
self.problem = None;
|
||||
self.points_to = Vec::new();
|
||||
return;
|
||||
}
|
||||
|
||||
let mod_name = file_resolver.file_stem(self.owner.0);
|
||||
let is_dir_owner =
|
||||
mod_name == "mod" || mod_name == "lib" || mod_name == "main";
|
||||
|
||||
@@ -78,6 +78,19 @@ fn test_unresolved_module_diagnostic() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unresolved_module_diagnostic_no_diag_for_inline_mode() {
|
||||
let mut world = WorldState::new();
|
||||
world.change_file(FileId(1), Some("mod foo {}".to_string()));
|
||||
|
||||
let snap = world.snapshot(FileMap(&[(1, "/lib.rs")]));
|
||||
let diagnostics = snap.diagnostics(FileId(1)).unwrap();
|
||||
assert_eq_dbg(
|
||||
r#"[]"#,
|
||||
&diagnostics,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_resolve_parent_module() {
|
||||
let mut world = WorldState::new();
|
||||
|
||||
Reference in New Issue
Block a user