Skip to content

Commit 432cde9

Browse files
Remove now un-used code
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
1 parent e82e472 commit 432cde9

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
@@ -139,12 +118,6 @@ expand_mve_unrecognized_var =
139118
expand_non_inline_modules_in_proc_macro_input_are_unstable =
140119
non-inline modules in proc macro input are unstable
141120
142-
expand_not_a_meta_item =
143-
not a meta item
144-
145-
expand_only_one_word =
146-
must only be one word
147-
148121
expand_proc_macro_back_compat = using an old version of `{$crate_name}`
149122
.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
150123

compiler/rustc_expand/src/base.rs

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

1364-
pub fn parse_macro_name_and_helper_attrs(
1365-
dcx: DiagCtxtHandle<'_>,
1366-
attr: &impl AttributeExt,
1367-
macro_type: &str,
1368-
) -> Option<(Symbol, Vec<Symbol>)> {
1369-
// Once we've located the `#[proc_macro_derive]` attribute, verify
1370-
// that it's of the form `#[proc_macro_derive(Foo)]` or
1371-
// `#[proc_macro_derive(Foo, attributes(A, ..))]`
1372-
let list = attr.meta_item_list()?;
1373-
let ([trait_attr] | [trait_attr, _]) = list.as_slice() else {
1374-
dcx.emit_err(errors::AttrNoArguments { span: attr.span() });
1375-
return None;
1376-
};
1377-
let Some(trait_attr) = trait_attr.meta_item() else {
1378-
dcx.emit_err(errors::NotAMetaItem { span: trait_attr.span() });
1379-
return None;
1380-
};
1381-
let trait_ident = match trait_attr.ident() {
1382-
Some(trait_ident) if trait_attr.is_word() => trait_ident,
1383-
_ => {
1384-
dcx.emit_err(errors::OnlyOneWord { span: trait_attr.span });
1385-
return None;
1386-
}
1387-
};
1388-
1389-
if !trait_ident.name.can_be_raw() {
1390-
dcx.emit_err(errors::CannotBeNameOfMacro {
1391-
span: trait_attr.span,
1392-
trait_ident,
1393-
macro_type,
1394-
});
1395-
}
1396-
1397-
let attributes_attr = list.get(1);
1398-
let proc_attrs: Vec<_> = if let Some(attr) = attributes_attr {
1399-
if !attr.has_name(sym::attributes) {
1400-
dcx.emit_err(errors::ArgumentNotAttributes { span: attr.span() });
1401-
}
1402-
attr.meta_item_list()
1403-
.unwrap_or_else(|| {
1404-
dcx.emit_err(errors::AttributesWrongForm { span: attr.span() });
1405-
&[]
1406-
})
1407-
.iter()
1408-
.filter_map(|attr| {
1409-
let Some(attr) = attr.meta_item() else {
1410-
dcx.emit_err(errors::AttributeMetaItem { span: attr.span() });
1411-
return None;
1412-
};
1413-
1414-
let ident = match attr.ident() {
1415-
Some(ident) if attr.is_word() => ident,
1416-
_ => {
1417-
dcx.emit_err(errors::AttributeSingleWord { span: attr.span });
1418-
return None;
1419-
}
1420-
};
1421-
if !ident.name.can_be_raw() {
1422-
dcx.emit_err(errors::HelperAttributeNameInvalid {
1423-
span: attr.span,
1424-
name: ident,
1425-
});
1426-
}
1427-
1428-
Some(ident.name)
1429-
})
1430-
.collect()
1431-
} else {
1432-
Vec::new()
1433-
};
1434-
1435-
Some((trait_ident.name, proc_attrs))
1436-
}
1437-
14381364
/// If this item looks like a specific enums from `rental`, emit a fatal error.
14391365
/// See #73345 and #83125 for more details.
14401366
/// 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)