Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions compiler/rustc_errors/src/decorate_diag.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/// This module provides types and traits for buffering lints until later in compilation.
use rustc_ast::node_id::NodeId;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::sync::{DynSend, DynSync};
use rustc_error_messages::MultiSpan;
use rustc_lint_defs::{BuiltinLintDiag, Lint, LintId};

use crate::{DynSend, LintDiagnostic, LintDiagnosticBox};
use crate::{LintDiagnostic, LintDiagnosticBox};

/// We can't implement `LintDiagnostic` for `BuiltinLintDiag`, because decorating some of its
/// variants requires types we don't have yet. So, handle that case separately.
pub enum DecorateDiagCompat {
Dynamic(Box<dyn for<'a> LintDiagnosticBox<'a, ()> + DynSend + 'static>),
Dynamic(Box<dyn for<'a> LintDiagnosticBox<'a, ()> + DynSend + DynSync + 'static>),
Builtin(BuiltinLintDiag),
}

Expand All @@ -21,7 +22,9 @@ impl std::fmt::Debug for DecorateDiagCompat {

impl !LintDiagnostic<'_, ()> for BuiltinLintDiag {}

impl<D: for<'a> LintDiagnostic<'a, ()> + DynSend + 'static> From<D> for DecorateDiagCompat {
impl<D: for<'a> LintDiagnostic<'a, ()> + DynSend + DynSync + 'static> From<D>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, does Erased<T> by any chance implement Send/Sync when T does not? It probably shouldn't.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's backed by [u8; N], so it probably does, yeah.

We should probably have some auto-trait bounds on Erased<T> to rule that out.

for DecorateDiagCompat
{
#[inline]
fn from(d: D) -> Self {
Self::Dynamic(Box::new(d))
Expand Down
Loading
Loading