Skip to content

Commit 97bacba

Browse files
Remove adt_const_params usage from compiler
1 parent 847d504 commit 97bacba

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

compiler/rustc_errors/src/diagnostic_builder.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -115,36 +115,22 @@ pub trait EmissionGuarantee: Sized {
115115
) -> DiagnosticBuilder<'_, Self>;
116116
}
117117

118-
/// Private module for sealing the `IsError` helper trait.
119-
mod sealed_level_is_error {
120-
use crate::Level;
121-
122-
/// Sealed helper trait for statically checking that a `Level` is an error.
123-
pub(crate) trait IsError<const L: Level> {}
124-
125-
impl IsError<{ Level::Bug }> for () {}
126-
impl IsError<{ Level::DelayedBug }> for () {}
127-
impl IsError<{ Level::Fatal }> for () {}
128-
// NOTE(eddyb) `Level::Error { lint: true }` is also an error, but lints
129-
// don't need error guarantees, as their levels are always dynamic.
130-
impl IsError<{ Level::Error { lint: false } }> for () {}
131-
}
132-
133118
impl<'a> DiagnosticBuilder<'a, ErrorGuaranteed> {
134119
/// Convenience function for internal use, clients should use one of the
135120
/// `struct_*` methods on [`Handler`].
136121
#[track_caller]
137-
pub(crate) fn new_guaranteeing_error<M: Into<DiagnosticMessage>, const L: Level>(
122+
pub(crate) fn new_guaranteeing_error<M: Into<DiagnosticMessage>>(
138123
handler: &'a Handler,
139124
message: M,
140-
) -> Self
141-
where
142-
(): sealed_level_is_error::IsError<L>,
143-
{
125+
) -> Self {
144126
Self {
145127
inner: DiagnosticBuilderInner {
146128
state: DiagnosticBuilderState::Emittable(handler),
147-
diagnostic: Box::new(Diagnostic::new_with_code(L, None, message)),
129+
diagnostic: Box::new(Diagnostic::new_with_code(
130+
Level::Error { lint: false },
131+
None,
132+
message,
133+
)),
148134
},
149135
_marker: PhantomData,
150136
}
@@ -203,9 +189,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
203189
handler: &Handler,
204190
msg: impl Into<DiagnosticMessage>,
205191
) -> DiagnosticBuilder<'_, Self> {
206-
DiagnosticBuilder::new_guaranteeing_error::<_, { Level::Error { lint: false } }>(
207-
handler, msg,
208-
)
192+
DiagnosticBuilder::new_guaranteeing_error(handler, msg)
209193
}
210194
}
211195

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![feature(array_windows)]
77
#![feature(drain_filter)]
88
#![feature(if_let_guard)]
9-
#![feature(adt_const_params)]
109
#![feature(let_chains)]
1110
#![feature(never_type)]
1211
#![feature(result_option_inspect)]
@@ -845,7 +844,7 @@ impl Handler {
845844
&self,
846845
msg: impl Into<DiagnosticMessage>,
847846
) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
848-
DiagnosticBuilder::new_guaranteeing_error::<_, { Level::Error { lint: false } }>(self, msg)
847+
DiagnosticBuilder::new_guaranteeing_error(self, msg)
849848
}
850849

851850
/// This should only be used by `rustc_middle::lint::struct_lint_level`. Do not use it for hard errors.

0 commit comments

Comments
 (0)