Skip to content

Commit 97ac52f

Browse files
committed
Auto merge of rust-lang#128481 - matthiaskrgr:rollup-efa706r, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#128416 (android: Remove libstd hacks for unsupported Android APIs) - rust-lang#128437 (improve bootstrap to allow selecting llvm tools individually) - rust-lang#128450 (Create COFF archives for non-LLVM backends) - rust-lang#128458 (Emit an error if `#[optimize]` is applied to an incompatible item) - rust-lang#128477 (Finish blessing `coverage/mcdc` tests after LLVM 19 upgrade) - rust-lang#128478 (Ignore `use` declaration reformatting in `.git-blame-ignore-revs`.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 70591dc + ff1476c commit 97ac52f

File tree

18 files changed

+122
-114
lines changed

18 files changed

+122
-114
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ b2d2184edea578109a48ec3d8decbee5948e8f35
2323
# test directives migration
2424
6e48b96692d63a79a14563f27fe5185f122434f8
2525
ec2cc761bc7067712ecc7734502f703fe3b024c8
26+
# format use declarations
27+
84ac80f1921afc243d71fd0caaa4f2838c294102

compiler/rustc_codegen_ssa/src/back/archive.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,7 @@ impl<'a> ArArchiveBuilder<'a> {
220220
"gnu" => ArchiveKind::Gnu,
221221
"bsd" => ArchiveKind::Bsd,
222222
"darwin" => ArchiveKind::Darwin,
223-
"coff" => {
224-
// FIXME: ar_archive_writer doesn't support COFF archives yet.
225-
// https://github.com/rust-lang/ar_archive_writer/issues/9
226-
ArchiveKind::Gnu
227-
}
223+
"coff" => ArchiveKind::Coff,
228224
"aix_big" => ArchiveKind::AixBig,
229225
kind => {
230226
self.sess.dcx().emit_fatal(UnknownArchiveKind { kind });

compiler/rustc_passes/messages.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,10 @@ passes_only_has_effect_on =
542542
*[unspecified] (unspecified--this is a compiler bug)
543543
}
544544
545+
passes_optimize_not_fn_or_closure =
546+
attribute should be applied to function or closure
547+
.label = not a function or closure
548+
545549
passes_outer_crate_level_attr =
546550
crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
547551

compiler/rustc_passes/src/check_attr.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
124124
}
125125
[sym::inline] => self.check_inline(hir_id, attr, span, target),
126126
[sym::coverage] => self.check_coverage(attr, span, target),
127+
[sym::optimize] => self.check_optimize(hir_id, attr, target),
127128
[sym::non_exhaustive] => self.check_non_exhaustive(hir_id, attr, span, target),
128129
[sym::marker] => self.check_marker(hir_id, attr, span, target),
129130
[sym::target_feature] => {
@@ -373,6 +374,27 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
373374
}
374375
}
375376

377+
/// Checks that `#[optimize(..)]` is applied to a function/closure/method,
378+
/// or to an impl block or module.
379+
fn check_optimize(&self, hir_id: HirId, attr: &Attribute, target: Target) {
380+
match target {
381+
Target::Fn
382+
| Target::Closure
383+
| Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent)
384+
| Target::Impl
385+
| Target::Mod => {}
386+
387+
_ => {
388+
self.tcx.emit_node_span_lint(
389+
UNUSED_ATTRIBUTES,
390+
hir_id,
391+
attr.span,
392+
errors::OptimizeNotFnOrClosure,
393+
);
394+
}
395+
}
396+
}
397+
376398
fn check_generic_attr(
377399
&self,
378400
hir_id: HirId,

compiler/rustc_passes/src/errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ pub struct CoverageNotFnOrClosure {
6868
pub defn_span: Span,
6969
}
7070

71+
#[derive(LintDiagnostic)]
72+
#[diag(passes_optimize_not_fn_or_closure)]
73+
pub struct OptimizeNotFnOrClosure;
74+
7175
#[derive(Diagnostic)]
7276
#[diag(passes_should_be_applied_to_fn)]
7377
pub struct AttrShouldBeAppliedToFn {

library/std/src/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl f32 {
574574
#[stable(feature = "rust1", since = "1.0.0")]
575575
#[inline]
576576
pub fn log2(self) -> f32 {
577-
crate::sys::log2f32(self)
577+
unsafe { intrinsics::log2f32(self) }
578578
}
579579

580580
/// Returns the base 10 logarithm of the number.

library/std/src/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl f64 {
574574
#[stable(feature = "rust1", since = "1.0.0")]
575575
#[inline]
576576
pub fn log2(self) -> f64 {
577-
crate::sys::log2f64(self)
577+
unsafe { intrinsics::log2f64(self) }
578578
}
579579

580580
/// Returns the base 10 logarithm of the number.

library/std/src/sys/pal/mod.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,5 @@ cfg_if::cfg_if! {
7676
}
7777
}
7878

79-
#[cfg(not(test))]
80-
cfg_if::cfg_if! {
81-
if #[cfg(target_os = "android")] {
82-
pub use self::android::log2f32;
83-
pub use self::android::log2f64;
84-
} else {
85-
#[inline]
86-
pub fn log2f32(n: f32) -> f32 {
87-
unsafe { crate::intrinsics::log2f32(n) }
88-
}
89-
90-
#[inline]
91-
pub fn log2f64(n: f64) -> f64 {
92-
unsafe { crate::intrinsics::log2f64(n) }
93-
}
94-
}
95-
}
96-
9779
#[cfg(not(target_os = "uefi"))]
9880
pub type RawOsError = i32;

library/std/src/sys/pal/unix/android.rs

Lines changed: 0 additions & 81 deletions
This file was deleted.

library/std/src/sys/pal/unix/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::io::ErrorKind;
88
pub mod weak;
99

1010
pub mod alloc;
11-
pub mod android;
1211
pub mod args;
1312
pub mod env;
1413
pub mod fd;
@@ -237,12 +236,8 @@ pub unsafe fn cleanup() {
237236
}
238237

239238
#[allow(unused_imports)]
240-
#[cfg(not(target_os = "android"))]
241239
pub use libc::signal;
242240

243-
#[cfg(target_os = "android")]
244-
pub use crate::sys::android::signal;
245-
246241
#[inline]
247242
pub(crate) fn is_interrupted(errno: i32) -> bool {
248243
errno == libc::EINTR

0 commit comments

Comments
 (0)