Change String in structs to &'a str

This commit is contained in:
SLASHLogin 2022-08-25 18:36:15 +02:00
parent 21b04265c1
commit b1647903f8
2 changed files with 6 additions and 6 deletions

View File

@ -2,9 +2,9 @@ use rustc_errors::fluent;
use rustc_errors::DiagnosticBuilder;
use rustc_session::SessionDiagnostic;
pub(crate) enum UnknownCTargetFeature {
UnknownFeaturePrefix { feature: String },
UnknownFeature { feature: String, rust_feature: Option<String> },
pub(crate) enum UnknownCTargetFeature<'a> {
UnknownFeaturePrefix { feature: &'a str },
UnknownFeature { feature: &'a str, rust_feature: Option<&'a str> },
}
impl SessionDiagnostic<'_, ()> for UnknownCTargetFeature {

View File

@ -436,7 +436,7 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
Some(_) => {
if diagnostics {
sess.emit_warning(UnknownCTargetFeature::UnknownFeaturePrefix {
feature: s.to_string(),
feature: s,
});
}
return None;
@ -455,8 +455,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
}
});
sess.emit_warning(UnknownCTargetFeature::UnknownFeature {
feature: feature.to_string(),
rust_feature: rust_feature.map(|f| f.to_string()),
feature,
rust_feature,
});
}