Skip to content

Commit b471447

Browse files
committed
line-wrap and extend comments, typos
1 parent 9ca61e3 commit b471447

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ impl<'a> IntoIterator for LLVMFeature<'a> {
211211
/// To find a list of LLVM's names, see llvm-project/llvm/lib/Target/{ARCH}/*.td
212212
/// where `{ARCH}` is the architecture name. Look for instances of `SubtargetFeature`.
213213
///
214-
/// Check the current rustc fork of LLVM in the repo at <https://github.com/rust-lang/llvm-project/>.
215-
/// The commit in use can be found via the `llvm-project` submodule in
216-
/// <https://github.com/rust-lang/rust/tree/master/src> Though note that Rust can also be build with
217-
/// an external precompiled version of LLVM which might lead to failures if the oldest tested /
218-
/// supported LLVM version doesn't yet support the relevant intrinsics.
214+
/// Check the current rustc fork of LLVM in the repo at
215+
/// <https://github.com/rust-lang/llvm-project/>. The commit in use can be found via the
216+
/// `llvm-project` submodule in <https://github.com/rust-lang/rust/tree/master/src> Though note that
217+
/// Rust can also be build with an external precompiled version of LLVM which might lead to failures
218+
/// if the oldest tested / supported LLVM version doesn't yet support the relevant intrinsics.
219219
pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFeature<'a>> {
220220
let arch = if sess.target.arch == "x86_64" {
221221
"x86"

compiler/rustc_codegen_ssa/src/target_features.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ fn parse_rust_feature_flag<'a>(
178178
if let Some(base_feature) = feature.strip_prefix('+') {
179179
callback(base_feature, sess.target.implied_target_features(base_feature), true)
180180
} else if let Some(base_feature) = feature.strip_prefix('-') {
181-
// If `f1` implies `f2`, then `!f2` implies `!f1` -- this is standard logical contraposition.
182-
// So we have to find all the reverse implications of `base_feature` and disable them, too.
181+
// If `f1` implies `f2`, then `!f2` implies `!f1` -- this is standard logical
182+
// contraposition. So we have to find all the reverse implications of `base_feature` and
183+
// disable them, too.
183184

184185
let inverse_implied_features = inverse_implied_features.get_or_insert_with(|| {
185186
let mut set: FxHashMap<&str, FxHashSet<&str>> = FxHashMap::default();
@@ -191,7 +192,7 @@ fn parse_rust_feature_flag<'a>(
191192
set
192193
});
193194

194-
// Inverse mplied target features have their own inverse implied target features, so we
195+
// Inverse implied target features have their own inverse implied target features, so we
195196
// traverse the map until there are no more features to add.
196197
let mut features = FxHashSet::default();
197198
let mut new_features = vec![base_feature];
@@ -214,8 +215,8 @@ fn parse_rust_feature_flag<'a>(
214215
/// to populate `sess.unstable_target_features` and `sess.target_features` (these are the first and
215216
/// 2nd component of the return value, respectively).
216217
///
217-
/// `target_base_has_feature` should check whether the given feature (a Rust feature name!) is enabled
218-
/// in the "base" target machine, i.e., without applying `-Ctarget-feature`.
218+
/// `target_base_has_feature` should check whether the given feature (a Rust feature name!) is
219+
/// enabled in the "base" target machine, i.e., without applying `-Ctarget-feature`.
219220
///
220221
/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled elsewhere.
221222
pub fn cfg_target_feature(
@@ -231,6 +232,8 @@ pub fn cfg_target_feature(
231232
.filter(|(feature, _, _)| {
232233
// Skip checking special features, those are not known to the backend.
233234
if RUSTC_SPECIAL_FEATURES.contains(feature) {
235+
// FIXME: `true` here means we'll always think the feature is enabled.
236+
// Does that really make sense?
234237
return true;
235238
}
236239
target_base_has_feature(feature)
@@ -241,7 +244,10 @@ pub fn cfg_target_feature(
241244
// Add enabled and remove disabled features.
242245
parse_rust_feature_flag(
243246
sess,
244-
/* err_callback */ |_| {},
247+
/* err_callback */
248+
|_| {
249+
// Errors are already emitted in `flag_to_backend_features`; avoid duplicates.
250+
},
245251
|_base_feature, new_features, enabled| {
246252
// Iteration order is irrelevant since this only influences an `UnordSet`.
247253
#[allow(rustc::potential_query_instability)]
@@ -339,8 +345,8 @@ pub fn flag_to_backend_features<'a, const N: usize>(
339345
let feature_state = known_features.iter().find(|&&(v, _, _)| v == base_feature);
340346
match feature_state {
341347
None => {
342-
// This is definitely not a valid Rust feature name. Maybe it is a backend feature name?
343-
// If so, give a better error message.
348+
// This is definitely not a valid Rust feature name. Maybe it is a backend
349+
// feature name? If so, give a better error message.
344350
let rust_feature =
345351
known_features.iter().find_map(|&(rust_feature, _, _)| {
346352
let backend_features = to_backend_features(rust_feature);
@@ -452,7 +458,8 @@ pub(crate) fn provide(providers: &mut Providers) {
452458
Stability::Unstable { .. } | Stability::Forbidden { .. },
453459
)
454460
| (Stability::Forbidden { .. }, Stability::Forbidden { .. }) => {
455-
// The stability in the entry is at least as good as the new one, just keep it.
461+
// The stability in the entry is at least as good as the new
462+
// one, just keep it.
456463
}
457464
_ => {
458465
// Overwrite stabilite.

compiler/rustc_target/src/target_features.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
730730
#[rustfmt::skip]
731731
const IBMZ_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
732732
// tidy-alphabetical-start
733+
// For "backchain", https://github.com/rust-lang/rust/issues/142412 is a stabilization blocker
733734
("backchain", Unstable(sym::s390x_target_feature), &[]),
734735
("concurrent-functions", Unstable(sym::s390x_target_feature), &[]),
735736
("deflate-conversion", Unstable(sym::s390x_target_feature), &[]),

0 commit comments

Comments
 (0)