Auto merge of #144773 - RalfJung:rollup-uif2yyj, r=RalfJung

Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#144397 (`tests/ui/issues/`: The Issues Strike Back [2/N])
 - rust-lang/rust#144410 (Make tier 3 musl targets link dynamically by default)
 - rust-lang/rust#144708 (Add tracing to step.rs and friends)
 - rust-lang/rust#144730 (Create a typed wrapper for codegen backends in bootstrap)
 - rust-lang/rust#144771 (Remove some noisy triagebot pings for myself)
 - rust-lang/rust#144772 (add unsupported_calling_conventions to lint list)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors
2025-08-01 10:20:07 +00:00
76 changed files with 359 additions and 173 deletions
@@ -11,6 +11,7 @@
use rustc_middle::{bug, mir, span_bug};
use rustc_span::sym;
use rustc_target::callconv::{ArgAbi, FnAbi, PassMode};
use tracing::field::Empty;
use tracing::{info, instrument, trace};
use super::{
@@ -18,7 +19,8 @@
Projectable, Provenance, ReturnAction, ReturnContinuation, Scalar, StackPopInfo, interp_ok,
throw_ub, throw_ub_custom, throw_unsup_format,
};
use crate::fluent_generated as fluent;
use crate::interpret::EnteredTraceSpan;
use crate::{enter_trace_span, fluent_generated as fluent};
/// An argument passed to a function.
#[derive(Clone, Debug)]
@@ -344,6 +346,8 @@ pub fn init_stack_frame(
destination: &PlaceTy<'tcx, M::Provenance>,
mut cont: ReturnContinuation,
) -> InterpResult<'tcx> {
let _span = enter_trace_span!(M, step::init_stack_frame, %instance, tracing_separate_thread = Empty);
// Compute callee information.
// FIXME: for variadic support, do we have to somehow determine callee's extra_args?
let callee_fn_abi = self.fn_abi_of_instance(instance, ty::List::empty())?;
@@ -523,7 +527,9 @@ pub(super) fn init_fn_call(
target: Option<mir::BasicBlock>,
unwind: mir::UnwindAction,
) -> InterpResult<'tcx> {
trace!("init_fn_call: {:#?}", fn_val);
let _span =
enter_trace_span!(M, step::init_fn_call, tracing_separate_thread = Empty, ?fn_val)
.or_if_tracing_disabled(|| trace!("init_fn_call: {:#?}", fn_val));
let instance = match fn_val {
FnVal::Instance(instance) => instance,
@@ -13,6 +13,7 @@
use rustc_middle::ty::{ConstInt, ScalarInt, Ty, TyCtxt};
use rustc_middle::{bug, mir, span_bug, ty};
use rustc_span::DUMMY_SP;
use tracing::field::Empty;
use tracing::trace;
use super::{
@@ -20,6 +21,7 @@
OffsetMode, PlaceTy, Pointer, Projectable, Provenance, Scalar, alloc_range, err_ub,
from_known_layout, interp_ok, mir_assign_valid_types, throw_ub,
};
use crate::enter_trace_span;
/// An `Immediate` represents a single immediate self-contained Rust value.
///
@@ -770,6 +772,13 @@ pub fn eval_place_to_op(
mir_place: mir::Place<'tcx>,
layout: Option<TyAndLayout<'tcx>>,
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
let _span = enter_trace_span!(
M,
step::eval_place_to_op,
?mir_place,
tracing_separate_thread = Empty
);
// Do not use the layout passed in as argument if the base we are looking at
// here is not the entire place.
let layout = if mir_place.projection.is_empty() { layout } else { None };
@@ -813,6 +822,9 @@ pub fn eval_operand(
mir_op: &mir::Operand<'tcx>,
layout: Option<TyAndLayout<'tcx>>,
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
let _span =
enter_trace_span!(M, step::eval_operand, ?mir_op, tracing_separate_thread = Empty);
use rustc_middle::mir::Operand::*;
let op = match mir_op {
// FIXME: do some more logic on `move` to invalidate the old location
@@ -9,6 +9,7 @@
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::{bug, mir, span_bug};
use tracing::field::Empty;
use tracing::{instrument, trace};
use super::{
@@ -16,6 +17,7 @@
InterpResult, Machine, MemoryKind, Misalignment, OffsetMode, OpTy, Operand, Pointer,
Projectable, Provenance, Scalar, alloc_range, interp_ok, mir_assign_valid_types,
};
use crate::enter_trace_span;
#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
/// Information required for the sound usage of a `MemPlace`.
@@ -524,6 +526,9 @@ pub fn eval_place(
&self,
mir_place: mir::Place<'tcx>,
) -> InterpResult<'tcx, PlaceTy<'tcx, M::Provenance>> {
let _span =
enter_trace_span!(M, step::eval_place, ?mir_place, tracing_separate_thread = Empty);
let mut place = self.local_to_place(mir_place.local)?;
// Using `try_fold` turned out to be bad for performance, hence the loop.
for elem in mir_place.projection.iter() {
@@ -9,13 +9,15 @@
use rustc_middle::{bug, mir, span_bug};
use rustc_span::source_map::Spanned;
use rustc_target::callconv::FnAbi;
use tracing::field::Empty;
use tracing::{info, instrument, trace};
use super::{
FnArg, FnVal, ImmTy, Immediate, InterpCx, InterpResult, Machine, MemPlaceMeta, PlaceTy,
Projectable, Scalar, interp_ok, throw_ub, throw_unsup_format,
};
use crate::util;
use crate::interpret::EnteredTraceSpan;
use crate::{enter_trace_span, util};
struct EvaluatedCalleeAndArgs<'tcx, M: Machine<'tcx>> {
callee: FnVal<'tcx, M::ExtraFnVal>,
@@ -74,7 +76,14 @@ pub fn step(&mut self) -> InterpResult<'tcx, bool> {
///
/// This does NOT move the statement counter forward, the caller has to do that!
pub fn eval_statement(&mut self, stmt: &mir::Statement<'tcx>) -> InterpResult<'tcx> {
info!("{:?}", stmt);
let _span = enter_trace_span!(
M,
step::eval_statement,
stmt = ?stmt.kind,
span = ?stmt.source_info.span,
tracing_separate_thread = Empty,
)
.or_if_tracing_disabled(|| info!(stmt = ?stmt.kind));
use rustc_middle::mir::StatementKind::*;
@@ -456,7 +465,14 @@ fn eval_callee_and_args(
}
fn eval_terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> InterpResult<'tcx> {
info!("{:?}", terminator.kind);
let _span = enter_trace_span!(
M,
step::eval_terminator,
terminator = ?terminator.kind,
span = ?terminator.source_info.span,
tracing_separate_thread = Empty,
)
.or_if_tracing_disabled(|| info!(terminator = ?terminator.kind));
use rustc_middle::mir::TerminatorKind::*;
match terminator.kind {
@@ -48,10 +48,24 @@ pub(crate) fn create_static_alloc<'tcx>(
/// A marker trait returned by [crate::interpret::Machine::enter_trace_span], identifying either a
/// real [tracing::span::EnteredSpan] in case tracing is enabled, or the dummy type `()` when
/// tracing is disabled.
pub trait EnteredTraceSpan {}
impl EnteredTraceSpan for () {}
impl EnteredTraceSpan for tracing::span::EnteredSpan {}
/// tracing is disabled. Also see [crate::enter_trace_span!] below.
pub trait EnteredTraceSpan {
/// Allows executing an alternative function when tracing is disabled. Useful for example if you
/// want to open a trace span when tracing is enabled, and alternatively just log a line when
/// tracing is disabled.
fn or_if_tracing_disabled(self, f: impl FnOnce()) -> Self;
}
impl EnteredTraceSpan for () {
fn or_if_tracing_disabled(self, f: impl FnOnce()) -> Self {
f(); // tracing is disabled, execute the function
self
}
}
impl EnteredTraceSpan for tracing::span::EnteredSpan {
fn or_if_tracing_disabled(self, _f: impl FnOnce()) -> Self {
self // tracing is enabled, don't execute anything
}
}
/// Shortand for calling [crate::interpret::Machine::enter_trace_span] on a [tracing::info_span!].
/// This is supposed to be compiled out when [crate::interpret::Machine::enter_trace_span] has the
@@ -112,6 +126,19 @@ impl EnteredTraceSpan for tracing::span::EnteredSpan {}
/// # type M = rustc_const_eval::const_eval::CompileTimeMachine<'static>;
/// let _span = enter_trace_span!(M, step::eval_statement, tracing_separate_thread = tracing::field::Empty);
/// ```
///
/// ### Executing something else when tracing is disabled
///
/// [crate::interpret::Machine::enter_trace_span] returns [EnteredTraceSpan], on which you can call
/// [EnteredTraceSpan::or_if_tracing_disabled], to e.g. log a line as an alternative to the tracing
/// span for when tracing is disabled. For example:
/// ```rust
/// # use rustc_const_eval::enter_trace_span;
/// # use rustc_const_eval::interpret::EnteredTraceSpan;
/// # type M = rustc_const_eval::const_eval::CompileTimeMachine<'static>;
/// let _span = enter_trace_span!(M, step::eval_statement)
/// .or_if_tracing_disabled(|| tracing::info!("eval_statement"));
/// ```
#[macro_export]
macro_rules! enter_trace_span {
($machine:ty, $name:ident :: $subname:ident $($tt:tt)*) => {
+1
View File
@@ -125,6 +125,7 @@
UNSAFE_OP_IN_UNSAFE_FN,
UNSTABLE_NAME_COLLISIONS,
UNSTABLE_SYNTAX_PRE_EXPANSION,
UNSUPPORTED_CALLING_CONVENTIONS,
UNUSED_ASSIGNMENTS,
UNUSED_ASSOCIATED_TYPE_BOUNDS,
UNUSED_ATTRIBUTES,
@@ -7,7 +7,6 @@ pub(crate) fn target() -> Target {
// FIXME: HVX length defaults are per-CPU
base.features = "-small-data,+hvx-length128b".into();
base.crt_static_default = false;
base.has_rpath = true;
base.linker_flavor = LinkerFlavor::Unix(Cc::Yes);
@@ -23,8 +23,6 @@ pub(crate) fn target() -> Target {
abi: "abi64".into(),
endian: Endian::Big,
mcount: "_mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
llvm_abiname: "n64".into(),
..base
},
@@ -10,8 +10,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
base.abi = "elfv2".into();
base.llvm_abiname = "elfv2".into();
@@ -9,8 +9,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "powerpc-unknown-linux-musl".into(),
@@ -9,8 +9,6 @@ pub(crate) fn target() -> Target {
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-mspe"]);
base.max_atomic_width = Some(32);
base.stack_probes = StackProbeType::Inline;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "powerpc-unknown-linux-muslspe".into(),
@@ -23,8 +23,6 @@ pub(crate) fn target() -> Target {
llvm_abiname: "ilp32d".into(),
max_atomic_width: Some(32),
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}
@@ -13,8 +13,6 @@ pub(crate) fn target() -> Target {
base.stack_probes = StackProbeType::Inline;
base.supported_sanitizers =
SanitizerSet::ADDRESS | SanitizerSet::LEAK | SanitizerSet::MEMORY | SanitizerSet::THREAD;
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;
Target {
llvm_target: "s390x-unknown-linux-musl".into(),
@@ -27,8 +27,6 @@ pub(crate) fn target() -> Target {
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
crt_static_default: true,
..base::linux_musl::opts()
},
}
+11 -8
View File
@@ -13,7 +13,7 @@
};
use crate::core::config::TargetSelection;
use crate::utils::build_stamp::{self, BuildStamp};
use crate::{Compiler, Mode, Subcommand};
use crate::{CodegenBackendKind, Compiler, Mode, Subcommand};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Std {
@@ -312,7 +312,7 @@ fn prepare_compiler_for_check(
pub struct CodegenBackend {
pub build_compiler: Compiler,
pub target: TargetSelection,
pub backend: &'static str,
pub backend: CodegenBackendKind,
}
impl Step for CodegenBackend {
@@ -327,14 +327,14 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
fn make_run(run: RunConfig<'_>) {
// FIXME: only check the backend(s) that were actually selected in run.paths
let build_compiler = prepare_compiler_for_check(run.builder, run.target, Mode::Codegen);
for &backend in &["cranelift", "gcc"] {
for backend in [CodegenBackendKind::Cranelift, CodegenBackendKind::Gcc] {
run.builder.ensure(CodegenBackend { build_compiler, target: run.target, backend });
}
}
fn run(self, builder: &Builder<'_>) {
// FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved
if builder.build.config.vendor && self.backend == "gcc" {
if builder.build.config.vendor && self.backend.is_gcc() {
println!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled.");
return;
}
@@ -354,19 +354,22 @@ fn run(self, builder: &Builder<'_>) {
cargo
.arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{backend}/Cargo.toml")));
.arg(builder.src.join(format!("compiler/{}/Cargo.toml", backend.crate_name())));
rustc_cargo_env(builder, &mut cargo, target);
let _guard = builder.msg_check(format!("rustc_codegen_{backend}"), target, None);
let _guard = builder.msg_check(backend.crate_name(), target, None);
let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, backend)
let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, &backend)
.with_prefix("check");
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
}
fn metadata(&self) -> Option<StepMetadata> {
Some(StepMetadata::check(self.backend, self.target).built_by(self.build_compiler))
Some(
StepMetadata::check(&self.backend.crate_name(), self.target)
.built_by(self.build_compiler),
)
}
}
+14 -10
View File
@@ -33,7 +33,10 @@
use crate::utils::helpers::{
exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
};
use crate::{CLang, Compiler, DependencyType, FileType, GitRepo, LLVM_TOOLS, Mode, debug, trace};
use crate::{
CLang, CodegenBackendKind, Compiler, DependencyType, FileType, GitRepo, LLVM_TOOLS, Mode,
debug, trace,
};
/// Build a standard library for the given `target` using the given `compiler`.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -1330,7 +1333,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS
}
if let Some(backend) = builder.config.default_codegen_backend(target) {
cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend);
cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend.name());
}
let libdir_relative = builder.config.libdir_relative().unwrap_or_else(|| Path::new("lib"));
@@ -1543,7 +1546,7 @@ fn run(self, builder: &Builder<'_>) {
pub struct CodegenBackend {
pub target: TargetSelection,
pub compiler: Compiler,
pub backend: String,
pub backend: CodegenBackendKind,
}
fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
@@ -1568,7 +1571,7 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
if path.contains(CODEGEN_BACKEND_PREFIX) {
let mut needs_codegen_backend_config = true;
for backend in run.builder.config.codegen_backends(run.target) {
if path.ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + backend)) {
if path.ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + backend.name())) {
needs_codegen_backend_config = false;
}
}
@@ -1602,7 +1605,7 @@ fn make_run(run: RunConfig<'_>) {
}
for backend in run.builder.config.codegen_backends(run.target) {
if backend == "llvm" {
if backend.is_llvm() {
continue; // Already built as part of rustc
}
@@ -1663,20 +1666,21 @@ fn run(self, builder: &Builder<'_>) {
);
cargo
.arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{backend}/Cargo.toml")));
.arg(builder.src.join(format!("compiler/{}/Cargo.toml", backend.crate_name())));
rustc_cargo_env(builder, &mut cargo, target);
// Ideally, we'd have a separate step for the individual codegen backends,
// like we have in tests (test::CodegenGCC) but that would require a lot of restructuring.
// If the logic gets more complicated, it should probably be done.
if backend == "gcc" {
if backend.is_gcc() {
let gcc = builder.ensure(Gcc { target });
add_cg_gcc_cargo_flags(&mut cargo, &gcc);
}
let tmp_stamp = BuildStamp::new(&out_dir).with_prefix("tmp");
let _guard = builder.msg_build(compiler, format_args!("codegen backend {backend}"), target);
let _guard =
builder.msg_build(compiler, format_args!("codegen backend {}", backend.name()), target);
let files = run_cargo(builder, cargo, vec![], &tmp_stamp, vec![], false, false);
if builder.config.dry_run() {
return;
@@ -1731,7 +1735,7 @@ fn copy_codegen_backends_to_sysroot(
}
for backend in builder.config.codegen_backends(target) {
if backend == "llvm" {
if backend.is_llvm() {
continue; // Already built as part of rustc
}
@@ -2161,7 +2165,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
let _codegen_backend_span =
span!(tracing::Level::DEBUG, "building requested codegen backends").entered();
for backend in builder.config.codegen_backends(target_compiler.host) {
if backend == "llvm" {
if backend.is_llvm() {
debug!("llvm codegen backend is already built as part of rustc");
continue; // Already built as part of rustc
}
+16 -14
View File
@@ -32,7 +32,7 @@
exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
};
use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
use crate::{Compiler, DependencyType, FileType, LLVM_TOOLS, Mode, trace};
use crate::{CodegenBackendKind, Compiler, DependencyType, FileType, LLVM_TOOLS, Mode, trace};
pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
format!("{}-{}", component, builder.rust_package_vers())
@@ -1372,10 +1372,10 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
}
}
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct CodegenBackend {
pub compiler: Compiler,
pub backend: String,
pub backend: CodegenBackendKind,
}
impl Step for CodegenBackend {
@@ -1389,7 +1389,7 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
fn make_run(run: RunConfig<'_>) {
for backend in run.builder.config.codegen_backends(run.target) {
if backend == "llvm" {
if backend.is_llvm() {
continue; // Already built as part of rustc
}
@@ -1412,12 +1412,11 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
return None;
}
if !builder.config.codegen_backends(self.compiler.host).contains(&self.backend.to_string())
{
if !builder.config.codegen_backends(self.compiler.host).contains(&self.backend) {
return None;
}
if self.backend == "cranelift" && !target_supports_cranelift_backend(self.compiler.host) {
if self.backend.is_cranelift() && !target_supports_cranelift_backend(self.compiler.host) {
builder.info("target not supported by rustc_codegen_cranelift. skipping");
return None;
}
@@ -1425,15 +1424,18 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
let compiler = self.compiler;
let backend = self.backend;
let mut tarball =
Tarball::new(builder, &format!("rustc-codegen-{backend}"), &compiler.host.triple);
if backend == "cranelift" {
let mut tarball = Tarball::new(
builder,
&format!("rustc-codegen-{}", backend.name()),
&compiler.host.triple,
);
if backend.is_cranelift() {
tarball.set_overlay(OverlayKind::RustcCodegenCranelift);
} else {
panic!("Unknown backend rustc_codegen_{backend}");
panic!("Unknown codegen backend {}", backend.name());
}
tarball.is_preview(true);
tarball.add_legal_and_readme_to(format!("share/doc/rustc_codegen_{backend}"));
tarball.add_legal_and_readme_to(format!("share/doc/{}", backend.crate_name()));
let src = builder.sysroot(compiler);
let backends_src = builder.sysroot_codegen_backends(compiler);
@@ -1445,7 +1447,7 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
// Don't use custom libdir here because ^lib/ will be resolved again with installer
let backends_dst = PathBuf::from("lib").join(backends_rel);
let backend_name = format!("rustc_codegen_{backend}");
let backend_name = backend.crate_name();
let mut found_backend = false;
for backend in fs::read_dir(&backends_src).unwrap() {
let file_name = backend.unwrap().file_name();
@@ -1575,7 +1577,7 @@ macro_rules! add_component {
add_component!("analysis" => Analysis { compiler, target });
add_component!("rustc-codegen-cranelift" => CodegenBackend {
compiler: builder.compiler(stage, target),
backend: "cranelift".to_string(),
backend: CodegenBackendKind::Cranelift,
});
add_component!("llvm-bitcode-linker" => LlvmBitcodeLinker {
build_compiler: compiler,
@@ -12,7 +12,7 @@
use crate::utils::exec::command;
use crate::utils::helpers::t;
use crate::utils::tarball::GeneratedTarball;
use crate::{Compiler, Kind};
use crate::{CodegenBackendKind, Compiler, Kind};
#[cfg(target_os = "illumos")]
const SHELL: &str = "bash";
@@ -276,7 +276,7 @@ fn run($sel, $builder: &Builder<'_>) {
RustcCodegenCranelift, alias = "rustc-codegen-cranelift", Self::should_build(_config), only_hosts: true, {
if let Some(tarball) = builder.ensure(dist::CodegenBackend {
compiler: self.compiler,
backend: "cranelift".to_string(),
backend: CodegenBackendKind::Cranelift,
}) {
install_sh(builder, "rustc-codegen-cranelift", self.compiler.stage, Some(self.target), &tarball);
} else {
+6 -4
View File
@@ -33,7 +33,7 @@
linker_flags, t, target_supports_cranelift_backend, up_to_date,
};
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
use crate::{CLang, DocTests, GitRepo, Mode, PathSet, debug, envify};
use crate::{CLang, CodegenBackendKind, DocTests, GitRepo, Mode, PathSet, debug, envify};
const ADB_TEST_DIR: &str = "/data/local/tmp/work";
@@ -1786,7 +1786,9 @@ fn run(self, builder: &Builder<'_>) {
cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.host_target));
if let Some(codegen_backend) = builder.config.default_codegen_backend(compiler.host) {
cmd.arg("--codegen-backend").arg(&codegen_backend);
// Tells compiletest which codegen backend is used by default by the compiler.
// It is used to e.g. ignore tests that don't support that codegen backend.
cmd.arg("--codegen-backend").arg(codegen_backend.name());
}
if builder.build.config.llvm_enzyme {
@@ -3406,7 +3408,7 @@ fn make_run(run: RunConfig<'_>) {
return;
}
if !builder.config.codegen_backends(run.target).contains(&"cranelift".to_owned()) {
if !builder.config.codegen_backends(run.target).contains(&CodegenBackendKind::Cranelift) {
builder.info("cranelift not in rust.codegen-backends. skipping");
return;
}
@@ -3533,7 +3535,7 @@ fn make_run(run: RunConfig<'_>) {
return;
}
if !builder.config.codegen_backends(run.target).contains(&"gcc".to_owned()) {
if !builder.config.codegen_backends(run.target).contains(&CodegenBackendKind::Gcc) {
builder.info("gcc not in rust.codegen-backends. skipping");
return;
}
+1 -1
View File
@@ -1286,7 +1286,7 @@ fn cargo(
if let Some(limit) = limit
&& (build_compiler_stage == 0
|| self.config.default_codegen_backend(target).unwrap_or_default() == "llvm")
|| self.config.default_codegen_backend(target).unwrap_or_default().is_llvm())
{
rustflags.arg(&format!("-Cllvm-args=-import-instr-limit={limit}"));
}
+8 -8
View File
@@ -141,7 +141,7 @@ fn metadata(&self) -> Option<StepMetadata> {
#[allow(unused)]
#[derive(Debug, PartialEq, Eq)]
pub struct StepMetadata {
name: &'static str,
name: String,
kind: Kind,
target: TargetSelection,
built_by: Option<Compiler>,
@@ -151,28 +151,28 @@ pub struct StepMetadata {
}
impl StepMetadata {
pub fn build(name: &'static str, target: TargetSelection) -> Self {
pub fn build(name: &str, target: TargetSelection) -> Self {
Self::new(name, target, Kind::Build)
}
pub fn check(name: &'static str, target: TargetSelection) -> Self {
pub fn check(name: &str, target: TargetSelection) -> Self {
Self::new(name, target, Kind::Check)
}
pub fn doc(name: &'static str, target: TargetSelection) -> Self {
pub fn doc(name: &str, target: TargetSelection) -> Self {
Self::new(name, target, Kind::Doc)
}
pub fn dist(name: &'static str, target: TargetSelection) -> Self {
pub fn dist(name: &str, target: TargetSelection) -> Self {
Self::new(name, target, Kind::Dist)
}
pub fn test(name: &'static str, target: TargetSelection) -> Self {
pub fn test(name: &str, target: TargetSelection) -> Self {
Self::new(name, target, Kind::Test)
}
fn new(name: &'static str, target: TargetSelection, kind: Kind) -> Self {
Self { name, kind, target, built_by: None, stage: None, metadata: None }
fn new(name: &str, target: TargetSelection, kind: Kind) -> Self {
Self { name: name.to_string(), kind, target, built_by: None, stage: None, metadata: None }
}
pub fn built_by(mut self, compiler: Compiler) -> Self {
+12 -12
View File
@@ -1309,8 +1309,8 @@ fn check_compiler_no_explicit_stage() {
.path("compiler")
.render_steps(), @r"
[check] rustc 0 <host> -> rustc 1 <host>
[check] rustc 0 <host> -> cranelift 1 <host>
[check] rustc 0 <host> -> gcc 1 <host>
[check] rustc 0 <host> -> rustc_codegen_cranelift 1 <host>
[check] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
");
}
@@ -1341,8 +1341,8 @@ fn check_compiler_stage_1() {
.stage(1)
.render_steps(), @r"
[check] rustc 0 <host> -> rustc 1 <host>
[check] rustc 0 <host> -> cranelift 1 <host>
[check] rustc 0 <host> -> gcc 1 <host>
[check] rustc 0 <host> -> rustc_codegen_cranelift 1 <host>
[check] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
");
}
@@ -1358,8 +1358,8 @@ fn check_compiler_stage_2() {
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[check] rustc 1 <host> -> rustc 2 <host>
[check] rustc 1 <host> -> cranelift 2 <host>
[check] rustc 1 <host> -> gcc 2 <host>
[check] rustc 1 <host> -> rustc_codegen_cranelift 2 <host>
[check] rustc 1 <host> -> rustc_codegen_gcc 2 <host>
");
}
@@ -1377,8 +1377,8 @@ fn check_cross_compile() {
[build] rustc 1 <host> -> std 1 <target1>
[check] rustc 1 <host> -> rustc 2 <target1>
[check] rustc 1 <host> -> Rustdoc 2 <target1>
[check] rustc 1 <host> -> cranelift 2 <target1>
[check] rustc 1 <host> -> gcc 2 <target1>
[check] rustc 1 <host> -> rustc_codegen_cranelift 2 <target1>
[check] rustc 1 <host> -> rustc_codegen_gcc 2 <target1>
[check] rustc 1 <host> -> Clippy 2 <target1>
[check] rustc 1 <host> -> Miri 2 <target1>
[check] rustc 1 <host> -> CargoMiri 2 <target1>
@@ -1472,8 +1472,8 @@ fn check_library_skip_without_download_rustc() {
.args(&args)
.render_steps(), @r"
[check] rustc 0 <host> -> rustc 1 <host>
[check] rustc 0 <host> -> cranelift 1 <host>
[check] rustc 0 <host> -> gcc 1 <host>
[check] rustc 0 <host> -> rustc_codegen_cranelift 1 <host>
[check] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
");
}
@@ -1557,8 +1557,8 @@ fn check_codegen() {
.path("rustc_codegen_cranelift")
.render_steps(), @r"
[check] rustc 0 <host> -> rustc 1 <host>
[check] rustc 0 <host> -> cranelift 1 <host>
[check] rustc 0 <host> -> gcc 1 <host>
[check] rustc 0 <host> -> rustc_codegen_cranelift 1 <host>
[check] rustc 0 <host> -> rustc_codegen_gcc 1 <host>
");
}
+6 -6
View File
@@ -51,7 +51,7 @@
use crate::utils::channel;
use crate::utils::exec::{ExecutionContext, command};
use crate::utils::helpers::{exe, get_host_target};
use crate::{GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t};
use crate::{CodegenBackendKind, GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t};
/// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic.
/// This means they can be modified and changes to these paths should never trigger a compiler build
@@ -208,7 +208,7 @@ pub struct Config {
pub rustc_default_linker: Option<String>,
pub rust_optimize_tests: bool,
pub rust_dist_src: bool,
pub rust_codegen_backends: Vec<String>,
pub rust_codegen_backends: Vec<CodegenBackendKind>,
pub rust_verify_llvm_ir: bool,
pub rust_thin_lto_import_instr_limit: Option<u32>,
pub rust_randomize_layout: bool,
@@ -350,7 +350,7 @@ pub fn default_opts() -> Config {
channel: "dev".to_string(),
codegen_tests: true,
rust_dist_src: true,
rust_codegen_backends: vec!["llvm".to_owned()],
rust_codegen_backends: vec![CodegenBackendKind::Llvm],
deny_warnings: true,
bindir: "bin".into(),
dist_include_mingw_linker: true,
@@ -1747,7 +1747,7 @@ pub fn profiler_enabled(&self, target: TargetSelection) -> bool {
.unwrap_or(self.profiler)
}
pub fn codegen_backends(&self, target: TargetSelection) -> &[String] {
pub fn codegen_backends(&self, target: TargetSelection) -> &[CodegenBackendKind] {
self.target_config
.get(&target)
.and_then(|cfg| cfg.codegen_backends.as_deref())
@@ -1758,7 +1758,7 @@ pub fn jemalloc(&self, target: TargetSelection) -> bool {
self.target_config.get(&target).and_then(|cfg| cfg.jemalloc).unwrap_or(self.jemalloc)
}
pub fn default_codegen_backend(&self, target: TargetSelection) -> Option<String> {
pub fn default_codegen_backend(&self, target: TargetSelection) -> Option<CodegenBackendKind> {
self.codegen_backends(target).first().cloned()
}
@@ -1774,7 +1774,7 @@ pub fn optimized_compiler_builtins(&self, target: TargetSelection) -> bool {
}
pub fn llvm_enabled(&self, target: TargetSelection) -> bool {
self.codegen_backends(target).contains(&"llvm".to_owned())
self.codegen_backends(target).contains(&CodegenBackendKind::Llvm)
}
pub fn llvm_libunwind(&self, target: TargetSelection) -> LlvmLibunwind {
+20 -7
View File
@@ -11,7 +11,9 @@
DebuginfoLevel, Merge, ReplaceOpt, RustcLto, StringOrBool, set, threads_from_config,
};
use crate::flags::Warnings;
use crate::{BTreeSet, Config, HashSet, PathBuf, TargetSelection, define_config, exit};
use crate::{
BTreeSet, CodegenBackendKind, Config, HashSet, PathBuf, TargetSelection, define_config, exit,
};
define_config! {
/// TOML representation of how the Rust build is configured.
@@ -389,9 +391,13 @@ macro_rules! warn {
Ok(())
}
pub(crate) const VALID_CODEGEN_BACKENDS: &[&str] = &["llvm", "cranelift", "gcc"];
pub(crate) const BUILTIN_CODEGEN_BACKENDS: &[&str] = &["llvm", "cranelift", "gcc"];
pub(crate) fn validate_codegen_backends(backends: Vec<String>, section: &str) -> Vec<String> {
pub(crate) fn parse_codegen_backends(
backends: Vec<String>,
section: &str,
) -> Vec<CodegenBackendKind> {
let mut found_backends = vec![];
for backend in &backends {
if let Some(stripped) = backend.strip_prefix(CODEGEN_BACKEND_PREFIX) {
panic!(
@@ -400,14 +406,21 @@ pub(crate) fn validate_codegen_backends(backends: Vec<String>, section: &str) ->
Please, use '{stripped}' instead."
)
}
if !VALID_CODEGEN_BACKENDS.contains(&backend.as_str()) {
if !BUILTIN_CODEGEN_BACKENDS.contains(&backend.as_str()) {
println!(
"HELP: '{backend}' for '{section}.codegen-backends' might fail. \
List of known good values: {VALID_CODEGEN_BACKENDS:?}"
List of known codegen backends: {BUILTIN_CODEGEN_BACKENDS:?}"
);
}
let backend = match backend.as_str() {
"llvm" => CodegenBackendKind::Llvm,
"cranelift" => CodegenBackendKind::Cranelift,
"gcc" => CodegenBackendKind::Gcc,
backend => CodegenBackendKind::Custom(backend.to_string()),
};
found_backends.push(backend);
}
backends
found_backends
}
#[cfg(not(test))]
@@ -609,7 +622,7 @@ pub fn apply_rust_config(&mut self, toml_rust: Option<Rust>, warnings: Warnings)
llvm_libunwind.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
set(
&mut self.rust_codegen_backends,
codegen_backends.map(|backends| validate_codegen_backends(backends, "rust")),
codegen_backends.map(|backends| parse_codegen_backends(backends, "rust")),
);
self.rust_codegen_units = codegen_units.map(threads_from_config);
+4 -4
View File
@@ -16,9 +16,9 @@
use serde::{Deserialize, Deserializer};
use crate::core::config::toml::rust::validate_codegen_backends;
use crate::core::config::toml::rust::parse_codegen_backends;
use crate::core::config::{LlvmLibunwind, Merge, ReplaceOpt, SplitDebuginfo, StringOrBool};
use crate::{Config, HashSet, PathBuf, TargetSelection, define_config, exit};
use crate::{CodegenBackendKind, Config, HashSet, PathBuf, TargetSelection, define_config, exit};
define_config! {
/// TOML representation of how each build target is configured.
@@ -76,7 +76,7 @@ pub struct Target {
pub qemu_rootfs: Option<PathBuf>,
pub runner: Option<String>,
pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
pub codegen_backends: Option<Vec<CodegenBackendKind>>,
pub optimized_compiler_builtins: Option<bool>,
pub jemalloc: Option<bool>,
}
@@ -144,7 +144,7 @@ pub fn apply_target_config(&mut self, toml_target: Option<HashMap<String, TomlTa
target.jemalloc = cfg.jemalloc;
if let Some(backends) = cfg.codegen_backends {
target.codegen_backends =
Some(validate_codegen_backends(backends, &format!("target.{triple}")))
Some(parse_codegen_backends(backends, &format!("target.{triple}")))
}
target.split_debuginfo = cfg.split_debuginfo.as_ref().map(|v| {
+40
View File
@@ -123,6 +123,46 @@ fn eq(&self, other: &Self) -> bool {
}
}
/// Represents a codegen backend.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
pub enum CodegenBackendKind {
#[default]
Llvm,
Cranelift,
Gcc,
Custom(String),
}
impl CodegenBackendKind {
/// Name of the codegen backend, as identified in the `compiler` directory
/// (`rustc_codegen_<name>`).
pub fn name(&self) -> &str {
match self {
CodegenBackendKind::Llvm => "llvm",
CodegenBackendKind::Cranelift => "cranelift",
CodegenBackendKind::Gcc => "gcc",
CodegenBackendKind::Custom(name) => name,
}
}
/// Name of the codegen backend's crate, e.g. `rustc_codegen_cranelift`.
pub fn crate_name(&self) -> String {
format!("rustc_codegen_{}", self.name())
}
pub fn is_llvm(&self) -> bool {
matches!(self, Self::Llvm)
}
pub fn is_cranelift(&self) -> bool {
matches!(self, Self::Cranelift)
}
pub fn is_gcc(&self) -> bool {
matches!(self, Self::Gcc)
}
}
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum DocTests {
/// Run normal tests and doc tests (default).
+3 -3
View File
@@ -10,7 +10,7 @@
use crate::core::builder::Builder;
use crate::core::config::TargetSelection;
use crate::utils::helpers::{hex_encode, mtime};
use crate::{Compiler, Mode, helpers, t};
use crate::{CodegenBackendKind, Compiler, Mode, helpers, t};
#[cfg(test)]
mod tests;
@@ -129,10 +129,10 @@ pub fn codegen_backend_stamp(
builder: &Builder<'_>,
compiler: Compiler,
target: TargetSelection,
backend: &str,
backend: &CodegenBackendKind,
) -> BuildStamp {
BuildStamp::new(&builder.cargo_out(compiler, Mode::Codegen, target))
.with_prefix(&format!("librustc_codegen_{backend}"))
.with_prefix(&format!("lib{}", backend.crate_name()))
}
/// Cargo's output path for the standard library in a given stage, compiled
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13264
//@ run-pass
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11709
//@ run-pass
#![allow(dead_code)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12041
use std::sync::mpsc::channel;
use std::thread;
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `tx`
--> $DIR/issue-12041.rs:8:22
--> $DIR/moved-value-in-thread-loop-12041.rs:10:22
|
LL | let tx = tx;
| ^^ value moved here, in previous iteration of loop
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12033
//@ run-pass
use std::cell::RefCell;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11869
//@ check-pass
#![allow(dead_code)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12127
#![feature(unboxed_closures, tuple_trait)]
fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
@@ -1,5 +1,5 @@
error[E0382]: use of moved value: `f`
--> $DIR/issue-12127.rs:11:9
--> $DIR/fnonce-moved-twice-12127.rs:13:9
|
LL | f();
| --- `f` moved due to this call
@@ -7,11 +7,11 @@ LL | f();
| ^ value used here after move
|
note: this value implements `FnOnce`, which causes it to be moved when called
--> $DIR/issue-12127.rs:10:9
--> $DIR/fnonce-moved-twice-12127.rs:12:9
|
LL | f();
| ^
= note: move occurs because `f` has type `{closure@$DIR/issue-12127.rs:8:24: 8:30}`, which does not implement the `Copy` trait
= note: move occurs because `f` has type `{closure@$DIR/fnonce-moved-twice-12127.rs:10:24: 10:30}`, which does not implement the `Copy` trait
error: aborting due to 1 previous error
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11958
//@ run-pass
// We shouldn't need to rebind a moved upvar as mut if it's already
@@ -1,5 +1,5 @@
warning: value assigned to `x` is never read
--> $DIR/issue-11958.rs:8:36
--> $DIR/moved-upvar-mut-rebind-11958.rs:10:36
|
LL | let _thunk = Box::new(move|| { x = 2; });
| ^
@@ -8,7 +8,7 @@ LL | let _thunk = Box::new(move|| { x = 2; });
= note: `#[warn(unused_assignments)]` on by default
warning: unused variable: `x`
--> $DIR/issue-11958.rs:8:36
--> $DIR/moved-upvar-mut-rebind-11958.rs:10:36
|
LL | let _thunk = Box::new(move|| { x = 2; });
| ^
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12744
//@ run-pass
fn main() {
fn test() -> Box<dyn std::any::Any + 'static> { Box::new(1) }
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12860
//@ run-pass
use std::collections::HashSet;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13446
// Used to cause ICE
static VEC: [u32; 256] = vec![];
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-13446.rs:3:26
--> $DIR/vec-macro-in-static-array.rs:5:26
|
LL | static VEC: [u32; 256] = vec![];
| ^^^^^^ expected `[u32; 256]`, found `Vec<_>`
+49
View File
@@ -0,0 +1,49 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13259
//@ run-pass
#[cfg(windows)]
mod imp {
type LPVOID = *mut u8;
type DWORD = u32;
type LPWSTR = *mut u16;
extern "system" {
fn FormatMessageW(
flags: DWORD,
lpSrc: LPVOID,
msgId: DWORD,
langId: DWORD,
buf: LPWSTR,
nsize: DWORD,
args: *const u8,
) -> DWORD;
}
pub fn test() {
let mut buf: [u16; 50] = [0; 50];
let ret = unsafe {
FormatMessageW(
0x1000,
core::ptr::null_mut(),
1,
0x400,
buf.as_mut_ptr(),
buf.len() as u32,
core::ptr::null(),
)
};
// On some 32-bit Windowses (Win7-8 at least) this will panic with segmented
// stacks taking control of pvArbitrary
assert!(ret != 0);
}
}
#[cfg(not(windows))]
mod imp {
pub fn test() {}
}
fn main() {
imp::test()
}
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13105
//@ edition: 2015
//@ check-pass
@@ -1,39 +0,0 @@
//@ run-pass
#[cfg(windows)]
mod imp {
type LPVOID = *mut u8;
type DWORD = u32;
type LPWSTR = *mut u16;
extern "system" {
fn FormatMessageW(flags: DWORD,
lpSrc: LPVOID,
msgId: DWORD,
langId: DWORD,
buf: LPWSTR,
nsize: DWORD,
args: *const u8)
-> DWORD;
}
pub fn test() {
let mut buf: [u16; 50] = [0; 50];
let ret = unsafe {
FormatMessageW(0x1000, core::ptr::null_mut(), 1, 0x400,
buf.as_mut_ptr(), buf.len() as u32, core::ptr::null())
};
// On some 32-bit Windowses (Win7-8 at least) this will panic with segmented
// stacks taking control of pvArbitrary
assert!(ret != 0);
}
}
#[cfg(not(windows))]
mod imp {
pub fn test() { }
}
fn main() {
imp::test()
}
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12677
//@ run-pass
fn main() {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13058
use std::ops::Range;
trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; }
@@ -1,5 +1,5 @@
error[E0621]: explicit lifetime required in the type of `cont`
--> $DIR/issue-13058.rs:14:21
--> $DIR/iterator-trait-lifetime-error-13058.rs:16:21
|
LL | let cont_iter = cont.iter();
| ^^^^^^^^^^^ lifetime `'r` required
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13167
//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13323
//@ run-pass
struct StrWrap {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13405
//@ check-pass
#![allow(dead_code)]
#![allow(unused_variables)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11740
//@ check-pass
struct Attr {
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11844
fn main() {
let a = Some(Box::new(1));
match a {
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-11844.rs:4:9
--> $DIR/option-result-mismatch-11844.rs:6:9
|
LL | match a {
| - this expression has type `Option<Box<{integer}>>`
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13466
// Regression test for #13466
//@ dont-require-annotations: NOTE
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-13466.rs:10:9
--> $DIR/option-result-type-param-mismatch-13466.rs:12:9
|
LL | let _x: usize = match Some(1) {
| ------- this expression has type `Option<{integer}>`
@@ -10,7 +10,7 @@ LL | Ok(u) => u,
found enum `Result<_, _>`
error[E0308]: mismatched types
--> $DIR/issue-13466.rs:16:9
--> $DIR/option-result-type-param-mismatch-13466.rs:18:9
|
LL | let _x: usize = match Some(1) {
| ------- this expression has type `Option<{integer}>`
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13027
//@ run-pass
// Tests that match expression handles overlapped literal and range
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12567
fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
match (l1, l2) {
//~^ ERROR: cannot move out of type `[T]`, a non-copy slice
@@ -1,5 +1,5 @@
error[E0508]: cannot move out of type `[T]`, a non-copy slice
--> $DIR/issue-12567.rs:2:11
--> $DIR/slice-move-out-error-12567.rs:4:11
|
LL | match (l1, l2) {
| ^^^^^^^^ cannot move out of here
@@ -23,7 +23,7 @@ LL + (&[hd1, ..], [hd2, ..])
|
error[E0508]: cannot move out of type `[T]`, a non-copy slice
--> $DIR/issue-12567.rs:2:11
--> $DIR/slice-move-out-error-12567.rs:4:11
|
LL | match (l1, l2) {
| ^^^^^^^^ cannot move out of here
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12285
//@ run-pass
struct S;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12920
//@ run-fail
//@ error-pattern:explicit panic
//@ needs-subprocess
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13407
mod A {
struct C;
}
@@ -1,17 +1,17 @@
error[E0603]: unit struct `C` is private
--> $DIR/issue-13407.rs:6:8
--> $DIR/private-unit-struct-assignment.rs:8:8
|
LL | A::C = 1;
| ^ private unit struct
|
note: the unit struct `C` is defined here
--> $DIR/issue-13407.rs:2:5
--> $DIR/private-unit-struct-assignment.rs:4:5
|
LL | struct C;
| ^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/issue-13407.rs:6:5
--> $DIR/private-unit-struct-assignment.rs:8:5
|
LL | struct C;
| -------- unit struct defined here
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12729
//@ edition: 2015
//@ check-pass
#![allow(dead_code)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11820
//@ run-pass
#![allow(noop_method_call)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13214
//@ build-pass
#![allow(dead_code)]
// defining static with struct that contains enum
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13204
//@ run-pass
#![allow(unused_mut)]
// Test that when instantiating trait default methods, typeck handles
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13434
//@ run-pass
#[derive(Debug)]
struct MyStruct;
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12909
//@ run-pass
#![allow(unused_variables)]
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/12863
mod foo { pub fn bar() {} }
fn main() {
@@ -1,5 +1,5 @@
error[E0532]: expected unit struct, unit variant or constant, found function `foo::bar`
--> $DIR/issue-12863.rs:5:9
--> $DIR/function-in-pattern-error-12863.rs:7:9
|
LL | foo::bar => {}
| ^^^^^^^^ not a unit struct, unit variant or constant
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13359
//@ dont-require-annotations: NOTE
fn foo(_s: i16) { }
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-13359.rs:8:9
--> $DIR/isize-usize-mismatch-error.rs:10:9
|
LL | foo(1*(1 as isize));
| --- ^^^^^^^^^^^^^^ expected `i16`, found `isize`
@@ -7,7 +7,7 @@ LL | foo(1*(1 as isize));
| arguments to this function are incorrect
|
note: function defined here
--> $DIR/issue-13359.rs:3:4
--> $DIR/isize-usize-mismatch-error.rs:5:4
|
LL | fn foo(_s: i16) { }
| ^^^ -------
@@ -17,7 +17,7 @@ LL | foo((1*(1 as isize)).try_into().unwrap());
| + +++++++++++++++++++++
error[E0308]: mismatched types
--> $DIR/issue-13359.rs:12:9
--> $DIR/isize-usize-mismatch-error.rs:14:9
|
LL | bar(1*(1 as usize));
| --- ^^^^^^^^^^^^^^ expected `u32`, found `usize`
@@ -25,7 +25,7 @@ LL | bar(1*(1 as usize));
| arguments to this function are incorrect
|
note: function defined here
--> $DIR/issue-13359.rs:5:4
--> $DIR/isize-usize-mismatch-error.rs:7:4
|
LL | fn bar(_s: u32) { }
| ^^^ -------
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/11771
fn main() {
let x = ();
1 +
@@ -1,5 +1,5 @@
error[E0277]: cannot add `()` to `{integer}`
--> $DIR/issue-11771.rs:3:7
--> $DIR/unit-type-add-error-11771.rs:5:7
|
LL | 1 +
| ^ no implementation for `{integer} + ()`
@@ -17,7 +17,7 @@ LL | 1 +
and 56 others
error[E0277]: cannot add `()` to `{integer}`
--> $DIR/issue-11771.rs:8:7
--> $DIR/unit-type-add-error-11771.rs:10:7
|
LL | 1 +
| ^ no implementation for `{integer} + ()`
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/13202
//@ run-fail
//@ error-pattern:bad input
//@ needs-subprocess
-8
View File
@@ -1007,10 +1007,6 @@ cc = [
message = "Some changes occurred in GUI tests."
cc = ["@GuillaumeGomez"]
[mentions."tests/run-make/"]
message = "This PR modifies `run-make` tests."
cc = ["@jieyouxu"]
[mentions."tests/auxiliary/minicore.rs"]
message = "This PR modifies `tests/auxiliary/minicore.rs`."
cc = ["@jieyouxu"]
@@ -1113,10 +1109,6 @@ Otherwise, you can ignore this comment.
[mentions."src/tools/x"]
message = "`src/tools/x` was changed. Bump version of Cargo.toml in `src/tools/x` so tidy will suggest installing the new version."
[mentions."src/tools/tidy"]
message = "There are changes to the `tidy` tool."
cc = ["@jieyouxu"]
[mentions."src/tools/tidy/src/deps.rs"]
message = "The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging."
cc = ["@davidtwco", "@wesleywiser"]