Skip to content

Commit 2bafe9d

Browse files
authored
Merge pull request #19772 from rust-lang/push-nxzlokoozypo
internal: Make diagnostics experimental by default
2 parents 8b62486 + 40b7f4a commit 2bafe9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+47
-33
lines changed

crates/ide-diagnostics/src/handlers/await_outside_of_async.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) fn await_outside_of_async(
1414
format!("`await` is used inside {}, which is not an `async` context", d.location),
1515
display_range,
1616
)
17+
.stable()
1718
}
1819

1920
#[cfg(test)]

crates/ide-diagnostics/src/handlers/bad_rtn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub(crate) fn bad_rtn(ctx: &DiagnosticsContext<'_>, d: &hir::BadRtn) -> Diagnost
1212
"return type notation not allowed in this position yet",
1313
d.rtn.map(Into::into),
1414
)
15+
.stable()
1516
}
1617

1718
#[cfg(test)]

crates/ide-diagnostics/src/handlers/break_outside_of_loop.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub(crate) fn break_outside_of_loop(
1919
message,
2020
d.expr.map(|it| it.into()),
2121
)
22+
.stable()
2223
}
2324

2425
#[cfg(test)]

crates/ide-diagnostics/src/handlers/elided_lifetimes_in_path.rs

-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ pub(crate) fn elided_lifetimes_in_path(
1515
"implicit elided lifetime not allowed here",
1616
d.generics_or_segment.map(Into::into),
1717
)
18-
.experimental()
1918
} else {
2019
Diagnostic::new_with_syntax_node_ptr(
2120
ctx,
2221
DiagnosticCode::RustcLint("elided_lifetimes_in_paths"),
2322
"hidden lifetime parameters in types are deprecated",
2423
d.generics_or_segment.map(Into::into),
2524
)
26-
.experimental()
2725
}
2826
}
2927

crates/ide-diagnostics/src/handlers/expected_function.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub(crate) fn expected_function(
1515
format!("expected function, found {}", d.found.display(ctx.sema.db, ctx.display_target)),
1616
d.call.map(|it| it.into()),
1717
)
18-
.experimental()
1918
}
2019

2120
#[cfg(test)]

crates/ide-diagnostics/src/handlers/generic_args_prohibited.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(crate) fn generic_args_prohibited(
2121
describe_reason(d.reason),
2222
d.args.map(Into::into),
2323
)
24+
.stable()
2425
.with_fixes(fixes(ctx, d))
2526
}
2627

crates/ide-diagnostics/src/handlers/inactive_code.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub(crate) fn inactive_code(
3333
message,
3434
ctx.sema.diagnostics_display_range(d.node),
3535
)
36+
.stable()
3637
.with_unused(true);
3738
Some(res)
3839
}

crates/ide-diagnostics/src/handlers/incoherent_impl.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub(crate) fn incoherent_impl(ctx: &DiagnosticsContext<'_>, d: &hir::IncoherentI
1919
"cannot define inherent `impl` for foreign type".to_owned(),
2020
display_range,
2121
)
22+
.stable()
2223
}
2324

2425
#[cfg(test)]

crates/ide-diagnostics/src/handlers/incorrect_case.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub(crate) fn incorrect_case(ctx: &DiagnosticsContext<'_>, d: &hir::IncorrectCas
2929
),
3030
InFile::new(d.file, d.ident.into()),
3131
)
32+
.stable()
3233
.with_fixes(fixes(ctx, d))
3334
}
3435

crates/ide-diagnostics/src/handlers/incorrect_generics_len.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub(crate) fn incorrect_generics_len(
2828
message,
2929
d.generics_or_segment.map(Into::into),
3030
)
31-
.experimental()
3231
}
3332

3433
#[cfg(test)]

crates/ide-diagnostics/src/handlers/incorrect_generics_order.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub(crate) fn incorrect_generics_order(
2828
message,
2929
d.provided_arg.map(Into::into),
3030
)
31+
.stable()
3132
}
3233

3334
#[cfg(test)]

crates/ide-diagnostics/src/handlers/invalid_cast.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub(crate) fn invalid_cast(ctx: &DiagnosticsContext<'_>, d: &hir::InvalidCast) -
100100
// "cannot cast to a pointer of an unknown kind".to_owned(),
101101
// ),
102102
};
103-
Diagnostic::new(code, message, display_range)
103+
Diagnostic::new(code, message, display_range).stable()
104104
}
105105

106106
// Diagnostic: cast-to-unsized
@@ -113,6 +113,7 @@ pub(crate) fn cast_to_unsized(ctx: &DiagnosticsContext<'_>, d: &hir::CastToUnsiz
113113
format_ty!(ctx, "cast to unsized type: `{}`", d.cast_ty),
114114
display_range,
115115
)
116+
.stable()
116117
}
117118

118119
#[cfg(test)]

crates/ide-diagnostics/src/handlers/invalid_derive_target.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub(crate) fn invalid_derive_target(
1515
"`derive` may only be applied to `struct`s, `enum`s and `union`s",
1616
display_range,
1717
)
18+
.stable()
1819
}
1920

2021
#[cfg(test)]

crates/ide-diagnostics/src/handlers/macro_error.rs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub(crate) fn macro_error(ctx: &DiagnosticsContext<'_>, d: &hir::MacroError) ->
1919
d.message.clone(),
2020
display_range,
2121
)
22+
.stable()
2223
}
2324

2425
// Diagnostic: macro-def-error
@@ -33,6 +34,7 @@ pub(crate) fn macro_def_error(ctx: &DiagnosticsContext<'_>, d: &hir::MacroDefErr
3334
d.message.clone(),
3435
display_range,
3536
)
37+
.stable()
3638
}
3739

3840
#[cfg(test)]

crates/ide-diagnostics/src/handlers/malformed_derive.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) fn malformed_derive(
1414
"malformed derive input, derive attributes are of the form `#[derive(Derive1, Derive2, ...)]`",
1515
display_range,
1616
)
17+
.stable()
1718
}
1819

1920
#[cfg(test)]

crates/ide-diagnostics/src/handlers/mismatched_arg_count.rs

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub(crate) fn mismatched_tuple_struct_pat_arg_count(
2626
message,
2727
invalid_args_range(ctx, d.expr_or_pat, d.expected, d.found),
2828
)
29+
.stable()
2930
}
3031

3132
// Diagnostic: mismatched-arg-count
@@ -42,6 +43,7 @@ pub(crate) fn mismatched_arg_count(
4243
message,
4344
invalid_args_range(ctx, d.call_expr, d.expected, d.found),
4445
)
46+
.stable()
4547
}
4648

4749
fn invalid_args_range(

crates/ide-diagnostics/src/handlers/missing_fields.rs

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub(crate) fn missing_fields(ctx: &DiagnosticsContext<'_>, d: &hir::MissingField
4747
);
4848

4949
Diagnostic::new_with_syntax_node_ptr(ctx, DiagnosticCode::RustcHardError("E0063"), message, ptr)
50+
.stable()
5051
.with_fixes(fixes(ctx, d))
5152
}
5253

crates/ide-diagnostics/src/handlers/missing_lifetime.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub(crate) fn missing_lifetime(
1313
"missing lifetime specifier",
1414
d.generics_or_segment.map(Into::into),
1515
)
16-
.experimental()
1716
}
1817

1918
#[cfg(test)]

crates/ide-diagnostics/src/handlers/missing_match_arms.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub(crate) fn missing_match_arms(
1313
format!("missing match arm: {}", d.uncovered_patterns),
1414
d.scrutinee_expr.map(Into::into),
1515
)
16+
.stable()
1617
}
1718

1819
#[cfg(test)]

crates/ide-diagnostics/src/handlers/missing_unsafe.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub(crate) fn missing_unsafe(ctx: &DiagnosticsContext<'_>, d: &hir::MissingUnsaf
2323
format!("{operation} is unsafe and requires an unsafe function or block"),
2424
d.node.map(|it| it.into()),
2525
)
26+
.stable()
2627
.with_fixes(fixes(ctx, d))
2728
}
2829

crates/ide-diagnostics/src/handlers/moved_out_of_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub(crate) fn moved_out_of_ref(ctx: &DiagnosticsContext<'_>, d: &hir::MovedOutOf
1111
format!("cannot move `{}` out of reference", d.ty.display(ctx.sema.db, ctx.display_target)),
1212
d.span,
1313
)
14-
.experimental() // spans are broken, and I'm not sure how precise we can detect copy types
14+
// spans are broken, and I'm not sure how precise we can detect copy types
1515
}
1616

1717
#[cfg(test)]

crates/ide-diagnostics/src/handlers/mutability_errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub(crate) fn need_mut(ctx: &DiagnosticsContext<'_>, d: &hir::NeedMut) -> Option
5555
),
5656
span,
5757
)
58+
.stable()
5859
.with_fixes(fixes),
5960
)
6061
}
@@ -94,7 +95,7 @@ pub(crate) fn unused_mut(ctx: &DiagnosticsContext<'_>, d: &hir::UnusedMut) -> Op
9495
"variable does not need to be mutable",
9596
ast,
9697
)
97-
.experimental() // Not supporting `#[allow(unused_mut)]` in proc macros leads to false positive.
98+
// Not supporting `#[allow(unused_mut)]` in proc macros leads to false positive, hence not stable.
9899
.with_fixes(fixes),
99100
)
100101
}

crates/ide-diagnostics/src/handlers/no_such_field.rs

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) fn no_such_field(ctx: &DiagnosticsContext<'_>, d: &hir::NoSuchField)
2222
"field is private",
2323
node,
2424
)
25+
.stable()
2526
} else {
2627
Diagnostic::new_with_syntax_node_ptr(
2728
ctx,
@@ -32,6 +33,7 @@ pub(crate) fn no_such_field(ctx: &DiagnosticsContext<'_>, d: &hir::NoSuchField)
3233
"no such field",
3334
node,
3435
)
36+
.stable()
3537
.with_fixes(fixes(ctx, d))
3638
}
3739
}

crates/ide-diagnostics/src/handlers/non_exhaustive_let.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) fn non_exhaustive_let(
1414
format!("non-exhaustive pattern: {}", d.uncovered_patterns),
1515
d.pat.map(Into::into),
1616
)
17+
.stable()
1718
}
1819

1920
#[cfg(test)]

crates/ide-diagnostics/src/handlers/parenthesized_generic_args_without_fn_trait.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) fn parenthesized_generic_args_without_fn_trait(
1414
"parenthesized type parameters may only be used with a `Fn` trait",
1515
d.args.map(Into::into),
1616
)
17+
.stable()
1718
}
1819

1920
#[cfg(test)]

crates/ide-diagnostics/src/handlers/private_assoc_item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub(crate) fn private_assoc_item(
2828
),
2929
d.expr_or_pat.map(Into::into),
3030
)
31+
.stable()
3132
}
3233

3334
#[cfg(test)]

crates/ide-diagnostics/src/handlers/private_field.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub(crate) fn private_field(ctx: &DiagnosticsContext<'_>, d: &hir::PrivateField)
1515
),
1616
d.expr.map(|it| it.into()),
1717
)
18+
.stable()
1819
}
1920

2021
#[cfg(test)]

crates/ide-diagnostics/src/handlers/remove_trailing_return.rs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub(crate) fn remove_trailing_return(
3131
"replace return <expr>; with <expr>",
3232
display_range,
3333
)
34+
.stable()
3435
.with_fixes(fixes(ctx, d)),
3536
)
3637
}

crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub(crate) fn remove_unnecessary_else(
3636
"remove unnecessary else block",
3737
display_range,
3838
)
39-
.experimental()
4039
.with_fixes(fixes(ctx, d)),
4140
)
4241
}

crates/ide-diagnostics/src/handlers/replace_filter_map_next_with_find_map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(crate) fn replace_filter_map_next_with_find_map(
2121
"replace filter_map(..).next() with find_map(..)",
2222
InFile::new(d.file, d.next_expr.into()),
2323
)
24+
.stable()
2425
.with_fixes(fixes(ctx, d))
2526
}
2627

crates/ide-diagnostics/src/handlers/trait_impl_incorrect_safety.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub(crate) fn trait_impl_incorrect_safety(
3333
},
3434
),
3535
)
36+
.stable()
3637
}
3738

3839
#[cfg(test)]

crates/ide-diagnostics/src/handlers/trait_impl_missing_assoc_item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub(crate) fn trait_impl_missing_assoc_item(
2929
&|impl_| impl_.trait_().map(|t| t.syntax().text_range()),
3030
),
3131
)
32+
.stable()
3233
}
3334

3435
#[cfg(test)]

crates/ide-diagnostics/src/handlers/trait_impl_orphan.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ pub(crate) fn trait_impl_orphan(
1616
.to_owned(),
1717
InFile::new(d.file_id, d.impl_.into()),
1818
)
19-
// Not yet checked for false positives
20-
.experimental()
2119
}
2220

2321
#[cfg(test)]

crates/ide-diagnostics/src/handlers/trait_impl_redundant_assoc_item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub(crate) fn trait_impl_redundant_assoc_item(
6161
format!("{redundant_item_name} is not a member of trait `{trait_name}`"),
6262
ide_db::FileRange { file_id: file_id.file_id(ctx.sema.db), range },
6363
)
64+
.stable()
6465
.with_fixes(quickfix_for_redundant_assoc_item(
6566
ctx,
6667
d,

crates/ide-diagnostics/src/handlers/type_mismatch.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ pub(crate) fn type_mismatch(ctx: &DiagnosticsContext<'_>, d: &hir::TypeMismatch)
5353
display_range,
5454
)
5555
.with_fixes(fixes(ctx, d));
56-
if diag.fixes.is_none() {
57-
diag.experimental = true;
56+
if diag.fixes.is_some() {
57+
diag.experimental = false;
5858
}
5959
diag
6060
}

crates/ide-diagnostics/src/handlers/typed_hole.rs

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub(crate) fn typed_hole(ctx: &DiagnosticsContext<'_>, d: &hir::TypedHole) -> Di
3737
};
3838

3939
Diagnostic::new(DiagnosticCode::RustcHardError("typed-hole"), message, display_range)
40+
.stable()
4041
.with_fixes(fixes)
4142
}
4243

crates/ide-diagnostics/src/handlers/undeclared_label.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub(crate) fn undeclared_label(
1212
format!("use of undeclared label `{}`", name.display(ctx.sema.db, ctx.edition)),
1313
d.node.map(|it| it.into()),
1414
)
15+
.stable()
1516
}
1617

1718
#[cfg(test)]

crates/ide-diagnostics/src/handlers/unimplemented_builtin_macro.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ pub(crate) fn unimplemented_builtin_macro(
1313
"unimplemented built-in macro".to_owned(),
1414
d.node,
1515
)
16+
.stable()
1617
}

crates/ide-diagnostics/src/handlers/unreachable_label.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub(crate) fn unreachable_label(
1212
format!("use of unreachable label `{}`", name.display(ctx.sema.db, ctx.edition)),
1313
d.node.map(|it| it.into()),
1414
)
15+
.stable()
1516
}
1617

1718
#[cfg(test)]

crates/ide-diagnostics/src/handlers/unresolved_assoc_item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub(crate) fn unresolved_assoc_item(
1313
"no such associated item",
1414
d.expr_or_pat.map(Into::into),
1515
)
16-
.experimental()
1716
}
1817

1918
#[cfg(test)]

crates/ide-diagnostics/src/handlers/unresolved_extern_crate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub(crate) fn unresolved_extern_crate(
1313
"unresolved extern crate",
1414
d.decl.map(|it| it.into()),
1515
)
16+
.stable()
1617
}
1718

1819
#[cfg(test)]

crates/ide-diagnostics/src/handlers/unresolved_field.rs

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ pub(crate) fn unresolved_field(
5252
}),
5353
)
5454
.with_fixes(fixes(ctx, d))
55-
.experimental()
5655
}
5756

5857
fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::UnresolvedField) -> Option<Vec<Assist>> {

crates/ide-diagnostics/src/handlers/unresolved_ident.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub(crate) fn unresolved_ident(
1313
range.range = in_node_range + range.range.start();
1414
}
1515
Diagnostic::new(DiagnosticCode::RustcHardError("E0425"), "no such value in this scope", range)
16-
.experimental()
1716
}
1817

1918
#[cfg(test)]

0 commit comments

Comments
 (0)