Skip to content

Commit acea7df

Browse files
Remove last remaining usages of UnsupportedLiteral
1 parent 04fedf7 commit acea7df

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,6 @@ attr_parsing_unstable_cfg_target_compact =
235235
attr_parsing_unstable_feature_bound_incompatible_stability = item annotated with `#[unstable_feature_bound]` should not be stable
236236
.help = If this item is meant to be stable, do not use any functions annotated with `#[unstable_feature_bound]`. Otherwise, mark this item as unstable with `#[unstable]`
237237
238-
attr_parsing_unsupported_literal_generic =
239-
unsupported literal
240238
attr_parsing_unsupported_literal_suggestion =
241239
consider removing the prefix
242240

compiler/rustc_attr_parsing/src/attributes/stability.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,7 @@ pub(crate) fn parse_stability<S: Stage>(
302302
for param in list.mixed() {
303303
let param_span = param.span();
304304
let Some(param) = param.meta_item() else {
305-
cx.emit_err(session_diagnostics::UnsupportedLiteral {
306-
span: param_span,
307-
is_bytestr: false,
308-
start_point_span: cx.sess().source_map().start_point(param_span),
309-
});
305+
cx.unexpected_literal(param.span());
310306
return None;
311307
};
312308

@@ -381,11 +377,7 @@ pub(crate) fn parse_unstability<S: Stage>(
381377

382378
for param in list.mixed() {
383379
let Some(param) = param.meta_item() else {
384-
cx.emit_err(session_diagnostics::UnsupportedLiteral {
385-
span: param.span(),
386-
is_bytestr: false,
387-
start_point_span: cx.sess().source_map().start_point(param.span()),
388-
});
380+
cx.unexpected_literal(param.span());
389381
return None;
390382
};
391383

compiler/rustc_attr_parsing/src/session_diagnostics.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -217,31 +217,6 @@ pub(crate) struct InvalidReprHintNoValue {
217217
pub name: Symbol,
218218
}
219219

220-
/// Error code: E0565
221-
// FIXME(jdonszelmann): slowly phased out
222-
pub(crate) struct UnsupportedLiteral {
223-
pub span: Span,
224-
pub is_bytestr: bool,
225-
pub start_point_span: Span,
226-
}
227-
228-
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for UnsupportedLiteral {
229-
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
230-
let mut diag = Diag::new(dcx, level, fluent::attr_parsing_unsupported_literal_generic);
231-
diag.span(self.span);
232-
diag.code(E0565);
233-
if self.is_bytestr {
234-
diag.span_suggestion(
235-
self.start_point_span,
236-
fluent::attr_parsing_unsupported_literal_suggestion,
237-
"",
238-
Applicability::MaybeIncorrect,
239-
);
240-
}
241-
diag
242-
}
243-
}
244-
245220
#[derive(Diagnostic)]
246221
#[diag(attr_parsing_invalid_repr_align_need_arg, code = E0589)]
247222
pub(crate) struct InvalidReprAlignNeedArg {

0 commit comments

Comments
 (0)