Add moved-out-of-ref diagnostic

This commit is contained in:
hkalbasi 2023-05-18 19:17:06 +03:30
parent 09d1265e1e
commit b55fbd3ad7
11 changed files with 352 additions and 10 deletions

View file

@ -121,6 +121,15 @@ pub(crate) fn check_diagnostics_with_config(config: DiagnosticsConfig, ra_fixtur
})
.collect::<Vec<_>>();
actual.sort_by_key(|(range, _)| range.start());
if expected.is_empty() {
// makes minicore smoke test debugable
for (e, _) in &actual {
eprintln!(
"Code in range {e:?} = {}",
&db.file_text(file_id)[usize::from(e.start())..usize::from(e.end())]
)
}
}
assert_eq!(expected, actual);
}
}
@ -156,6 +165,11 @@ fn minicore_smoke_test() {
// Checks that there is no diagnostic in minicore for each flag.
for flag in MiniCore::available_flags() {
if flag == "clone" {
// Clone without copy has `moved-out-of-ref`, so ignoring.
// FIXME: Maybe we should merge copy and clone in a single flag?
continue;
}
eprintln!("Checking minicore flag {flag}");
check(MiniCore::from_flags([flag]));
}