Skip to content

Commit 53d3c14

Browse files
Remove now un-used code
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
1 parent 4504d89 commit 53d3c14

File tree

3 files changed

+0
-167
lines changed

3 files changed

+0
-167
lines changed

compiler/rustc_expand/messages.ftl

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
1-
expand_arg_not_attributes =
2-
second argument must be `attributes`
3-
4-
expand_attr_no_arguments =
5-
attribute must have either one or two arguments
6-
7-
expand_attribute_meta_item =
8-
attribute must be a meta item, not a literal
9-
10-
expand_attribute_single_word =
11-
attribute must only be a single word
12-
131
expand_attributes_on_expressions_experimental =
142
attributes on expressions are experimental
153
.help_outer_doc = `///` is used for outer documentation comments; for a plain comment, use `//`
164
.help_inner_doc = `//!` is used for inner documentation comments; for a plain comment, use `//` by removing the `!` or inserting a space in between them: `// !`
175
18-
expand_attributes_wrong_form =
19-
attribute must be of form: `attributes(foo, bar)`
20-
21-
expand_cannot_be_name_of_macro =
22-
`{$trait_ident}` cannot be a name of {$macro_type} macro
23-
246
expand_collapse_debuginfo_illegal =
257
illegal value for attribute #[collapse_debuginfo(no|external|yes)]
268
@@ -71,9 +53,6 @@ expand_glob_delegation_outside_impls =
7153
expand_glob_delegation_traitless_qpath =
7254
qualified path without a trait in glob delegation
7355
74-
expand_helper_attribute_name_invalid =
75-
`{$name}` cannot be a name of derive helper attribute
76-
7756
expand_incomplete_parse =
7857
macro expansion ignores {$descr} and any tokens following
7958
.label = caused by the macro expansion here
@@ -165,12 +144,6 @@ expand_mve_unrecognized_var =
165144
expand_non_inline_modules_in_proc_macro_input_are_unstable =
166145
non-inline modules in proc macro input are unstable
167146
168-
expand_not_a_meta_item =
169-
not a meta item
170-
171-
expand_only_one_word =
172-
must only be one word
173-
174147
expand_proc_macro_back_compat = using an old version of `{$crate_name}`
175148
.note = older versions of the `{$crate_name}` crate no longer compile; please update to `{$crate_name}` v{$fixed_version}, or switch to one of the `{$crate_name}` alternatives
176149

compiler/rustc_expand/src/base.rs

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,80 +1381,6 @@ pub fn resolve_path(sess: &Session, path: impl Into<PathBuf>, span: Span) -> PRe
13811381
}
13821382
}
13831383

1384-
pub fn parse_macro_name_and_helper_attrs(
1385-
dcx: DiagCtxtHandle<'_>,
1386-
attr: &impl AttributeExt,
1387-
macro_type: &str,
1388-
) -> Option<(Symbol, Vec<Symbol>)> {
1389-
// Once we've located the `#[proc_macro_derive]` attribute, verify
1390-
// that it's of the form `#[proc_macro_derive(Foo)]` or
1391-
// `#[proc_macro_derive(Foo, attributes(A, ..))]`
1392-
let list = attr.meta_item_list()?;
1393-
let ([trait_attr] | [trait_attr, _]) = list.as_slice() else {
1394-
dcx.emit_err(errors::AttrNoArguments { span: attr.span() });
1395-
return None;
1396-
};
1397-
let Some(trait_attr) = trait_attr.meta_item() else {
1398-
dcx.emit_err(errors::NotAMetaItem { span: trait_attr.span() });
1399-
return None;
1400-
};
1401-
let trait_ident = match trait_attr.ident() {
1402-
Some(trait_ident) if trait_attr.is_word() => trait_ident,
1403-
_ => {
1404-
dcx.emit_err(errors::OnlyOneWord { span: trait_attr.span });
1405-
return None;
1406-
}
1407-
};
1408-
1409-
if !trait_ident.name.can_be_raw() {
1410-
dcx.emit_err(errors::CannotBeNameOfMacro {
1411-
span: trait_attr.span,
1412-
trait_ident,
1413-
macro_type,
1414-
});
1415-
}
1416-
1417-
let attributes_attr = list.get(1);
1418-
let proc_attrs: Vec<_> = if let Some(attr) = attributes_attr {
1419-
if !attr.has_name(sym::attributes) {
1420-
dcx.emit_err(errors::ArgumentNotAttributes { span: attr.span() });
1421-
}
1422-
attr.meta_item_list()
1423-
.unwrap_or_else(|| {
1424-
dcx.emit_err(errors::AttributesWrongForm { span: attr.span() });
1425-
&[]
1426-
})
1427-
.iter()
1428-
.filter_map(|attr| {
1429-
let Some(attr) = attr.meta_item() else {
1430-
dcx.emit_err(errors::AttributeMetaItem { span: attr.span() });
1431-
return None;
1432-
};
1433-
1434-
let ident = match attr.ident() {
1435-
Some(ident) if attr.is_word() => ident,
1436-
_ => {
1437-
dcx.emit_err(errors::AttributeSingleWord { span: attr.span });
1438-
return None;
1439-
}
1440-
};
1441-
if !ident.name.can_be_raw() {
1442-
dcx.emit_err(errors::HelperAttributeNameInvalid {
1443-
span: attr.span,
1444-
name: ident,
1445-
});
1446-
}
1447-
1448-
Some(ident.name)
1449-
})
1450-
.collect()
1451-
} else {
1452-
Vec::new()
1453-
};
1454-
1455-
Some((trait_ident.name, proc_attrs))
1456-
}
1457-
14581384
/// If this item looks like a specific enums from `rental`, emit a fatal error.
14591385
/// See #73345 and #83125 for more details.
14601386
/// FIXME(#73933): Remove this eventually.

compiler/rustc_expand/src/errors.rs

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -78,72 +78,6 @@ pub(crate) struct MacroBodyStability {
7878
pub head_span: Span,
7979
}
8080

81-
#[derive(Diagnostic)]
82-
#[diag(expand_attr_no_arguments)]
83-
pub(crate) struct AttrNoArguments {
84-
#[primary_span]
85-
pub span: Span,
86-
}
87-
88-
#[derive(Diagnostic)]
89-
#[diag(expand_not_a_meta_item)]
90-
pub(crate) struct NotAMetaItem {
91-
#[primary_span]
92-
pub span: Span,
93-
}
94-
95-
#[derive(Diagnostic)]
96-
#[diag(expand_only_one_word)]
97-
pub(crate) struct OnlyOneWord {
98-
#[primary_span]
99-
pub span: Span,
100-
}
101-
102-
#[derive(Diagnostic)]
103-
#[diag(expand_cannot_be_name_of_macro)]
104-
pub(crate) struct CannotBeNameOfMacro<'a> {
105-
#[primary_span]
106-
pub span: Span,
107-
pub trait_ident: Ident,
108-
pub macro_type: &'a str,
109-
}
110-
111-
#[derive(Diagnostic)]
112-
#[diag(expand_arg_not_attributes)]
113-
pub(crate) struct ArgumentNotAttributes {
114-
#[primary_span]
115-
pub span: Span,
116-
}
117-
118-
#[derive(Diagnostic)]
119-
#[diag(expand_attributes_wrong_form)]
120-
pub(crate) struct AttributesWrongForm {
121-
#[primary_span]
122-
pub span: Span,
123-
}
124-
125-
#[derive(Diagnostic)]
126-
#[diag(expand_attribute_meta_item)]
127-
pub(crate) struct AttributeMetaItem {
128-
#[primary_span]
129-
pub span: Span,
130-
}
131-
132-
#[derive(Diagnostic)]
133-
#[diag(expand_attribute_single_word)]
134-
pub(crate) struct AttributeSingleWord {
135-
#[primary_span]
136-
pub span: Span,
137-
}
138-
139-
#[derive(Diagnostic)]
140-
#[diag(expand_helper_attribute_name_invalid)]
141-
pub(crate) struct HelperAttributeNameInvalid {
142-
#[primary_span]
143-
pub span: Span,
144-
pub name: Ident,
145-
}
146-
14781
#[derive(Diagnostic)]
14882
#[diag(expand_feature_removed, code = E0557)]
14983
#[note]

0 commit comments

Comments
 (0)