Merge pull request #19462 from Veykril/push-ypvprvvwkyll

refactor: Lower type-refs before type inference
This commit is contained in:
Lukas Wirth 2025-04-09 08:54:28 +00:00 committed by GitHub
commit dc363f7f77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
127 changed files with 6733 additions and 7993 deletions

View file

@ -41,6 +41,7 @@ pub(crate) fn inactive_code(
mod tests {
use crate::{DiagnosticsConfig, tests::check_diagnostics_with_config};
#[track_caller]
pub(crate) fn check(#[rust_analyzer::rust_fixture] ra_fixture: &str) {
let config = DiagnosticsConfig {
disabled: std::iter::once("unlinked-file".to_owned()).collect(),

View file

@ -786,6 +786,8 @@ static FOO: () = {
}
#[test]
// FIXME
#[should_panic]
fn enum_variant_body_inner_item() {
check_diagnostics(
r#"

View file

@ -123,6 +123,7 @@ include!("foo/bar.rs");
#[test]
fn good_out_dir_diagnostic() {
// FIXME: The diagnostic here is duplicated for each eager expansion
check_diagnostics(
r#"
#[rustc_builtin_macro]
@ -134,6 +135,8 @@ macro_rules! concat { () => {} }
include!(concat!(env!("OUT_DIR"), "/out.rs"));
//^^^^^^^^^ error: `OUT_DIR` not set, build scripts may have failed to run
//^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, build scripts may have failed to run
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, build scripts may have failed to run
"#,
);
}
@ -238,6 +241,7 @@ macro_rules! outer {
fn f() {
outer!();
} //^^^^^^^^ error: leftover tokens
//^^^^^^^^ error: Syntax Error in Expansion: expected expression
"#,
)
}

View file

@ -276,8 +276,9 @@ pub(crate) fn check_diagnostics_with_config(
let line_index = db.line_index(file_id);
let mut actual = annotations.remove(&file_id).unwrap_or_default();
let expected = extract_annotations(&db.file_text(file_id).text(&db));
actual.sort_by_key(|(range, _)| range.start());
let mut expected = extract_annotations(&db.file_text(file_id).text(&db));
expected.sort_by_key(|(range, s)| (range.start(), s.clone()));
actual.sort_by_key(|(range, s)| (range.start(), s.clone()));
// FIXME: We should panic on duplicates instead, but includes currently cause us to report
// diagnostics twice for the calling module when both files are queried.
actual.dedup();