Remove Clone impl for DiagnosticBuilder.
It seems like a bad idea, just asking for diagnostics to be emitted multiple times.
This commit is contained in:
@@ -42,7 +42,6 @@ where
|
||||
/// access in the methods of `DiagnosticBuilder` here, consider
|
||||
/// extending `DiagCtxtFlags`.
|
||||
#[must_use]
|
||||
#[derive(Clone)]
|
||||
pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
||||
state: DiagnosticBuilderState<'a>,
|
||||
|
||||
@@ -55,6 +54,10 @@ pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
||||
_marker: PhantomData<G>,
|
||||
}
|
||||
|
||||
// Cloning a `DiagnosticBuilder` is a recipe for a diagnostic being emitted
|
||||
// twice, which would be bad.
|
||||
impl<G> !Clone for DiagnosticBuilder<'_, G> {}
|
||||
|
||||
#[derive(Clone)]
|
||||
enum DiagnosticBuilderState<'a> {
|
||||
/// Initial state of a `DiagnosticBuilder`, before `.emit()` or `.cancel()`.
|
||||
|
||||
Reference in New Issue
Block a user