summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorarcnmx <arcnmx@users.noreply.github.com>2016-01-12 15:55:59 -0500
committerarcnmx <arcnmx@users.noreply.github.com>2016-02-11 12:45:52 -0500
commita141c52816b606f01a3eb432ea1c5e1131513d1c (patch)
treef16bf3abbb652cc2aa48d7faa3eb4d39c5c9744d /src/libsyntax
parent32328ac6ff13cf55b61dbfcf0c79aba1b7a8f429 (diff)
downloadrust-a141c52816b606f01a3eb432ea1c5e1131513d1c.tar.gz
rust-a141c52816b606f01a3eb432ea1c5e1131513d1c.zip
Use find_export_name_attr instead of string literal
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/attr.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index c3e3042eff0..fca659e63b5 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -298,16 +298,16 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {
 }
 
 /// Find the value of #[export_name=*] attribute and check its validity.
-pub fn find_export_name_attr(diag: &Handler, attrs: &[Attribute]) -> Option<InternedString> {
+pub fn find_export_name_attr(diag: Option<&Handler>, attrs: &[Attribute]) -> Option<InternedString> {
     attrs.iter().fold(None, |ia,attr| {
         if attr.check_name("export_name") {
             if let s@Some(_) = attr.value_str() {
                 s
             } else {
-                diag.struct_span_err(attr.span,
+                diag.map(|d| d.struct_span_err(attr.span,
                                      "export_name attribute has invalid format")
                     .help("use #[export_name=\"*\"]")
-                    .emit();
+                    .emit());
                 None
             }
         } else {
@@ -318,7 +318,7 @@ pub fn find_export_name_attr(diag: &Handler, attrs: &[Attribute]) -> Option<Inte
 
 pub fn contains_extern_indicator(attrs: &[Attribute]) -> bool {
     contains_name(attrs, "no_mangle") ||
-        contains_name(attrs, "export_name")
+        find_export_name_attr(None, attrs).is_some()
 }
 
 #[derive(Copy, Clone, PartialEq)]