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:
parent
75c68cfd2b
commit
ca2fc426a9
2 changed files with 5 additions and 1 deletions
|
@ -42,7 +42,6 @@ where
|
||||||
/// access in the methods of `DiagnosticBuilder` here, consider
|
/// access in the methods of `DiagnosticBuilder` here, consider
|
||||||
/// extending `DiagCtxtFlags`.
|
/// extending `DiagCtxtFlags`.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
||||||
state: DiagnosticBuilderState<'a>,
|
state: DiagnosticBuilderState<'a>,
|
||||||
|
|
||||||
|
@ -55,6 +54,10 @@ pub struct DiagnosticBuilder<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
||||||
_marker: PhantomData<G>,
|
_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)]
|
#[derive(Clone)]
|
||||||
enum DiagnosticBuilderState<'a> {
|
enum DiagnosticBuilderState<'a> {
|
||||||
/// Initial state of a `DiagnosticBuilder`, before `.emit()` or `.cancel()`.
|
/// Initial state of a `DiagnosticBuilder`, before `.emit()` or `.cancel()`.
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#![feature(extract_if)]
|
#![feature(extract_if)]
|
||||||
#![feature(if_let_guard)]
|
#![feature(if_let_guard)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
|
#![feature(negative_impls)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![feature(yeet_expr)]
|
#![feature(yeet_expr)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue