Auto merge of #103787 - notriddle:rollup-q1vmxsb, r=notriddle

Rollup of 8 pull requests

Successful merges:

 - #97971 (Enable varargs support for calling conventions other than C or cdecl )
 - #101428 (Add mir building test directory)
 - #101944 (rustdoc: clean up `#toggle-all-docs`)
 - #102101 (check lld version to choose correct option to disable multi-threading in tests)
 - #102689 (Add a tier 3 target for the Sony PlayStation 1)
 - #103746 (rustdoc: add support for incoherent impls on structs and traits)
 - #103758 (Add regression test for reexports in search results)
 - #103764 (All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-10-31 03:40:22 +00:00
commit 4596f4f8b5
83 changed files with 548 additions and 189 deletions

View File

@ -4,7 +4,7 @@ use rustc_hir::definitions::DisambiguatedDefPathData;
use rustc_middle::mir::interpret::{Allocation, ConstAllocation}; use rustc_middle::mir::interpret::{Allocation, ConstAllocation};
use rustc_middle::ty::{ use rustc_middle::ty::{
self, self,
print::{with_no_verbose_constants, PrettyPrinter, Print, Printer}, print::{PrettyPrinter, Print, Printer},
subst::{GenericArg, GenericArgKind}, subst::{GenericArg, GenericArgKind},
Ty, TyCtxt, Ty, TyCtxt,
}; };
@ -179,6 +179,11 @@ impl<'tcx> PrettyPrinter<'tcx> for AbsolutePathPrinter<'tcx> {
Ok(self) Ok(self)
} }
fn should_print_verbose(&self) -> bool {
// `std::any::type_name` should never print verbose type names
false
}
} }
impl Write for AbsolutePathPrinter<'_> { impl Write for AbsolutePathPrinter<'_> {
@ -190,9 +195,7 @@ impl Write for AbsolutePathPrinter<'_> {
/// Directly returns an `Allocation` containing an absolute path representation of the given type. /// Directly returns an `Allocation` containing an absolute path representation of the given type.
pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ConstAllocation<'tcx> { pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ConstAllocation<'tcx> {
let path = with_no_verbose_constants!( let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path;
AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path
);
let alloc = Allocation::from_bytes_byte_aligned_immutable(path.into_bytes()); let alloc = Allocation::from_bytes_byte_aligned_immutable(path.into_bytes());
tcx.intern_const_alloc(alloc) tcx.intern_const_alloc(alloc)
} }

View File

@ -388,6 +388,9 @@ declare_features! (
(active, exclusive_range_pattern, "1.11.0", Some(37854), None), (active, exclusive_range_pattern, "1.11.0", Some(37854), None),
/// Allows exhaustive pattern matching on types that contain uninhabited types. /// Allows exhaustive pattern matching on types that contain uninhabited types.
(active, exhaustive_patterns, "1.13.0", Some(51085), None), (active, exhaustive_patterns, "1.13.0", Some(51085), None),
/// Allows using `efiapi`, `sysv64` and `win64` as calling convention
/// for functions with varargs.
(active, extended_varargs_abi_support, "1.65.0", Some(100189), None),
/// Allows defining `extern type`s. /// Allows defining `extern type`s.
(active, extern_types, "1.23.0", Some(43467), None), (active, extern_types, "1.23.0", Some(43467), None),
/// Allows the use of `#[ffi_const]` on foreign functions. /// Allows the use of `#[ffi_const]` on foreign functions.

View File

@ -106,7 +106,7 @@ use rustc_middle::middle;
use rustc_middle::ty::query::Providers; use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::util; use rustc_middle::util;
use rustc_session::config::EntryFnType; use rustc_session::{config::EntryFnType, parse::feature_err};
use rustc_span::{symbol::sym, Span, DUMMY_SP}; use rustc_span::{symbol::sym, Span, DUMMY_SP};
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _; use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
@ -118,20 +118,40 @@ use astconv::AstConv;
use bounds::Bounds; use bounds::Bounds;
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) { fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
match (decl.c_variadic, abi) { const ERROR_HEAD: &str = "C-variadic function must have a compatible calling convention";
// The function has the correct calling convention, or isn't a "C-variadic" function. const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `win64`, `sysv64` or `efiapi`";
(false, _) | (true, Abi::C { .. }) | (true, Abi::Cdecl { .. }) => {} const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
// The function is a "C-variadic" function with an incorrect calling convention. const UNSTABLE_EXPLAIN: &str =
(true, _) => { "using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
let mut err = struct_span_err!(
tcx.sess, if !decl.c_variadic || matches!(abi, Abi::C { .. } | Abi::Cdecl { .. }) {
span, return;
E0045,
"C-variadic function must have C or cdecl calling convention"
);
err.span_label(span, "C-variadics require C or cdecl calling convention").emit();
}
} }
let extended_abi_support = tcx.features().extended_varargs_abi_support;
let conventions = match (extended_abi_support, abi.supports_varargs()) {
// User enabled additional ABI support for varargs and function ABI matches those ones.
(true, true) => return,
// Using this ABI would be ok, if the feature for additional ABI support was enabled.
// Return CONVENTIONS_STABLE, because we want the other error to look the same.
(false, true) => {
feature_err(
&tcx.sess.parse_sess,
sym::extended_varargs_abi_support,
span,
UNSTABLE_EXPLAIN,
)
.emit();
CONVENTIONS_STABLE
}
(false, false) => CONVENTIONS_STABLE,
(true, false) => CONVENTIONS_UNSTABLE,
};
let mut err = struct_span_err!(tcx.sess, span, E0045, "{}, like {}", ERROR_HEAD, conventions);
err.span_label(span, ERROR_HEAD).emit();
} }
fn require_same_types<'tcx>( fn require_same_types<'tcx>(

View File

@ -63,7 +63,6 @@ thread_local! {
static NO_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) }; static NO_TRIMMED_PATH: Cell<bool> = const { Cell::new(false) };
static NO_QUERIES: Cell<bool> = const { Cell::new(false) }; static NO_QUERIES: Cell<bool> = const { Cell::new(false) };
static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) }; static NO_VISIBLE_PATH: Cell<bool> = const { Cell::new(false) };
static NO_VERBOSE_CONSTANTS: Cell<bool> = const { Cell::new(false) };
} }
macro_rules! define_helper { macro_rules! define_helper {
@ -118,9 +117,6 @@ define_helper!(
/// Prevent selection of visible paths. `Display` impl of DefId will prefer /// Prevent selection of visible paths. `Display` impl of DefId will prefer
/// visible (public) reexports of types as paths. /// visible (public) reexports of types as paths.
fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH); fn with_no_visible_paths(NoVisibleGuard, NO_VISIBLE_PATH);
/// Prevent verbose printing of constants. Verbose printing of constants is
/// never desirable in some contexts like `std::any::type_name`.
fn with_no_verbose_constants(NoVerboseConstantsGuard, NO_VERBOSE_CONSTANTS);
); );
/// The "region highlights" are used to control region printing during /// The "region highlights" are used to control region printing during
@ -600,7 +596,7 @@ pub trait PrettyPrinter<'tcx>:
} }
ty::FnPtr(ref bare_fn) => p!(print(bare_fn)), ty::FnPtr(ref bare_fn) => p!(print(bare_fn)),
ty::Infer(infer_ty) => { ty::Infer(infer_ty) => {
let verbose = self.tcx().sess.verbose(); let verbose = self.should_print_verbose();
if let ty::TyVar(ty_vid) = infer_ty { if let ty::TyVar(ty_vid) = infer_ty {
if let Some(name) = self.ty_infer_name(ty_vid) { if let Some(name) = self.ty_infer_name(ty_vid) {
p!(write("{}", name)) p!(write("{}", name))
@ -642,7 +638,7 @@ pub trait PrettyPrinter<'tcx>:
p!(print_def_path(def_id, &[])); p!(print_def_path(def_id, &[]));
} }
ty::Projection(ref data) => { ty::Projection(ref data) => {
if !(self.tcx().sess.verbose() || NO_QUERIES.with(|q| q.get())) if !(self.should_print_verbose() || NO_QUERIES.with(|q| q.get()))
&& self.tcx().def_kind(data.item_def_id) == DefKind::ImplTraitPlaceholder && self.tcx().def_kind(data.item_def_id) == DefKind::ImplTraitPlaceholder
{ {
return self.pretty_print_opaque_impl_type(data.item_def_id, data.substs); return self.pretty_print_opaque_impl_type(data.item_def_id, data.substs);
@ -658,7 +654,7 @@ pub trait PrettyPrinter<'tcx>:
// only affect certain debug messages (e.g. messages printed // only affect certain debug messages (e.g. messages printed
// from `rustc_middle::ty` during the computation of `tcx.predicates_of`), // from `rustc_middle::ty` during the computation of `tcx.predicates_of`),
// and should have no effect on any compiler output. // and should have no effect on any compiler output.
if self.tcx().sess.verbose() || NO_QUERIES.with(|q| q.get()) { if self.should_print_verbose() || NO_QUERIES.with(|q| q.get()) {
p!(write("Opaque({:?}, {:?})", def_id, substs)); p!(write("Opaque({:?}, {:?})", def_id, substs));
return Ok(self); return Ok(self);
} }
@ -689,7 +685,7 @@ pub trait PrettyPrinter<'tcx>:
hir::Movability::Static => p!("static "), hir::Movability::Static => p!("static "),
} }
if !self.tcx().sess.verbose() { if !self.should_print_verbose() {
p!("generator"); p!("generator");
// FIXME(eddyb) should use `def_span`. // FIXME(eddyb) should use `def_span`.
if let Some(did) = did.as_local() { if let Some(did) = did.as_local() {
@ -725,7 +721,7 @@ pub trait PrettyPrinter<'tcx>:
} }
ty::Closure(did, substs) => { ty::Closure(did, substs) => {
p!(write("[")); p!(write("["));
if !self.tcx().sess.verbose() { if !self.should_print_verbose() {
p!(write("closure")); p!(write("closure"));
// FIXME(eddyb) should use `def_span`. // FIXME(eddyb) should use `def_span`.
if let Some(did) = did.as_local() { if let Some(did) = did.as_local() {
@ -763,7 +759,7 @@ pub trait PrettyPrinter<'tcx>:
} }
ty::Array(ty, sz) => { ty::Array(ty, sz) => {
p!("[", print(ty), "; "); p!("[", print(ty), "; ");
if !NO_VERBOSE_CONSTANTS.with(|flag| flag.get()) && self.tcx().sess.verbose() { if self.should_print_verbose() {
p!(write("{:?}", sz)); p!(write("{:?}", sz));
} else if let ty::ConstKind::Unevaluated(..) = sz.kind() { } else if let ty::ConstKind::Unevaluated(..) = sz.kind() {
// Do not try to evaluate unevaluated constants. If we are const evaluating an // Do not try to evaluate unevaluated constants. If we are const evaluating an
@ -1077,7 +1073,7 @@ pub trait PrettyPrinter<'tcx>:
// Special-case `Fn(...) -> ...` and re-sugar it. // Special-case `Fn(...) -> ...` and re-sugar it.
let fn_trait_kind = cx.tcx().fn_trait_kind_from_lang_item(principal.def_id); let fn_trait_kind = cx.tcx().fn_trait_kind_from_lang_item(principal.def_id);
if !cx.tcx().sess.verbose() && fn_trait_kind.is_some() { if !cx.should_print_verbose() && fn_trait_kind.is_some() {
if let ty::Tuple(tys) = principal.substs.type_at(0).kind() { if let ty::Tuple(tys) = principal.substs.type_at(0).kind() {
let mut projections = predicates.projection_bounds(); let mut projections = predicates.projection_bounds();
if let (Some(proj), None) = (projections.next(), projections.next()) { if let (Some(proj), None) = (projections.next(), projections.next()) {
@ -1185,7 +1181,7 @@ pub trait PrettyPrinter<'tcx>:
) -> Result<Self::Const, Self::Error> { ) -> Result<Self::Const, Self::Error> {
define_scoped_cx!(self); define_scoped_cx!(self);
if !NO_VERBOSE_CONSTANTS.with(|flag| flag.get()) && self.tcx().sess.verbose() { if self.should_print_verbose() {
p!(write("Const({:?}: {:?})", ct.kind(), ct.ty())); p!(write("Const({:?}: {:?})", ct.kind(), ct.ty()));
return Ok(self); return Ok(self);
} }
@ -1420,7 +1416,7 @@ pub trait PrettyPrinter<'tcx>:
) -> Result<Self::Const, Self::Error> { ) -> Result<Self::Const, Self::Error> {
define_scoped_cx!(self); define_scoped_cx!(self);
if !NO_VERBOSE_CONSTANTS.with(|flag| flag.get()) && self.tcx().sess.verbose() { if self.should_print_verbose() {
p!(write("ValTree({:?}: ", valtree), print(ty), ")"); p!(write("ValTree({:?}: ", valtree), print(ty), ")");
return Ok(self); return Ok(self);
} }
@ -1564,6 +1560,10 @@ pub trait PrettyPrinter<'tcx>:
Ok(cx) Ok(cx)
}) })
} }
fn should_print_verbose(&self) -> bool {
self.tcx().sess.verbose()
}
} }
// HACK(eddyb) boxed to avoid moving around a large struct by-value. // HACK(eddyb) boxed to avoid moving around a large struct by-value.
@ -1839,7 +1839,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
} }
} }
let verbose = self.tcx.sess.verbose(); let verbose = self.should_print_verbose();
disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?; disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
self.empty_path = false; self.empty_path = false;
@ -1940,7 +1940,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
return true; return true;
} }
if self.tcx.sess.verbose() { if self.should_print_verbose() {
return true; return true;
} }
@ -2012,7 +2012,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
return Ok(self); return Ok(self);
} }
if self.tcx.sess.verbose() { if self.should_print_verbose() {
p!(write("{:?}", region)); p!(write("{:?}", region));
return Ok(self); return Ok(self);
} }
@ -2218,7 +2218,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
// aren't named. Eventually, we might just want this as the default, but // aren't named. Eventually, we might just want this as the default, but
// this is not *quite* right and changes the ordering of some output // this is not *quite* right and changes the ordering of some output
// anyways. // anyways.
let (new_value, map) = if self.tcx().sess.verbose() { let (new_value, map) = if self.should_print_verbose() {
let regions: Vec<_> = value let regions: Vec<_> = value
.bound_vars() .bound_vars()
.into_iter() .into_iter()

View File

@ -288,7 +288,7 @@ fn mir_const<'tcx>(
let mut body = tcx.mir_built(def).steal(); let mut body = tcx.mir_built(def).steal();
rustc_middle::mir::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(())); pass_manager::dump_mir_for_phase_change(tcx, &body);
pm::run_passes( pm::run_passes(
tcx, tcx,

View File

@ -845,7 +845,7 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> {
span, span,
); );
rustc_middle::mir::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(())); crate::pass_manager::dump_mir_for_phase_change(tcx, &body);
body body
} }

View File

@ -694,6 +694,7 @@ symbols! {
export_name, export_name,
expr, expr,
extended_key_value_attributes, extended_key_value_attributes,
extended_varargs_abi_support,
extern_absolute_paths, extern_absolute_paths,
extern_crate_item_prelude, extern_crate_item_prelude,
extern_crate_self, extern_crate_self,

View File

@ -40,6 +40,28 @@ pub enum Abi {
RustCold, RustCold,
} }
impl Abi {
pub fn supports_varargs(self) -> bool {
// * C and Cdecl obviously support varargs.
// * C can be based on SysV64 or Win64, so they must support varargs.
// * EfiApi is based on Win64 or C, so it also supports it.
//
// * Stdcall does not, because it would be impossible for the callee to clean
// up the arguments. (callee doesn't know how many arguments are there)
// * Same for Fastcall, Vectorcall and Thiscall.
// * System can become Stdcall, so is also a no-no.
// * Other calling conventions are related to hardware or the compiler itself.
match self {
Self::C { .. }
| Self::Cdecl { .. }
| Self::Win64 { .. }
| Self::SysV64 { .. }
| Self::EfiApi => true,
_ => false,
}
}
}
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct AbiData { pub struct AbiData {
abi: Abi, abi: Abi,

View File

@ -0,0 +1,37 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "mipsel-sony-psx".into(),
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
arch: "mips".into(),
options: TargetOptions {
os: "none".into(),
env: "psx".into(),
vendor: "sony".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
cpu: "mips1".into(),
executables: true,
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,
exe_suffix: ".exe".into(),
// PSX doesn't natively support floats.
features: "+soft-float".into(),
// This should be 16 bits, but LLVM incorrectly tries emitting MIPS-II SYNC instructions
// for atomic loads and stores. This crashes rustc so we have to disable the Atomic* API
// until this is fixed upstream. See https://reviews.llvm.org/D122427#3420144 for more
// info.
max_atomic_width: Some(0),
// PSX does not support trap-on-condition instructions.
llvm_args: cvs!["-mno-check-zero-division"],
llvm_abiname: "o32".into(),
panic_strategy: PanicStrategy::Abort,
..Default::default()
},
}
}

View File

@ -1222,6 +1222,7 @@ supported_targets! {
("armv7a-kmc-solid_asp3-eabihf", armv7a_kmc_solid_asp3_eabihf), ("armv7a-kmc-solid_asp3-eabihf", armv7a_kmc_solid_asp3_eabihf),
("mipsel-sony-psp", mipsel_sony_psp), ("mipsel-sony-psp", mipsel_sony_psp),
("mipsel-sony-psx", mipsel_sony_psx),
("mipsel-unknown-none", mipsel_unknown_none), ("mipsel-unknown-none", mipsel_unknown_none),
("thumbv4t-none-eabi", thumbv4t_none_eabi), ("thumbv4t-none-eabi", thumbv4t_none_eabi),
("armv4t-none-eabi", armv4t_none_eabi), ("armv4t-none-eabi", armv4t_none_eabi),

View File

@ -55,13 +55,9 @@ fn main() {
arg.push(&linker); arg.push(&linker);
cmd.arg(arg); cmd.arg(arg);
} }
if env::var_os("RUSTDOC_FUSE_LD_LLD").is_some() { if let Ok(no_threads) = env::var("RUSTDOC_LLD_NO_THREADS") {
cmd.arg("-Clink-arg=-fuse-ld=lld"); cmd.arg("-Clink-arg=-fuse-ld=lld");
if cfg!(windows) { cmd.arg(format!("-Clink-arg=-Wl,{}", no_threads));
cmd.arg("-Clink-arg=-Wl,/threads:1");
} else {
cmd.arg("-Clink-arg=-Wl,--threads=1");
}
} }
// Cargo doesn't pass RUSTDOCFLAGS to proc_macros: // Cargo doesn't pass RUSTDOCFLAGS to proc_macros:
// https://github.com/rust-lang/cargo/issues/4423 // https://github.com/rust-lang/cargo/issues/4423

View File

@ -1152,8 +1152,8 @@ impl Build {
options[0] = Some("-Clink-arg=-fuse-ld=lld".to_string()); options[0] = Some("-Clink-arg=-fuse-ld=lld".to_string());
} }
let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" }; let no_threads = util::lld_flag_no_threads(target.contains("windows"));
options[1] = Some(format!("-Clink-arg=-Wl,{}", threads)); options[1] = Some(format!("-Clink-arg=-Wl,{}", no_threads));
} }
IntoIterator::into_iter(options).flatten() IntoIterator::into_iter(options).flatten()

View File

@ -771,7 +771,10 @@ impl Step for RustdocTheme {
cmd.env("RUSTDOC_LINKER", linker); cmd.env("RUSTDOC_LINKER", linker);
} }
if builder.is_fuse_ld_lld(self.compiler.host) { if builder.is_fuse_ld_lld(self.compiler.host) {
cmd.env("RUSTDOC_FUSE_LD_LLD", "1"); cmd.env(
"RUSTDOC_LLD_NO_THREADS",
util::lld_flag_no_threads(self.compiler.host.contains("windows")),
);
} }
try_run(builder, &mut cmd); try_run(builder, &mut cmd);
} }

View File

@ -13,6 +13,7 @@ use std::time::{Instant, SystemTime, UNIX_EPOCH};
use crate::builder::Builder; use crate::builder::Builder;
use crate::config::{Config, TargetSelection}; use crate::config::{Config, TargetSelection};
use crate::OnceCell;
/// A helper macro to `unwrap` a result except also print out details like: /// A helper macro to `unwrap` a result except also print out details like:
/// ///
@ -607,3 +608,16 @@ pub fn get_clang_cl_resource_dir(clang_cl_path: &str) -> PathBuf {
let clang_rt_dir = clang_rt_builtins.parent().expect("The clang lib folder should exist"); let clang_rt_dir = clang_rt_builtins.parent().expect("The clang lib folder should exist");
clang_rt_dir.to_path_buf() clang_rt_dir.to_path_buf()
} }
pub fn lld_flag_no_threads(is_windows: bool) -> &'static str {
static LLD_NO_THREADS: OnceCell<(&'static str, &'static str)> = OnceCell::new();
let (windows, other) = LLD_NO_THREADS.get_or_init(|| {
let out = output(Command::new("lld").arg("-flavor").arg("ld").arg("--version"));
let newer = match (out.find(char::is_numeric), out.find('.')) {
(Some(b), Some(e)) => out.as_str()[b..e].parse::<i32>().ok().unwrap_or(14) > 10,
_ => true,
};
if newer { ("/threads:1", "--threads=1") } else { ("/no-threads", "--no-threads") }
});
if is_windows { windows } else { other }
}

View File

@ -29,6 +29,7 @@
- [\*-kmc-solid_\*](platform-support/kmc-solid.md) - [\*-kmc-solid_\*](platform-support/kmc-solid.md)
- [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md) - [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md)
- [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md) - [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md)
- [mipsel-sony-psx](platform-support/mipsel-sony-psx.md)
- [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md) - [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md) - [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
- [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md) - [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md)

View File

@ -260,6 +260,7 @@ target | std | host | notes
`mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc `mips-unknown-linux-uclibc` | ✓ | | MIPS Linux with uClibc
[`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux MUSL [`mips64-openwrt-linux-musl`](platform-support/mips64-openwrt-linux-musl.md) | ? | | MIPS64 for OpenWrt Linux MUSL
`mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP) `mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP)
[`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX)
`mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc `mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc
`mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat `mipsel-unknown-none` | * | | Bare MIPS (LE) softfloat
`mipsisa32r6-unknown-linux-gnu` | ? | | `mipsisa32r6-unknown-linux-gnu` | ? | |

View File

@ -0,0 +1,49 @@
# mipsel-sony-psx
**Tier: 3**
Sony PlayStation 1 (psx)
## Designated Developer
* [@ayrtonm](https://github.com/ayrtonm)
## Requirements
This target is cross-compiled.
It has no special requirements for the host.
## Building
The target can be built by enabling it for a `rustc` build:
```toml
[build]
build-stage = 1
target = ["mipsel-sony-psx"]
```
## Cross-compilation
This target can be cross-compiled from any host.
## Testing
Currently there is no support to run the rustc test suite for this target.
## Building Rust programs
Since it is Tier 3, rust doesn't ship pre-compiled artifacts for this target.
Just use the `build-std` nightly cargo feature to build the `core` and `alloc` libraries:
```shell
cargo build -Zbuild-std=core,alloc --target mipsel-sony-psx
```
The command above generates an ELF. To generate binaries in the PSEXE format that emulators run, you can use [cargo-psx](https://github.com/ayrtonm/psx-sdk-rs#readme):
```shell
cargo psx build
```
or use `-Clink-arg=--oformat=binary` to produce a flat binary.

View File

@ -0,0 +1,10 @@
# `extended_varargs_abi_support`
The tracking issue for this feature is: [#100189]
[#100189]: https://github.com/rust-lang/rust/issues/100189
------------------------
This feature adds the possibility of using `sysv64`, `win64` or `efiapi` calling
conventions on functions with varargs.

View File

@ -323,6 +323,21 @@ pub(crate) fn build_impls(
for &did in tcx.inherent_impls(did).iter() { for &did in tcx.inherent_impls(did).iter() {
build_impl(cx, parent_module, did, attrs, ret); build_impl(cx, parent_module, did, attrs, ret);
} }
// This pretty much exists expressly for `dyn Error` traits that exist in the `alloc` crate.
// See also:
//
// * https://github.com/rust-lang/rust/issues/103170 — where it didn't used to get documented
// * https://github.com/rust-lang/rust/pull/99917 — where the feature got used
// * https://github.com/rust-lang/rust/issues/53487 — overall tracking issue for Error
if tcx.has_attr(did, sym::rustc_has_incoherent_inherent_impls) {
use rustc_middle::ty::fast_reject::SimplifiedTypeGen::*;
let type_ =
if tcx.is_trait(did) { TraitSimplifiedType(did) } else { AdtSimplifiedType(did) };
for &did in tcx.incoherent_impls(type_) {
build_impl(cx, parent_module, did, attrs, ret);
}
}
} }
/// `parent_module` refers to the parent of the re-export, not the original item /// `parent_module` refers to the parent of the re-export, not the original item

View File

@ -163,9 +163,6 @@ h1.fqn {
padding-bottom: 6px; padding-bottom: 6px;
margin-bottom: 15px; margin-bottom: 15px;
} }
#toggle-all-docs {
text-decoration: none;
}
/* The only headings that get underlines are: /* The only headings that get underlines are:
Markdown-generated headings within the top-doc Markdown-generated headings within the top-doc
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc) Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
@ -209,7 +206,7 @@ ul.all-items {
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif; font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
} }
a#toggle-all-docs, #toggle-all-docs,
a.anchor, a.anchor,
.small-section-header a, .small-section-header a,
#source-sidebar a, #source-sidebar a,
@ -299,6 +296,16 @@ button {
padding: 1px 6px; padding: 1px 6px;
} }
button#toggle-all-docs {
padding: 0;
background: none;
border: none;
cursor: pointer;
/* iOS button gradient: https://stackoverflow.com/q/5438567 */
-webkit-appearance: none;
opacity: 1;
}
/* end tweaks for normalize.css 8 */ /* end tweaks for normalize.css 8 */
.rustdoc { .rustdoc {

View File

@ -21,8 +21,8 @@
<a class="srclink" href="{{href|safe}}">source</a> · {# -#} <a class="srclink" href="{{href|safe}}">source</a> · {# -#}
{%- else -%} {%- else -%}
{%- endmatch -%} {%- endmatch -%}
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> {#- -#} <button id="toggle-all-docs" title="collapse all docs"> {#- -#}
[<span class="inner">&#x2212;</span>] {#- -#} [<span>&#x2212;</span>] {#- -#}
</a> {#- -#} </button> {#- -#}
</span> {#- -#} </span> {#- -#}
</div> {#- -#} </div> {#- -#}

View File

@ -1,4 +1,4 @@
// MIR for `bar` 0 mir_map // MIR for `bar` after built
fn bar(_1: Bar) -> usize { fn bar(_1: Bar) -> usize {
debug bar => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11 debug bar => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11

View File

@ -1,4 +1,4 @@
// MIR for `boo` 0 mir_map // MIR for `boo` after built
fn boo(_1: Boo) -> usize { fn boo(_1: Boo) -> usize {
debug boo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11 debug boo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11

View File

@ -1,4 +1,4 @@
// MIR for `droppy` 0 mir_map // MIR for `droppy` after built
fn droppy() -> () { fn droppy() -> () {
let mut _0: (); // return place in scope 0 at $DIR/enum_cast.rs:+0:13: +0:13 let mut _0: (); // return place in scope 0 at $DIR/enum_cast.rs:+0:13: +0:13

View File

@ -1,4 +1,4 @@
// MIR for `foo` 0 mir_map // MIR for `foo` after built
fn foo(_1: Foo) -> usize { fn foo(_1: Foo) -> usize {
debug foo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11 debug foo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11

View File

@ -1,6 +1,6 @@
// EMIT_MIR enum_cast.foo.mir_map.0.mir // EMIT_MIR enum_cast.foo.built.after.mir
// EMIT_MIR enum_cast.bar.mir_map.0.mir // EMIT_MIR enum_cast.bar.built.after.mir
// EMIT_MIR enum_cast.boo.mir_map.0.mir // EMIT_MIR enum_cast.boo.built.after.mir
enum Foo { enum Foo {
A A
@ -27,7 +27,7 @@ fn boo(boo: Boo) -> usize {
boo as usize boo as usize
} }
// EMIT_MIR enum_cast.droppy.mir_map.0.mir // EMIT_MIR enum_cast.droppy.built.after.mir
enum Droppy { enum Droppy {
A, B, C A, B, C
} }

View File

@ -1,4 +1,4 @@
// EMIT_MIR issue_101867.main.mir_map.0.mir // EMIT_MIR issue_101867.main.built.after.mir
fn main() { fn main() {
let x: Option<u8> = Some(1); let x: Option<u8> = Some(1);
let Some(y) = x else { let Some(y) = x else {

View File

@ -1,7 +1,7 @@
// We must mark a variable whose initialization fails due to an // We must mark a variable whose initialization fails due to an
// abort statement as StorageDead. // abort statement as StorageDead.
// EMIT_MIR issue_49232.main.mir_map.0.mir // EMIT_MIR issue_49232.main.built.after.mir
fn main() { fn main() {
loop { loop {
let beacon = { let beacon = {

View File

@ -1,4 +1,4 @@
// MIR for `main` 0 mir_map // MIR for `main` after built
| User Type Annotations | User Type Annotations
| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option<u8>) }, span: $DIR/issue-101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8> | 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option<u8>) }, span: $DIR/issue-101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>

View File

@ -1,4 +1,4 @@
// MIR for `main` 0 mir_map // MIR for `main` after built
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-49232.rs:+0:11: +0:11 let mut _0: (); // return place in scope 0 at $DIR/issue-49232.rs:+0:11: +0:11

View File

@ -1,4 +1,4 @@
// MIR for `full_tested_match` after PromoteTemps // MIR for `full_tested_match` after built
fn full_tested_match() -> () { fn full_tested_match() -> () {
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:28: +0:28 let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:28: +0:28
@ -12,7 +12,6 @@ fn full_tested_match() -> () {
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:35: +2:36 let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:35: +2:36
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15 let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:24: +3:25 let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:24: +3:25
let mut _11: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
scope 1 { scope 1 {
} }
scope 2 { scope 2 {
@ -34,7 +33,7 @@ fn full_tested_match() -> () {
bb1: { bb1: {
_1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23 _1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23
} }
bb2: { bb2: {
@ -42,7 +41,7 @@ fn full_tested_match() -> () {
} }
bb3: { bb3: {
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:16 falseEdge -> [real: bb10, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:16
} }
bb4: { bb4: {
@ -51,14 +50,10 @@ fn full_tested_match() -> () {
bb5: { bb5: {
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15 StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
_11 = const _; // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15 _6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
// mir::Constant
// + span: $DIR/match_false_edges.rs:14:14: 14:15
// + literal: Const { ty: &Option<i32>, val: Unevaluated(full_tested_match, [], Some(promoted[0])) }
_6 = &(((*_11) as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
_4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
_7 = guard() -> [return: bb6, unwind: bb11]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 _7 = guard() -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
// mir::Constant // mir::Constant
// + span: $DIR/match_false_edges.rs:14:20: 14:25 // + span: $DIR/match_false_edges.rs:14:20: 14:25
// + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
@ -80,16 +75,20 @@ fn full_tested_match() -> () {
StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37
StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
} }
bb8: { bb8: {
goto -> bb9; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
}
bb9: {
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27 StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
goto -> bb3; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 goto -> bb3; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
} }
bb9: { bb10: {
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15 StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
_9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15 _9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:+3:24: +3:25 StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:+3:24: +3:25
@ -97,17 +96,17 @@ fn full_tested_match() -> () {
_1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+3:20: +3:26 _1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+3:20: +3:26
StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+3:25: +3:26 StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+3:25: +3:26
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26 StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26
} }
bb10: { bb11: {
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:28: +6:2 _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:28: +6:2
return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2 return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2
} }
bb11 (cleanup): { bb12 (cleanup): {
resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2 resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2
} }
} }

View File

@ -1,4 +1,4 @@
// MIR for `full_tested_match2` before PromoteTemps // MIR for `full_tested_match2` after built
fn full_tested_match2() -> () { fn full_tested_match2() -> () {
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:29: +0:29 let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:29: +0:29
@ -32,7 +32,7 @@ fn full_tested_match2() -> () {
} }
bb1: { bb1: {
falseEdge -> [real: bb9, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:13 falseEdge -> [real: bb10, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:13
} }
bb2: { bb2: {
@ -47,7 +47,7 @@ fn full_tested_match2() -> () {
_1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+4:20: +4:26 _1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+4:20: +4:26
StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+4:25: +4:26 StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+4:25: +4:26
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26 StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26
} }
bb4: { bb4: {
@ -59,7 +59,7 @@ fn full_tested_match2() -> () {
_6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15 _6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
_4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
_7 = guard() -> [return: bb6, unwind: bb11]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 _7 = guard() -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
// mir::Constant // mir::Constant
// + span: $DIR/match_false_edges.rs:25:20: 25:25 // + span: $DIR/match_false_edges.rs:25:20: 25:25
// + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
@ -81,28 +81,32 @@ fn full_tested_match2() -> () {
StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37
StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
} }
bb8: { bb8: {
goto -> bb9; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
}
bb9: {
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27 StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
} }
bb9: { bb10: {
_1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23 _1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23
} }
bb10: { bb11: {
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7 StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:29: +6:2 _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:29: +6:2
return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2 return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2
} }
bb11 (cleanup): { bb12 (cleanup): {
resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2 resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2
} }
} }

View File

@ -1,4 +1,4 @@
// MIR for `main` before PromoteTemps // MIR for `main` after built
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:11: +0:11 let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:11: +0:11
@ -43,41 +43,54 @@ fn main() -> () {
} }
bb1: { bb1: {
falseEdge -> [real: bb9, imaginary: bb4]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11 falseEdge -> [real: bb13, imaginary: bb6]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
} }
bb2: { bb2: {
falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:17 falseEdge -> [real: bb8, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:17
} }
bb3: { bb3: {
goto -> bb1; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
}
bb4: {
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
switchInt(move _3) -> [1_isize: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
}
bb5: {
StorageLive(_14); // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11 StorageLive(_14); // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
_14 = _2; // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11 _14 = _2; // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
_1 = const 4_i32; // scope 5 at $DIR/match_false_edges.rs:+5:15: +5:16 _1 = const 4_i32; // scope 5 at $DIR/match_false_edges.rs:+5:15: +5:16
StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16 StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16 goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16
} }
bb4: { bb6: {
falseEdge -> [real: bb10, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+4:9: +4:16 falseEdge -> [real: bb14, imaginary: bb5]; // scope 0 at $DIR/match_false_edges.rs:+4:9: +4:16
} }
bb5: { bb7: {
goto -> bb5; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
}
bb8: {
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16 StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
_7 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16 _7 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
_5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26 _5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
StorageLive(_8); // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28 StorageLive(_8); // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
_8 = guard() -> [return: bb6, unwind: bb15]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28 _8 = guard() -> [return: bb9, unwind: bb20]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
// mir::Constant // mir::Constant
// + span: $DIR/match_false_edges.rs:34:21: 34:26 // + span: $DIR/match_false_edges.rs:34:21: 34:26
// + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) } // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
} }
bb6: { bb9: {
switchInt(move _8) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28 switchInt(move _8) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
} }
bb7: { bb10: {
StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28 StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28 FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28 FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
@ -86,41 +99,45 @@ fn main() -> () {
_1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:+2:32: +2:33 _1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:+2:32: +2:33
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33 StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33 goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
} }
bb8: { bb11: {
goto -> bb12; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
}
bb12: {
StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28 StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33 StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
falseEdge -> [real: bb1, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28 falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
} }
bb9: { bb13: {
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11 StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
_9 = _2; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11 _9 = _2; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
_1 = const 2_i32; // scope 3 at $DIR/match_false_edges.rs:+3:15: +3:16 _1 = const 2_i32; // scope 3 at $DIR/match_false_edges.rs:+3:15: +3:16
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16 StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16 goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16
} }
bb10: { bb14: {
StorageLive(_11); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15 StorageLive(_11); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
_11 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15 _11 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
_5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26 _5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
StorageLive(_12); // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29 StorageLive(_12); // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
StorageLive(_13); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28 StorageLive(_13); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
_13 = (*_11); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28 _13 = (*_11); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
_12 = guard2(move _13) -> [return: bb11, unwind: bb15]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29 _12 = guard2(move _13) -> [return: bb15, unwind: bb20]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
// mir::Constant // mir::Constant
// + span: $DIR/match_false_edges.rs:36:20: 36:26 // + span: $DIR/match_false_edges.rs:36:20: 36:26
// + literal: Const { ty: fn(i32) -> bool {guard2}, val: Value(<ZST>) } // + literal: Const { ty: fn(i32) -> bool {guard2}, val: Value(<ZST>) }
} }
bb11: { bb15: {
switchInt(move _12) -> [false: bb13, otherwise: bb12]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29 switchInt(move _12) -> [false: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
} }
bb12: { bb16: {
StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29 StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29 StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29 FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
@ -130,24 +147,28 @@ fn main() -> () {
_1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:+4:33: +4:34 _1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:+4:33: +4:34
StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34 StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34 StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34 goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
} }
bb13: { bb17: {
goto -> bb18; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
}
bb18: {
StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29 StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29 StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34 StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
falseEdge -> [real: bb3, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29 falseEdge -> [real: bb7, imaginary: bb5]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
} }
bb14: { bb19: {
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7 StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7 StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:11: +7:2 _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:11: +7:2
return; // scope 0 at $DIR/match_false_edges.rs:+7:2: +7:2 return; // scope 0 at $DIR/match_false_edges.rs:+7:2: +7:2
} }
bb15 (cleanup): { bb20 (cleanup): {
resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +7:2 resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +7:2
} }
} }

View File

@ -8,7 +8,7 @@ fn guard2(_: i32) -> bool {
// no_mangle to make sure this gets instantiated even in an executable. // no_mangle to make sure this gets instantiated even in an executable.
#[no_mangle] #[no_mangle]
// EMIT_MIR match_false_edges.full_tested_match.PromoteTemps.after.mir // EMIT_MIR match_false_edges.full_tested_match.built.after.mir
pub fn full_tested_match() { pub fn full_tested_match() {
let _ = match Some(42) { let _ = match Some(42) {
Some(x) if guard() => (1, x), Some(x) if guard() => (1, x),
@ -19,7 +19,7 @@ pub fn full_tested_match() {
// no_mangle to make sure this gets instantiated even in an executable. // no_mangle to make sure this gets instantiated even in an executable.
#[no_mangle] #[no_mangle]
// EMIT_MIR match_false_edges.full_tested_match2.PromoteTemps.before.mir // EMIT_MIR match_false_edges.full_tested_match2.built.after.mir
pub fn full_tested_match2() { pub fn full_tested_match2() {
let _ = match Some(42) { let _ = match Some(42) {
Some(x) if guard() => (1, x), Some(x) if guard() => (1, x),
@ -28,7 +28,7 @@ pub fn full_tested_match2() {
}; };
} }
// EMIT_MIR match_false_edges.main.PromoteTemps.before.mir // EMIT_MIR match_false_edges.main.built.after.mir
fn main() { fn main() {
let _ = match Some(1) { let _ = match Some(1) {
Some(_w) if guard() => 1, Some(_w) if guard() => 1,

View File

@ -1,4 +1,4 @@
// EMIT_MIR receiver_ptr_mutability.main.mir_map.0.mir // EMIT_MIR receiver_ptr_mutability.main.built.after.mir
#![feature(arbitrary_self_types)] #![feature(arbitrary_self_types)]

View File

@ -1,4 +1,4 @@
// MIR for `main` 0 mir_map // MIR for `main` after built
| User Type Annotations | User Type Annotations
| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut Test) }, span: $DIR/receiver-ptr-mutability.rs:14:14: 14:23, inferred_ty: *mut Test | 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut Test) }, span: $DIR/receiver-ptr-mutability.rs:14:14: 14:23, inferred_ty: *mut Test

View File

@ -1,7 +1,7 @@
// Test that we don't generate unnecessarily large MIR for very simple matches // Test that we don't generate unnecessarily large MIR for very simple matches
// EMIT_MIR simple_match.match_bool.mir_map.0.mir // EMIT_MIR simple_match.match_bool.built.after.mir
fn match_bool(x: bool) -> usize { fn match_bool(x: bool) -> usize {
match x { match x {
true => 10, true => 10,

View File

@ -1,4 +1,4 @@
// MIR for `match_bool` 0 mir_map // MIR for `match_bool` after built
fn match_bool(_1: bool) -> usize { fn match_bool(_1: bool) -> usize {
debug x => _1; // in scope 0 at $DIR/simple-match.rs:+0:15: +0:16 debug x => _1; // in scope 0 at $DIR/simple-match.rs:+0:15: +0:16

View File

@ -1,4 +1,4 @@
// MIR for `XXX` 0 mir_map // MIR for `XXX` after built
static XXX: &Foo = { static XXX: &Foo = {
let mut _0: &Foo; // return place in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:13: +0:25 let mut _0: &Foo; // return place in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:13: +0:25

View File

@ -1,7 +1,7 @@
// Check that when we compile the static `XXX` into MIR, we do not // Check that when we compile the static `XXX` into MIR, we do not
// generate `StorageStart` or `StorageEnd` statements. // generate `StorageStart` or `StorageEnd` statements.
// EMIT_MIR storage_live_dead_in_statics.XXX.mir_map.0.mir // EMIT_MIR storage_live_dead_in_statics.XXX.built.after.mir
static XXX: &'static Foo = &Foo { static XXX: &'static Foo = &Foo {
tup: "hi", tup: "hi",
data: &[ data: &[

View File

@ -1,4 +1,4 @@
// MIR for `move_out_by_subslice` 0 mir_map // MIR for `move_out_by_subslice` after built
fn move_out_by_subslice() -> () { fn move_out_by_subslice() -> () {
let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +0:27 let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +0:27

View File

@ -1,4 +1,4 @@
// MIR for `move_out_from_end` 0 mir_map // MIR for `move_out_from_end` after built
fn move_out_from_end() -> () { fn move_out_from_end() -> () {
let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +0:24 let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +0:24

View File

@ -1,12 +1,12 @@
#![feature(box_syntax)] #![feature(box_syntax)]
// EMIT_MIR uniform_array_move_out.move_out_from_end.mir_map.0.mir // EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir
fn move_out_from_end() { fn move_out_from_end() {
let a = [box 1, box 2]; let a = [box 1, box 2];
let [.., _y] = a; let [.., _y] = a;
} }
// EMIT_MIR uniform_array_move_out.move_out_by_subslice.mir_map.0.mir // EMIT_MIR uniform_array_move_out.move_out_by_subslice.built.after.mir
fn move_out_by_subslice() { fn move_out_by_subslice() {
let a = [box 1, box 2]; let a = [box 1, box 2];
let [_y @ ..] = a; let [_y @ ..] = a;

View File

@ -12,7 +12,7 @@ static mut BAR: *const &i32 = [&Y].as_ptr();
// EMIT_MIR const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir // EMIT_MIR const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir
static mut FOO: *const &i32 = [unsafe { &X }].as_ptr(); static mut FOO: *const &i32 = [unsafe { &X }].as_ptr();
// EMIT_MIR const_promotion_extern_static.BOP.mir_map.0.mir // EMIT_MIR const_promotion_extern_static.BOP.built.after.mir
static BOP: &i32 = &13; static BOP: &i32 = &13;
fn main() {} fn main() {}

View File

@ -1,4 +1,4 @@
// MIR for `BOP` 0 mir_map // MIR for `BOP` after built
static BOP: &i32 = { static BOP: &i32 = {
let mut _0: &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:+0:13: +0:17 let mut _0: &i32; // return place in scope 0 at $DIR/const-promotion-extern-static.rs:+0:13: +0:17

View File

@ -1,5 +1,5 @@
// Test graphviz output // Test graphviz output
// compile-flags: -Z dump-mir-graphviz // compile-flags: -Z dump-mir-graphviz
// EMIT_MIR graphviz.main.mir_map.0.dot // EMIT_MIR graphviz.main.built.after.dot
fn main() {} fn main() {}

View File

@ -6,12 +6,12 @@
enum Void {} enum Void {}
// EMIT_MIR issue_72181_1.f.mir_map.0.mir // EMIT_MIR issue_72181_1.f.built.after.mir
fn f(v: Void) -> ! { fn f(v: Void) -> ! {
match v {} match v {}
} }
// EMIT_MIR issue_72181_1.main.mir_map.0.mir // EMIT_MIR issue_72181_1.main.built.after.mir
fn main() { fn main() {
let v: Void = unsafe { let v: Void = unsafe {
std::mem::transmute::<(), Void>(()) std::mem::transmute::<(), Void>(())

View File

@ -12,14 +12,14 @@ union Foo {
} }
// EMIT_MIR issue_72181.foo.mir_map.0.mir // EMIT_MIR issue_72181.foo.built.after.mir
fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 }
// EMIT_MIR issue_72181.bar.mir_map.0.mir // EMIT_MIR issue_72181.bar.built.after.mir
fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x }
// EMIT_MIR issue_72181.main.mir_map.0.mir // EMIT_MIR issue_72181.main.built.after.mir
fn main() { fn main() {
let _ = mem::size_of::<Foo>(); let _ = mem::size_of::<Foo>();

View File

@ -1,5 +1,5 @@
// compile-flags: -Z mir-opt-level=0 // compile-flags: -Z mir-opt-level=0
// EMIT_MIR issue_91633.hey.mir_map.0.mir // EMIT_MIR issue_91633.hey.built.after.mir
fn hey<T> (it: &[T]) fn hey<T> (it: &[T])
where where
[T] : std::ops::Index<usize>, [T] : std::ops::Index<usize>,
@ -7,7 +7,7 @@ fn hey<T> (it: &[T])
let _ = &it[0]; let _ = &it[0];
} }
// EMIT_MIR issue_91633.bar.mir_map.0.mir // EMIT_MIR issue_91633.bar.built.after.mir
fn bar<T> (it: Box<[T]>) fn bar<T> (it: Box<[T]>)
where where
[T] : std::ops::Index<usize>, [T] : std::ops::Index<usize>,
@ -15,14 +15,14 @@ fn bar<T> (it: Box<[T]>)
let _ = it[0]; let _ = it[0];
} }
// EMIT_MIR issue_91633.fun.mir_map.0.mir // EMIT_MIR issue_91633.fun.built.after.mir
fn fun<T> (it: &[T]) -> &T fn fun<T> (it: &[T]) -> &T
{ {
let f = &it[0]; let f = &it[0];
f f
} }
// EMIT_MIR issue_91633.foo.mir_map.0.mir // EMIT_MIR issue_91633.foo.built.after.mir
fn foo<T: Clone> (it: Box<[T]>) -> T fn foo<T: Clone> (it: Box<[T]>) -> T
{ {
let f = it[0].clone(); let f = it[0].clone();

View File

@ -5,7 +5,7 @@ pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] {
BYTES BYTES
} }
// EMIT_MIR issue_99325.main.mir_map.0.mir // EMIT_MIR issue_99325.main.built.after.mir
pub fn main() { pub fn main() {
assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]); assert_eq!(function_with_bytes::<b"AAAA">(), &[0x41, 0x41, 0x41, 0x41]);
assert_eq!(function_with_bytes::<{ &[0x41, 0x41, 0x41, 0x41] }>(), b"AAAA"); assert_eq!(function_with_bytes::<{ &[0x41, 0x41, 0x41, 0x41] }>(), b"AAAA");

View File

@ -1,4 +1,4 @@
// MIR for `bar` 0 mir_map // MIR for `bar` after built
fn bar(_1: [(Never, u32); 1]) -> u32 { fn bar(_1: [(Never, u32); 1]) -> u32 {
let mut _0: u32; // return place in scope 0 at $DIR/issue-72181.rs:+0:40: +0:43 let mut _0: u32; // return place in scope 0 at $DIR/issue-72181.rs:+0:40: +0:43

View File

@ -1,4 +1,4 @@
// MIR for `foo` 0 mir_map // MIR for `foo` after built
fn foo(_1: [(Never, u32); 1]) -> u32 { fn foo(_1: [(Never, u32); 1]) -> u32 {
debug xs => _1; // in scope 0 at $DIR/issue-72181.rs:+0:8: +0:10 debug xs => _1; // in scope 0 at $DIR/issue-72181.rs:+0:8: +0:10

View File

@ -1,4 +1,4 @@
// MIR for `main` 0 mir_map // MIR for `main` after built
fn main() -> () { fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue-72181.rs:+0:11: +0:11 let mut _0: (); // return place in scope 0 at $DIR/issue-72181.rs:+0:11: +0:11

View File

@ -1,4 +1,4 @@
// MIR for `f` 0 mir_map // MIR for `f` after built
fn f(_1: Void) -> ! { fn f(_1: Void) -> ! {
debug v => _1; // in scope 0 at $DIR/issue-72181-1.rs:+0:6: +0:7 debug v => _1; // in scope 0 at $DIR/issue-72181-1.rs:+0:6: +0:7

View File

@ -1,4 +1,4 @@
// MIR for `main` 0 mir_map // MIR for `main` after built
| User Type Annotations | User Type Annotations
| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(Void) }, span: $DIR/issue-72181-1.rs:16:12: 16:16, inferred_ty: Void | 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(Void) }, span: $DIR/issue-72181-1.rs:16:12: 16:16, inferred_ty: Void

View File

@ -1,4 +1,4 @@
// MIR for `bar` 0 mir_map // MIR for `bar` after built
fn bar(_1: Box<[T]>) -> () { fn bar(_1: Box<[T]>) -> () {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14 debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14

View File

@ -1,4 +1,4 @@
// MIR for `foo` 0 mir_map // MIR for `foo` after built
fn foo(_1: Box<[T]>) -> T { fn foo(_1: Box<[T]>) -> T {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:19: +0:21 debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:19: +0:21

View File

@ -1,4 +1,4 @@
// MIR for `fun` 0 mir_map // MIR for `fun` after built
fn fun(_1: &[T]) -> &T { fn fun(_1: &[T]) -> &T {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14 debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14

View File

@ -1,4 +1,4 @@
// MIR for `hey` 0 mir_map // MIR for `hey` after built
fn hey(_1: &[T]) -> () { fn hey(_1: &[T]) -> () {
debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14 debug it => _1; // in scope 0 at $DIR/issue-91633.rs:+0:12: +0:14

View File

@ -1,4 +1,4 @@
// MIR for `main` 0 mir_map // MIR for `main` after built
| User Type Annotations | User Type Annotations
| 0: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }) }, span: $DIR/issue-99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | 0: user_ty: Canonical { max_universe: U0, variables: [], value: TypeOf(DefId(0:3 ~ issue_99325[8f58]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }) }, span: $DIR/issue-99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}

View File

@ -1,5 +1,5 @@
// Test spanview block output // Test spanview block output
// compile-flags: -Z dump-mir-spanview=block // compile-flags: -Z dump-mir-spanview=block
// EMIT_MIR spanview_block.main.mir_map.0.html // EMIT_MIR spanview_block.main.built.after.html
fn main() {} fn main() {}

View File

@ -1,5 +1,5 @@
// Test spanview output (the default value for `-Z dump-mir-spanview` is "statement") // Test spanview output (the default value for `-Z dump-mir-spanview` is "statement")
// compile-flags: -Z dump-mir-spanview // compile-flags: -Z dump-mir-spanview
// EMIT_MIR spanview_statement.main.mir_map.0.html // EMIT_MIR spanview_statement.main.built.after.html
fn main() {} fn main() {}

View File

@ -1,5 +1,5 @@
// Test spanview terminator output // Test spanview terminator output
// compile-flags: -Z dump-mir-spanview=terminator // compile-flags: -Z dump-mir-spanview=terminator
// EMIT_MIR spanview_terminator.main.mir_map.0.html // EMIT_MIR spanview_terminator.main.built.after.html
fn main() {} fn main() {}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>spanview_block.main.mir_map.0</title> <title>spanview_block.main.built.after</title>
<style> <style>
.line { .line {
counter-increment: line; counter-increment: line;

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>spanview_statement.main.mir_map.0</title> <title>spanview_statement.main.built.after</title>
<style> <style>
.line { .line {
counter-increment: line; counter-increment: line;

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>spanview_terminator.main.mir_map.0</title> <title>spanview_terminator.main.built.after</title>
<style> <style>
.line { .line {
counter-increment: line; counter-increment: line;

View File

@ -5,19 +5,19 @@
struct A; struct A;
// EMIT_MIR unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.mir // EMIT_MIR unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.built.after.mir
impl A { impl A {
const ASSOCIATED_CONSTANT: i32 = 2; const ASSOCIATED_CONSTANT: i32 = 2;
} }
// See #59021 // See #59021
// EMIT_MIR unusual_item_types.Test-X-{constructor#0}.mir_map.0.mir // EMIT_MIR unusual_item_types.Test-X-{constructor#0}.built.after.mir
enum Test { enum Test {
X(usize), X(usize),
Y { a: usize }, Y { a: usize },
} }
// EMIT_MIR unusual_item_types.E-V-{constant#0}.mir_map.0.mir // EMIT_MIR unusual_item_types.E-V-{constant#0}.built.after.mir
enum E { enum E {
V = 5, V = 5,
} }

View File

@ -1,4 +1,4 @@
// MIR for `E::V::{constant#0}` 0 mir_map // MIR for `E::V::{constant#0}` after built
E::V::{constant#0}: isize = { E::V::{constant#0}: isize = {
let mut _0: isize; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:9: +0:10 let mut _0: isize; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:9: +0:10

View File

@ -1,4 +1,4 @@
// MIR for `Test::X` 0 mir_map // MIR for `Test::X` after built
fn Test::X(_1: usize) -> Test { fn Test::X(_1: usize) -> Test {
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6 let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6

View File

@ -1,4 +1,4 @@
// MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT` 0 mir_map // MIR for `<impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT` after built
const <impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT: i32 = { const <impl at $DIR/unusual-item-types.rs:9:1: 9:7>::ASSOCIATED_CONSTANT: i32 = {
let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:32: +0:35 let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:32: +0:35

View File

@ -0,0 +1,17 @@
// exact-check
const QUERY = ['Subscriber', 'AnotherOne'];
const EXPECTED = [
{
'others': [
{ 'path': 'reexport::fmt', 'name': 'Subscriber' },
{ 'path': 'reexport', 'name': 'FmtSubscriber' },
],
},
{
'others': [
{ 'path': 'reexport', 'name': 'AnotherOne' },
],
},
];

View File

@ -0,0 +1,11 @@
// This test enforces that the (renamed) reexports are present in the search results.
pub mod fmt {
pub struct Subscriber;
}
mod foo {
pub struct AnotherOne;
}
pub use foo::AnotherOne;
pub use fmt::Subscriber as FmtSubscriber;

View File

@ -0,0 +1,7 @@
#![feature(rustc_attrs)]
#[rustc_has_incoherent_inherent_impls]
pub trait FooTrait {}
#[rustc_has_incoherent_inherent_impls]
pub struct FooStruct;

View File

@ -0,0 +1,28 @@
// aux-build:incoherent-impl-types.rs
// build-aux-docs
#![crate_name = "foo"]
#![feature(rustc_attrs)]
extern crate incoherent_impl_types;
// The only way this actually shows up is if the type gets inlined.
#[doc(inline)]
pub use incoherent_impl_types::FooTrait;
// @has foo/trait.FooTrait.html
// @count - '//section[@id="method.do_something"]' 1
impl dyn FooTrait {
#[rustc_allow_incoherent_impl]
pub fn do_something() {}
}
#[doc(inline)]
pub use incoherent_impl_types::FooStruct;
// @has foo/struct.FooStruct.html
// @count - '//section[@id="method.do_something"]' 1
impl FooStruct {
#[rustc_allow_incoherent_impl]
pub fn do_something() {}
}

View File

@ -0,0 +1,19 @@
#![feature(abi_efiapi)]
fn efiapi(f: extern "efiapi" fn(usize, ...)) {
//~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
//~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
f(22, 44);
}
fn sysv(f: extern "sysv64" fn(usize, ...)) {
//~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
//~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
f(22, 44);
}
fn win(f: extern "win64" fn(usize, ...)) {
//~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
//~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
f(22, 44);
}
fn main() {}

View File

@ -0,0 +1,49 @@
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
--> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
|
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
|
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
--> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
|
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
|
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
--> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
|
LL | fn win(f: extern "win64" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
|
LL | fn win(f: extern "win64" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0045, E0658.
For more information about an error, try `rustc --explain E0045`.

View File

@ -6,7 +6,9 @@
trait Sized { } trait Sized { }
extern "stdcall" { extern "stdcall" {
fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling fn printf(_: *const u8, ...);
//~^ ERROR: C-variadic function must have a compatible calling convention,
// like C, cdecl, win64, sysv64 or efiapi
} }
extern "C" { extern "C" {

View File

@ -1,17 +1,17 @@
error[E0045]: C-variadic function must have C or cdecl calling convention error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/variadic-ffi-1.rs:9:5 --> $DIR/variadic-ffi-1.rs:9:5
| |
LL | fn printf(_: *const u8, ...); LL | fn printf(_: *const u8, ...);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied
--> $DIR/variadic-ffi-1.rs:20:9 --> $DIR/variadic-ffi-1.rs:22:9
| |
LL | foo(); LL | foo();
| ^^^-- two arguments of type `isize` and `u8` are missing | ^^^-- two arguments of type `isize` and `u8` are missing
| |
note: function defined here note: function defined here
--> $DIR/variadic-ffi-1.rs:13:8 --> $DIR/variadic-ffi-1.rs:15:8
| |
LL | fn foo(f: isize, x: u8, ...); LL | fn foo(f: isize, x: u8, ...);
| ^^^ | ^^^
@ -21,13 +21,13 @@ LL | foo(/* isize */, /* u8 */);
| ~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~
error[E0060]: this function takes at least 2 arguments but 1 argument was supplied error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
--> $DIR/variadic-ffi-1.rs:21:9 --> $DIR/variadic-ffi-1.rs:23:9
| |
LL | foo(1); LL | foo(1);
| ^^^--- an argument of type `u8` is missing | ^^^--- an argument of type `u8` is missing
| |
note: function defined here note: function defined here
--> $DIR/variadic-ffi-1.rs:13:8 --> $DIR/variadic-ffi-1.rs:15:8
| |
LL | fn foo(f: isize, x: u8, ...); LL | fn foo(f: isize, x: u8, ...);
| ^^^ | ^^^
@ -37,7 +37,7 @@ LL | foo(1, /* u8 */);
| ~~~~~~~~~~~~~ | ~~~~~~~~~~~~~
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/variadic-ffi-1.rs:23:56 --> $DIR/variadic-ffi-1.rs:25:56
| |
LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
| ------------------------------------- ^^^ expected non-variadic fn, found variadic function | ------------------------------------- ^^^ expected non-variadic fn, found variadic function
@ -48,7 +48,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
found fn item `unsafe extern "C" fn(_, _, ...) {foo}` found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/variadic-ffi-1.rs:24:54 --> $DIR/variadic-ffi-1.rs:26:54
| |
LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
| ----------------------------------- ^^^ expected variadic fn, found non-variadic function | ----------------------------------- ^^^ expected variadic fn, found non-variadic function
@ -59,37 +59,37 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
found fn item `extern "C" fn(_, _) {bar}` found fn item `extern "C" fn(_, _) {bar}`
error[E0617]: can't pass `f32` to variadic function error[E0617]: can't pass `f32` to variadic function
--> $DIR/variadic-ffi-1.rs:26:19 --> $DIR/variadic-ffi-1.rs:28:19
| |
LL | foo(1, 2, 3f32); LL | foo(1, 2, 3f32);
| ^^^^ help: cast the value to `c_double`: `3f32 as c_double` | ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
error[E0617]: can't pass `bool` to variadic function error[E0617]: can't pass `bool` to variadic function
--> $DIR/variadic-ffi-1.rs:27:19 --> $DIR/variadic-ffi-1.rs:29:19
| |
LL | foo(1, 2, true); LL | foo(1, 2, true);
| ^^^^ help: cast the value to `c_int`: `true as c_int` | ^^^^ help: cast the value to `c_int`: `true as c_int`
error[E0617]: can't pass `i8` to variadic function error[E0617]: can't pass `i8` to variadic function
--> $DIR/variadic-ffi-1.rs:28:19 --> $DIR/variadic-ffi-1.rs:30:19
| |
LL | foo(1, 2, 1i8); LL | foo(1, 2, 1i8);
| ^^^ help: cast the value to `c_int`: `1i8 as c_int` | ^^^ help: cast the value to `c_int`: `1i8 as c_int`
error[E0617]: can't pass `u8` to variadic function error[E0617]: can't pass `u8` to variadic function
--> $DIR/variadic-ffi-1.rs:29:19 --> $DIR/variadic-ffi-1.rs:31:19
| |
LL | foo(1, 2, 1u8); LL | foo(1, 2, 1u8);
| ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
error[E0617]: can't pass `i16` to variadic function error[E0617]: can't pass `i16` to variadic function
--> $DIR/variadic-ffi-1.rs:30:19 --> $DIR/variadic-ffi-1.rs:32:19
| |
LL | foo(1, 2, 1i16); LL | foo(1, 2, 1i16);
| ^^^^ help: cast the value to `c_int`: `1i16 as c_int` | ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
error[E0617]: can't pass `u16` to variadic function error[E0617]: can't pass `u16` to variadic function
--> $DIR/variadic-ffi-1.rs:31:19 --> $DIR/variadic-ffi-1.rs:33:19
| |
LL | foo(1, 2, 1u16); LL | foo(1, 2, 1u16);
| ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`

View File

@ -1,7 +1,20 @@
// ignore-arm stdcall isn't supported // ignore-arm stdcall isn't supported
#![feature(extended_varargs_abi_support)]
#![feature(abi_efiapi)]
fn baz(f: extern "stdcall" fn(usize, ...)) { fn baz(f: extern "stdcall" fn(usize, ...)) {
//~^ ERROR: variadic function must have C or cdecl calling convention //~^ ERROR: C-variadic function must have a compatible calling convention,
// like C, cdecl, win64, sysv64 or efiapi
f(22, 44);
}
fn sysv(f: extern "sysv64" fn(usize, ...)) {
f(22, 44);
}
fn win(f: extern "win64" fn(usize, ...)) {
f(22, 44);
}
fn efiapi(f: extern "efiapi" fn(usize, ...)) {
f(22, 44); f(22, 44);
} }

View File

@ -1,8 +1,8 @@
error[E0045]: C-variadic function must have C or cdecl calling convention error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `win64`, `sysv64` or `efiapi`
--> $DIR/variadic-ffi-2.rs:3:11 --> $DIR/variadic-ffi-2.rs:5:11
| |
LL | fn baz(f: extern "stdcall" fn(usize, ...)) { LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0045]: C-variadic function must have C or cdecl calling convention error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
--> $DIR/E0045.rs:1:17 --> $DIR/E0045.rs:1:17
| |
LL | extern "Rust" { fn foo(x: u8, ...); } LL | extern "Rust" { fn foo(x: u8, ...); }
| ^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention | ^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,13 +1,19 @@
// Check to insure that the output of `std::any::type_name` does not change based on -Zverbose // Check to insure that the output of `std::any::type_name` does not change based on `-Zverbose`
// when printing constants
// run-pass // run-pass
// edition: 2018 // edition: 2018
// revisions: normal verbose // revisions: normal verbose
// [verbose]compile-flags:-Zverbose // [verbose]compile-flags:-Zverbose
struct Wrapper<const VALUE: usize>; use std::any::type_name;
fn main() { fn main() {
assert_eq!(std::any::type_name::<[u32; 0]>(), "[u32; 0]"); assert_eq!(type_name::<[u32; 0]>(), "[u32; 0]");
assert_eq!(std::any::type_name::<Wrapper<0>>(), "issue_94187_verbose_type_name::Wrapper<0>");
struct Wrapper<const VALUE: usize>;
assert_eq!(type_name::<Wrapper<0>>(), "issue_94187_verbose_type_name::main::Wrapper<0>");
assert_eq!(
type_name::<dyn Fn(u32) -> u32>(),
"dyn core::ops::function::Fn<(u32,)>+Output = u32"
);
} }