mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 05:53:10 +00:00
typeck: port "manual implementations"
Port the "manual implementations of `X` are experimental" diagnostic to use the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
78cc331bd7
commit
664733efd5
@ -122,3 +122,8 @@ typeck-missing-type-params =
|
||||
*[other] references
|
||||
} to {$parameters}
|
||||
.note = because of the default `Self` reference, type parameters must be specified on object types
|
||||
|
||||
typeck-manual-implementation =
|
||||
manual implementations of `{$trait_name}` are experimental
|
||||
.label = manual implementations of `{$trait_name}` are experimental
|
||||
.help = add `#![feature(unboxed_closures)]` to the crate attributes to enable
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::astconv::AstConv;
|
||||
use crate::errors::MissingTypeParams;
|
||||
use crate::errors::{ManualImplementation, MissingTypeParams};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{pluralize, struct_span_err, Applicability, ErrorGuaranteed};
|
||||
use rustc_hir as hir;
|
||||
@ -121,19 +121,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
|
||||
if is_impl {
|
||||
let trait_name = self.tcx().def_path_str(trait_def_id);
|
||||
struct_span_err!(
|
||||
self.tcx().sess,
|
||||
span,
|
||||
E0183,
|
||||
"manual implementations of `{}` are experimental",
|
||||
trait_name,
|
||||
)
|
||||
.span_label(
|
||||
span,
|
||||
format!("manual implementations of `{}` are experimental", trait_name),
|
||||
)
|
||||
.help("add `#![feature(unboxed_closures)]` to the crate attributes to enable")
|
||||
.emit();
|
||||
self.tcx().sess.emit_err(ManualImplementation { span, trait_name });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,3 +313,13 @@ impl<'a> SessionDiagnostic<'a> for MissingTypeParams {
|
||||
err
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[error(code = "E0183", slug = "typeck-manual-implementation")]
|
||||
#[help]
|
||||
pub struct ManualImplementation {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub trait_name: String,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user