Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2767,6 +2767,10 @@ fn add_order_independent_options(
cmd.pgo_gen();
}

if sess.opts.unstable_opts.instrument_mcount {
cmd.enable_profiling();
}

if sess.opts.cg.control_flow_guard != CFGuard::Disabled {
cmd.control_flow_guard();
}
Expand Down
14 changes: 14 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ pub(crate) trait Linker {
fn add_no_exec(&mut self) {}
fn add_as_needed(&mut self) {}
fn reset_per_library_state(&mut self) {}
fn enable_profiling(&mut self) {}
}

impl dyn Linker + '_ {
Expand Down Expand Up @@ -732,6 +733,19 @@ impl<'a> Linker for GccLinker<'a> {
self.link_or_cc_args(&["-u", "__llvm_profile_runtime"]);
}

fn enable_profiling(&mut self) {
// This flag is also used when linking to choose target specific
// libraries needed to enable profiling.
self.cc_arg("-pg");
// On windows-gnu targets, libgmon also needs to be linked, and this
// requires readding libraries to satisfy its dependencies.
if self.sess.target.is_like_windows {
self.cc_arg("-lgmon");
self.cc_arg("-lkernel32");
self.cc_arg("-lmsvcrt");
}
}

fn control_flow_guard(&mut self) {}

fn ehcont_guard(&mut self) {}
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,14 +1660,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expr: &'tcx hir::Expr<'tcx>,
) -> Ty<'tcx> {
let element_ty = if !args.is_empty() {
// This shouldn't happen unless there's another error
// (e.g., never patterns in inappropriate contexts).
if self.diverges.get() != Diverges::Maybe {
self.dcx()
.struct_span_err(expr.span, "unexpected divergence state in checking array")
.delay_as_bug();
}

let coerce_to = expected
.to_option(self)
.and_then(|uty| {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/base/windows_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pub(crate) fn opts() -> TargetOptions {
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
// output DWO, despite using DWARF, doesn't use ELF..
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
mcount: "_mcount".into(),
..Default::default()
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/base/windows_gnullvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub(crate) fn opts() -> TargetOptions {
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
// output DWO, despite using DWARF, doesn't use ELF..
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
mcount: "_mcount".into(),
..Default::default()
}
}
6 changes: 4 additions & 2 deletions library/core/src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,23 @@ pub const unsafe fn simd_splat<T, U>(value: U) -> T;
/// Adds two simd vectors elementwise.
///
/// `T` must be a vector of integers or floats.
/// For integers, wrapping arithmetic is used.
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn simd_add<T>(x: T, y: T) -> T;

/// Subtracts `rhs` from `lhs` elementwise.
///
/// `T` must be a vector of integers or floats.
/// For integers, wrapping arithmetic is used.
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn simd_sub<T>(lhs: T, rhs: T) -> T;

/// Multiplies two simd vectors elementwise.
///
/// `T` must be a vector of integers or floats.
/// For integers, wrapping arithmetic is used.
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn simd_mul<T>(x: T, y: T) -> T;
Expand Down Expand Up @@ -233,8 +236,7 @@ pub const unsafe fn simd_as<T, U>(x: T) -> U;
/// Negates a vector elementwise.
///
/// `T` must be a vector of integers or floats.
///
/// Rust panics for `-<int>::Min` due to overflow, but it is not UB with this intrinsic.
/// For integers, wrapping arithmetic is used.
#[rustc_intrinsic]
#[rustc_nounwind]
pub const unsafe fn simd_neg<T>(x: T) -> T;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/download-ci-llvm-stamp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Change this file to make users of the `download-ci-llvm` configuration download
a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.

Last change is for: https://github.com/rust-lang/rust/pull/153179
Last change is for: https://github.com/rust-lang/rust/pull/151063
3 changes: 3 additions & 0 deletions tests/run-make/instrument-mcount-link-pg/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello World!");
}
19 changes: 19 additions & 0 deletions tests/run-make/instrument-mcount-link-pg/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// When building a binary instrumented with mcount, verify the
// binary is linked with the correct crt to enable profiling.
//
//@ only-gnu
//@ ignore-cross-compile

use run_make_support::{path, run, rustc};

fn main() {
// Compile instrumentation enabled binary, and verify -pg is passed
let link_args =
rustc().input("main.rs").arg("-Zinstrument-mcount").print("link-args").run().stdout_utf8();
assert!(link_args.contains("\"-pg\""));

// Run it, and verify gmon.out is created
assert!(!path("gmon.out").exists());
run("main");
assert!(path("gmon.out").exists());
}
13 changes: 13 additions & 0 deletions tests/ui/reachable/never-pattern-closure-param-array.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ check-pass
//@ edition: 2024

#![feature(never_patterns)]
#![allow(incomplete_features)]
#![allow(unreachable_code)]

fn main() {
let _ = Some({
return;
})
.map(|!| [1]);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ Hi relnotes-interest-group, this issue/PR could use some help in reviewing /
adjusting release notes. Could you take a look if available? Thanks <3
"""

[ping.gpu-target]
message = """\
Hi GPU experts, this issue/PR could use some guidance on how this should be
resolved/implemented. Could you take a look if available? Thanks <3
"""

# ------------------------------------------------------------------------------
# Autolabels
Expand Down
Loading