2020-08-27 20:00:21 +10:00
|
|
|
//! Errors emitted by typeck.
|
2022-09-18 11:45:41 -04:00
|
|
|
use rustc_errors::IntoDiagnostic;
|
2022-09-05 00:15:50 -04:00
|
|
|
use rustc_errors::{error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler};
|
2022-09-18 11:47:31 -04:00
|
|
|
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
2022-04-07 22:46:53 +04:00
|
|
|
use rustc_middle::ty::Ty;
|
2022-09-05 17:26:57 -04:00
|
|
|
use rustc_span::{symbol::Ident, Span, Symbol};
|
2020-08-27 20:09:22 +10:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::field_multiply_specified_in_initializer, code = "E0062")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct FieldMultiplySpecifiedInInitializer {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::previous_use_label)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub prev_span: Span,
|
|
|
|
pub ident: Ident,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::unrecognized_atomic_operation, code = "E0092")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct UnrecognizedAtomicOperation<'a> {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub op: &'a str,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::wrong_number_of_generic_arguments_to_intrinsic, code = "E0094")]
|
2021-07-01 13:52:44 +02:00
|
|
|
pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub found: usize,
|
|
|
|
pub expected: usize,
|
2021-06-08 20:38:43 +02:00
|
|
|
pub descr: &'a str,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::unrecognized_intrinsic_function, code = "E0093")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct UnrecognizedIntrinsicFunction {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub name: Symbol,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::lifetimes_or_bounds_mismatch_on_trait, code = "E0195")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct LifetimesOrBoundsMismatchOnTrait {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::generics_label)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub generics_span: Option<Span>,
|
|
|
|
pub item_kind: &'static str,
|
|
|
|
pub ident: Ident,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::drop_impl_on_wrong_item, code = "E0120")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct DropImplOnWrongItem {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
2020-08-27 20:00:21 +10:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::field_already_declared, code = "E0124")]
|
2020-08-27 20:00:21 +10:00
|
|
|
pub struct FieldAlreadyDeclared {
|
|
|
|
pub field_name: Ident,
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:00:21 +10:00
|
|
|
pub span: Span,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::previous_decl_label)]
|
2020-08-27 20:00:21 +10:00
|
|
|
pub prev_span: Span,
|
|
|
|
}
|
2020-08-27 20:09:22 +10:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::copy_impl_on_type_with_dtor, code = "E0184")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct CopyImplOnTypeWithDtor {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::multiple_relaxed_default_bounds, code = "E0203")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct MultipleRelaxedDefaultBounds {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::copy_impl_on_non_adt, code = "E0206")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct CopyImplOnNonAdt {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::trait_object_declared_with_no_traits, code = "E0224")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct TraitObjectDeclaredWithNoTraits {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::alias_span)]
|
2022-05-09 19:03:37 +02:00
|
|
|
pub trait_alias_span: Option<Span>,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::ambiguous_lifetime_bound, code = "E0227")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct AmbiguousLifetimeBound {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::assoc_type_binding_not_allowed, code = "E0229")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct AssocTypeBindingNotAllowed {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::functional_record_update_on_non_struct, code = "E0436")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct FunctionalRecordUpdateOnNonStruct {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::typeof_reserved_keyword_used, code = "E0516")]
|
2022-04-07 22:46:53 +04:00
|
|
|
pub struct TypeofReservedKeywordUsed<'tcx> {
|
|
|
|
pub ty: Ty<'tcx>,
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-04-21 04:03:13 +01:00
|
|
|
#[suggestion_verbose(code = "{ty}")]
|
2022-04-07 22:46:53 +04:00
|
|
|
pub opt_sugg: Option<(Span, Applicability)>,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::return_stmt_outside_of_fn_body, code = "E0572")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct ReturnStmtOutsideOfFnBody {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::encl_body_label)]
|
2021-06-11 01:20:00 +02:00
|
|
|
pub encl_body_span: Option<Span>,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::encl_fn_label)]
|
2021-06-11 01:20:00 +02:00
|
|
|
pub encl_fn_span: Option<Span>,
|
2020-08-27 20:09:22 +10:00
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::yield_expr_outside_of_generator, code = "E0627")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct YieldExprOutsideOfGenerator {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::struct_expr_non_exhaustive, code = "E0639")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct StructExprNonExhaustive {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
pub what: &'static str,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::method_call_on_unknown_type, code = "E0699")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct MethodCallOnUnknownType {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::value_of_associated_struct_already_specified, code = "E0719")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct ValueOfAssociatedStructAlreadySpecified {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
2022-06-23 14:51:44 +01:00
|
|
|
#[label(typeck::previous_bound_label)]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub prev_span: Span,
|
|
|
|
pub item_name: Ident,
|
|
|
|
pub def_path: String,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::address_of_temporary_taken, code = "E0745")]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub struct AddressOfTemporaryTaken {
|
2022-03-31 08:50:45 +01:00
|
|
|
#[primary_span]
|
2022-03-31 10:24:46 +01:00
|
|
|
#[label]
|
2020-08-27 20:09:22 +10:00
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-04-26 11:59:45 +01:00
|
|
|
|
2022-09-18 11:47:31 -04:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-08-26 01:25:56 +00:00
|
|
|
pub enum AddReturnTypeSuggestion {
|
2022-04-26 11:59:45 +01:00
|
|
|
#[suggestion(
|
2022-06-23 16:12:52 +01:00
|
|
|
typeck::add_return_type_add,
|
2022-04-26 11:59:45 +01:00
|
|
|
code = "-> {found} ",
|
|
|
|
applicability = "machine-applicable"
|
|
|
|
)]
|
|
|
|
Add {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
2022-08-26 01:25:56 +00:00
|
|
|
found: String,
|
2022-04-26 11:59:45 +01:00
|
|
|
},
|
|
|
|
#[suggestion(
|
2022-06-23 16:12:52 +01:00
|
|
|
typeck::add_return_type_missing_here,
|
2022-04-26 11:59:45 +01:00
|
|
|
code = "-> _ ",
|
|
|
|
applicability = "has-placeholders"
|
|
|
|
)]
|
|
|
|
MissingHere {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:47:31 -04:00
|
|
|
#[derive(Subdiagnostic)]
|
2022-04-26 11:59:45 +01:00
|
|
|
pub enum ExpectedReturnTypeLabel<'tcx> {
|
2022-06-23 16:12:52 +01:00
|
|
|
#[label(typeck::expected_default_return_type)]
|
2022-04-26 11:59:45 +01:00
|
|
|
Unit {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
},
|
2022-06-23 16:12:52 +01:00
|
|
|
#[label(typeck::expected_return_type)]
|
2022-04-26 11:59:45 +01:00
|
|
|
Other {
|
|
|
|
#[primary_span]
|
|
|
|
span: Span,
|
|
|
|
expected: Ty<'tcx>,
|
|
|
|
},
|
|
|
|
}
|
2022-05-04 07:27:12 +01:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::unconstrained_opaque_type)]
|
2022-05-04 07:27:12 +01:00
|
|
|
#[note]
|
|
|
|
pub struct UnconstrainedOpaqueType {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
pub name: Symbol,
|
|
|
|
}
|
2022-05-06 03:46:12 +01:00
|
|
|
|
2022-09-05 17:26:57 -04:00
|
|
|
pub struct MissingTypeParams {
|
2022-05-07 07:32:01 +01:00
|
|
|
pub span: Span,
|
|
|
|
pub def_span: Span,
|
2022-09-05 17:26:57 -04:00
|
|
|
pub span_snippet: Option<String>,
|
2022-07-25 22:40:00 +09:00
|
|
|
pub missing_type_params: Vec<Symbol>,
|
2022-05-07 07:32:01 +01:00
|
|
|
pub empty_generic_args: bool,
|
|
|
|
}
|
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
// Manual implementation of `IntoDiagnostic` to be able to call `span_to_snippet`.
|
2022-09-18 11:45:41 -04:00
|
|
|
impl<'a> IntoDiagnostic<'a> for MissingTypeParams {
|
2022-09-05 00:15:50 -04:00
|
|
|
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
|
|
|
let mut err = handler.struct_span_err_with_code(
|
2022-05-07 07:32:01 +01:00
|
|
|
self.span,
|
2022-05-23 18:37:27 +01:00
|
|
|
rustc_errors::fluent::typeck::missing_type_params,
|
2022-05-07 07:32:01 +01:00
|
|
|
error_code!(E0393),
|
|
|
|
);
|
|
|
|
err.set_arg("parameterCount", self.missing_type_params.len());
|
|
|
|
err.set_arg(
|
|
|
|
"parameters",
|
|
|
|
self.missing_type_params
|
|
|
|
.iter()
|
|
|
|
.map(|n| format!("`{}`", n))
|
|
|
|
.collect::<Vec<_>>()
|
|
|
|
.join(", "),
|
|
|
|
);
|
|
|
|
|
2022-05-24 15:09:47 +01:00
|
|
|
err.span_label(self.def_span, rustc_errors::fluent::typeck::label);
|
2022-05-07 07:32:01 +01:00
|
|
|
|
|
|
|
let mut suggested = false;
|
2022-09-05 17:32:23 -04:00
|
|
|
// Don't suggest setting the type params if there are some already: the order is
|
|
|
|
// tricky to get right and the user will already know what the syntax is.
|
|
|
|
if let Some(snippet) = self.span_snippet && self.empty_generic_args {
|
2022-05-07 07:32:01 +01:00
|
|
|
if snippet.ends_with('>') {
|
|
|
|
// The user wrote `Trait<'a, T>` or similar. To provide an accurate suggestion
|
|
|
|
// we would have to preserve the right order. For now, as clearly the user is
|
|
|
|
// aware of the syntax, we do nothing.
|
|
|
|
} else {
|
|
|
|
// The user wrote `Iterator`, so we don't have a type we can suggest, but at
|
|
|
|
// least we can clue them to the correct syntax `Iterator<Type>`.
|
|
|
|
err.span_suggestion(
|
|
|
|
self.span,
|
2022-05-24 15:09:47 +01:00
|
|
|
rustc_errors::fluent::typeck::suggestion,
|
2022-07-25 22:40:00 +09:00
|
|
|
format!(
|
|
|
|
"{}<{}>",
|
|
|
|
snippet,
|
|
|
|
self.missing_type_params
|
|
|
|
.iter()
|
|
|
|
.map(|n| n.to_string())
|
|
|
|
.collect::<Vec<_>>()
|
|
|
|
.join(", ")
|
|
|
|
),
|
2022-05-07 07:32:01 +01:00
|
|
|
Applicability::HasPlaceholders,
|
|
|
|
);
|
|
|
|
suggested = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !suggested {
|
2022-05-24 15:09:47 +01:00
|
|
|
err.span_label(self.span, rustc_errors::fluent::typeck::no_suggestion_label);
|
2022-05-07 07:32:01 +01:00
|
|
|
}
|
|
|
|
|
2022-05-24 15:09:47 +01:00
|
|
|
err.note(rustc_errors::fluent::typeck::note);
|
2022-05-07 07:32:01 +01:00
|
|
|
err
|
|
|
|
}
|
|
|
|
}
|
2022-05-07 07:50:01 +01:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::manual_implementation, code = "E0183")]
|
2022-05-07 07:50:01 +01:00
|
|
|
#[help]
|
|
|
|
pub struct ManualImplementation {
|
|
|
|
#[primary_span]
|
|
|
|
#[label]
|
|
|
|
pub span: Span,
|
|
|
|
pub trait_name: String,
|
|
|
|
}
|
2022-05-07 08:14:48 +01:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::substs_on_overridden_impl)]
|
2022-05-07 08:14:48 +01:00
|
|
|
pub struct SubstsOnOverriddenImpl {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
2022-08-17 17:47:44 +08:00
|
|
|
|
|
|
|
#[derive(LintDiagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::unused_extern_crate)]
|
2022-08-17 17:47:44 +08:00
|
|
|
pub struct UnusedExternCrate {
|
|
|
|
#[suggestion(applicability = "machine-applicable", code = "")]
|
|
|
|
pub span: Span,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(LintDiagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::extern_crate_not_idiomatic)]
|
2022-08-17 17:47:44 +08:00
|
|
|
pub struct ExternCrateNotIdiomatic {
|
2022-08-17 20:45:18 +08:00
|
|
|
#[suggestion_short(applicability = "machine-applicable", code = "{suggestion_code}")]
|
2022-08-17 17:47:44 +08:00
|
|
|
pub span: Span,
|
|
|
|
pub msg_code: String,
|
|
|
|
pub suggestion_code: String,
|
|
|
|
}
|
2022-08-18 08:14:21 -04:00
|
|
|
|
2022-09-18 11:46:56 -04:00
|
|
|
#[derive(Diagnostic)]
|
2022-08-19 15:40:48 +02:00
|
|
|
#[diag(typeck::expected_used_symbol)]
|
2022-08-18 08:14:21 -04:00
|
|
|
pub struct ExpectedUsedSymbol {
|
|
|
|
#[primary_span]
|
|
|
|
pub span: Span,
|
|
|
|
}
|