Skip to content

Commit 65dc7fe

Browse files
committed
Auto merge of rust-lang#128454 - tgross35:rollup-7toa3l1, r=tgross35
Rollup of 7 pull requests Successful merges: - rust-lang#117468 (Stabilize Wasm relaxed SIMD) - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection) - rust-lang#127060 (Migrate `symbol-visibility` `run-make` test to rmake) - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm) - rust-lang#128296 (Update target-spec metadata for loongarch64 targets) - rust-lang#128416 (android: Remove libstd hacks for unsupported Android APIs) - rust-lang#128431 (Add myself as VxWorks target maintainer for reference) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 28a58f2 + 8fb0c91 commit 65dc7fe

File tree

106 files changed

+1622
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1622
-1234
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+16
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,22 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
646646
}
647647
}
648648

649+
// This is a workaround for a LLVM bug that doesn't implicitly enable
650+
// `simd128` when `relaxed-simd` is.
651+
// See <https://github.com/llvm/llvm-project/pull/99803>, which didn't make
652+
// it into a released version of LLVM yet.
653+
//
654+
// This doesn't use the "implicit target feature" system because it is only
655+
// used for function attributes in other targets, which fixes this bug as
656+
// well on the function attribute level.
657+
if sess.target.families.contains(&"wasm".into()) {
658+
if features.iter().any(|f| f == "+relaxed-simd")
659+
&& !features.iter().any(|f| f == "+simd128")
660+
{
661+
features.push("+simd128".into());
662+
}
663+
}
664+
649665
if diagnostics && let Some(f) = check_tied_features(sess, &featsmap) {
650666
sess.dcx().emit_err(TargetFeatureDisableOrEnable {
651667
features: f,

compiler/rustc_codegen_ssa/src/target_features.rs

+8
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ pub fn from_target_feature(
9696
Some(Symbol::intern(feature))
9797
}));
9898
}
99+
100+
for (feature, requires) in tcx.sess.target.implicit_target_features() {
101+
if target_features.iter().any(|f| f.as_str() == *feature)
102+
&& !target_features.iter().any(|f| f.as_str() == *requires)
103+
{
104+
target_features.push(Symbol::intern(requires));
105+
}
106+
}
99107
}
100108

101109
/// Computes the set of target features used in a function for the purposes of

compiler/rustc_lint/messages.ftl

+4-4
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,10 @@ lint_reason_must_be_string_literal = reason must be a string literal
700700
lint_reason_must_come_last = reason in lint attribute must come last
701701
702702
lint_redundant_import = the item `{$ident}` is imported redundantly
703-
.label_imported_here = the item `{ident}` is already imported here
704-
.label_defined_here = the item `{ident}` is already defined here
705-
.label_imported_prelude = the item `{ident}` is already imported by the extern prelude
706-
.label_defined_prelude = the item `{ident}` is already defined by the extern prelude
703+
.label_imported_here = the item `{$ident}` is already imported here
704+
.label_defined_here = the item `{$ident}` is already defined here
705+
.label_imported_prelude = the item `{$ident}` is already imported by the extern prelude
706+
.label_defined_prelude = the item `{$ident}` is already defined by the extern prelude
707707
708708
lint_redundant_import_visibility = glob import doesn't reexport anything with visibility `{$import_vis}` because no imported item is public enough
709709
.note = the most public imported item is `{$max_vis}`

compiler/rustc_lint_defs/src/builtin.rs

+26
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ declare_lint_pass! {
8282
PROC_MACRO_DERIVE_RESOLUTION_FALLBACK,
8383
PTR_CAST_ADD_AUTO_TO_OBJECT,
8484
PUB_USE_OF_PRIVATE_EXTERN_CRATE,
85+
REDUNDANT_IMPORTS,
8586
REDUNDANT_LIFETIMES,
8687
REFINING_IMPL_TRAIT_INTERNAL,
8788
REFINING_IMPL_TRAIT_REACHABLE,
@@ -426,6 +427,31 @@ declare_lint! {
426427
"imports that are never used"
427428
}
428429

430+
declare_lint! {
431+
/// The `redundant_imports` lint detects imports that are redundant due to being
432+
/// imported already; either through a previous import, or being present in
433+
/// the prelude.
434+
///
435+
/// ### Example
436+
///
437+
/// ```rust,compile_fail
438+
/// #![deny(redundant_imports)]
439+
/// use std::option::Option::None;
440+
/// fn foo() -> Option<i32> { None }
441+
/// ```
442+
///
443+
/// {{produces}}
444+
///
445+
/// ### Explanation
446+
///
447+
/// Redundant imports are unnecessary and can be removed to simplify code.
448+
/// If you intended to re-export the item to make it available outside of the
449+
/// module, add a visibility modifier like `pub`.
450+
pub REDUNDANT_IMPORTS,
451+
Allow,
452+
"imports that are redundant due to being imported already"
453+
}
454+
429455
declare_lint! {
430456
/// The `must_not_suspend` lint guards against values that shouldn't be held across suspend points
431457
/// (`.await`)

0 commit comments

Comments
 (0)