Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obk
Enable MIR inlining Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.` #82280 has shown nice compile time wins could be obtained by enabling MIR inlining. Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed, except the interaction with polymorphization which is worked around specifically. I believe we can proceed with enabling MIR inlining in the near future (preferably just after beta branching, in case we discover new issues). Steps before merging: - [x] figure out the interaction with polymorphization; - [x] figure out how miri should deal with extern types; - [x] silence the extra arithmetic overflow warnings; - [x] remove the codegen fulfilment ICE; - [x] remove the type normalization ICEs while compiling nalgebra; - [ ] tweak the inlining threshold.
This commit is contained in:
commit
0075bb4fad
36 changed files with 252 additions and 170 deletions
|
@ -686,6 +686,7 @@ fn codegen_stmt<'tcx>(
|
|||
substs,
|
||||
ty::ClosureKind::FnOnce,
|
||||
)
|
||||
.expect("failed to normalize and resolve closure during codegen")
|
||||
.polymorphize(fx.tcx);
|
||||
let func_ref = fx.get_function_ref(instance);
|
||||
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
|
||||
|
|
|
@ -213,6 +213,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
substs,
|
||||
ty::ClosureKind::FnOnce,
|
||||
)
|
||||
.expect("failed to normalize and resolve closure during codegen")
|
||||
.polymorphize(bx.cx().tcx());
|
||||
OperandValue::Immediate(bx.cx().get_fn_addr(instance))
|
||||
}
|
||||
|
|
|
@ -100,7 +100,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
def_id,
|
||||
substs,
|
||||
ty::ClosureKind::FnOnce,
|
||||
);
|
||||
)
|
||||
.ok_or_else(|| err_inval!(TooGeneric))?;
|
||||
let fn_ptr = self.create_fn_alloc_ptr(FnVal::Instance(instance));
|
||||
self.write_pointer(fn_ptr, dest)?;
|
||||
}
|
||||
|
|
|
@ -44,22 +44,10 @@ where
|
|||
let is_used = unused_params.contains(index).map_or(true, |unused| !unused);
|
||||
// Only recurse when generic parameters in fns, closures and generators
|
||||
// are used and require substitution.
|
||||
match (is_used, subst.needs_subst()) {
|
||||
// Just in case there are closures or generators within this subst,
|
||||
// recurse.
|
||||
(true, true) => return subst.visit_with(self),
|
||||
// Confirm that polymorphization replaced the parameter with
|
||||
// `ty::Param`/`ty::ConstKind::Param`.
|
||||
(false, true) if cfg!(debug_assertions) => match subst.unpack() {
|
||||
ty::subst::GenericArgKind::Type(ty) => {
|
||||
assert!(matches!(ty.kind(), ty::Param(_)))
|
||||
}
|
||||
ty::subst::GenericArgKind::Const(ct) => {
|
||||
assert!(matches!(ct.kind(), ty::ConstKind::Param(_)))
|
||||
}
|
||||
ty::subst::GenericArgKind::Lifetime(..) => (),
|
||||
},
|
||||
_ => {}
|
||||
if is_used && subst.needs_subst() {
|
||||
return subst.visit_with(self);
|
||||
}
|
||||
}
|
||||
ControlFlow::CONTINUE
|
||||
|
|
|
@ -496,12 +496,12 @@ impl<'tcx> Instance<'tcx> {
|
|||
def_id: DefId,
|
||||
substs: ty::SubstsRef<'tcx>,
|
||||
requested_kind: ty::ClosureKind,
|
||||
) -> Instance<'tcx> {
|
||||
) -> Option<Instance<'tcx>> {
|
||||
let actual_kind = substs.as_closure().kind();
|
||||
|
||||
match needs_fn_once_adapter_shim(actual_kind, requested_kind) {
|
||||
Ok(true) => Instance::fn_once_adapter_instance(tcx, def_id, substs),
|
||||
_ => Instance::new(def_id, substs),
|
||||
_ => Some(Instance::new(def_id, substs)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ impl<'tcx> Instance<'tcx> {
|
|||
tcx: TyCtxt<'tcx>,
|
||||
closure_did: DefId,
|
||||
substs: ty::SubstsRef<'tcx>,
|
||||
) -> Instance<'tcx> {
|
||||
) -> Option<Instance<'tcx>> {
|
||||
debug!("fn_once_adapter_shim({:?}, {:?})", closure_did, substs);
|
||||
let fn_once = tcx.require_lang_item(LangItem::FnOnce, None);
|
||||
let call_once = tcx
|
||||
|
@ -531,12 +531,13 @@ impl<'tcx> Instance<'tcx> {
|
|||
let self_ty = tcx.mk_closure(closure_did, substs);
|
||||
|
||||
let sig = substs.as_closure().sig();
|
||||
let sig = tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), sig);
|
||||
let sig =
|
||||
tcx.try_normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), sig).ok()?;
|
||||
assert_eq!(sig.inputs().len(), 1);
|
||||
let substs = tcx.mk_substs_trait(self_ty, &[sig.inputs()[0].into()]);
|
||||
|
||||
debug!("fn_once_adapter_shim: self_ty={:?} sig={:?}", self_ty, sig);
|
||||
Instance { def, substs }
|
||||
Some(Instance { def, substs })
|
||||
}
|
||||
|
||||
/// Depending on the kind of `InstanceDef`, the MIR body associated with an
|
||||
|
|
|
@ -112,6 +112,26 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self.normalize_erasing_regions(param_env, value)
|
||||
}
|
||||
|
||||
/// If you have a `Binder<'tcx, T>`, you can do this to strip out the
|
||||
/// late-bound regions and then normalize the result, yielding up
|
||||
/// a `T` (with regions erased). This is appropriate when the
|
||||
/// binder is being instantiated at the call site.
|
||||
///
|
||||
/// N.B., currently, higher-ranked type bounds inhibit
|
||||
/// normalization. Therefore, each time we erase them in
|
||||
/// codegen, we need to normalize the contents.
|
||||
pub fn try_normalize_erasing_late_bound_regions<T>(
|
||||
self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
value: ty::Binder<'tcx, T>,
|
||||
) -> Result<T, NormalizationError<'tcx>>
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
let value = self.erase_late_bound_regions(value);
|
||||
self.try_normalize_erasing_regions(param_env, value)
|
||||
}
|
||||
|
||||
/// Monomorphizes a type from the AST by first applying the
|
||||
/// in-scope substitutions and then normalizing any associated
|
||||
/// types.
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
//! Inlining pass for MIR functions
|
||||
use crate::deref_separator::deref_finder;
|
||||
use rustc_attr::InlineAttr;
|
||||
use rustc_const_eval::transform::validate::equal_up_to_regions;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
|
||||
use rustc_middle::mir::visit::*;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::subst::Subst;
|
||||
use rustc_middle::ty::{self, ConstKind, Instance, InstanceDef, ParamEnv, Ty, TyCtxt};
|
||||
use rustc_session::config::OptLevel;
|
||||
use rustc_span::{hygiene::ExpnKind, ExpnData, LocalExpnId, Span};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
|
@ -43,7 +44,15 @@ impl<'tcx> MirPass<'tcx> for Inline {
|
|||
return enabled;
|
||||
}
|
||||
|
||||
sess.opts.mir_opt_level() >= 3
|
||||
match sess.mir_opt_level() {
|
||||
0 | 1 => false,
|
||||
2 => {
|
||||
(sess.opts.optimize == OptLevel::Default
|
||||
|| sess.opts.optimize == OptLevel::Aggressive)
|
||||
&& sess.opts.incremental == None
|
||||
}
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -76,13 +85,6 @@ fn inline<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool {
|
|||
}
|
||||
|
||||
let param_env = tcx.param_env_reveal_all_normalized(def_id);
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let param_env = rustc_trait_selection::traits::normalize_param_env_or_error(
|
||||
tcx,
|
||||
def_id.to_def_id(),
|
||||
param_env,
|
||||
ObligationCause::misc(body.span, hir_id),
|
||||
);
|
||||
|
||||
let mut this = Inliner {
|
||||
tcx,
|
||||
|
@ -166,6 +168,45 @@ impl<'tcx> Inliner<'tcx> {
|
|||
return Err("failed to normalize callee body");
|
||||
};
|
||||
|
||||
// Check call signature compatibility.
|
||||
// Normally, this shouldn't be required, but trait normalization failure can create a
|
||||
// validation ICE.
|
||||
let terminator = caller_body[callsite.block].terminator.as_ref().unwrap();
|
||||
let TerminatorKind::Call { args, destination, .. } = &terminator.kind else { bug!() };
|
||||
let destination_ty = destination.ty(&caller_body.local_decls, self.tcx).ty;
|
||||
let output_type = callee_body.return_ty();
|
||||
if !equal_up_to_regions(self.tcx, self.param_env, output_type, destination_ty) {
|
||||
trace!(?output_type, ?destination_ty);
|
||||
return Err("failed to normalize return type");
|
||||
}
|
||||
if callsite.fn_sig.abi() == Abi::RustCall {
|
||||
let mut args = args.into_iter();
|
||||
let _ = args.next(); // Skip `self` argument.
|
||||
let arg_tuple_ty = args.next().unwrap().ty(&caller_body.local_decls, self.tcx);
|
||||
assert!(args.next().is_none());
|
||||
|
||||
let ty::Tuple(arg_tuple_tys) = arg_tuple_ty.kind() else {
|
||||
bug!("Closure arguments are not passed as a tuple");
|
||||
};
|
||||
|
||||
for (arg_ty, input) in arg_tuple_tys.iter().zip(callee_body.args_iter().skip(1)) {
|
||||
let input_type = callee_body.local_decls[input].ty;
|
||||
if !equal_up_to_regions(self.tcx, self.param_env, arg_ty, input_type) {
|
||||
trace!(?arg_ty, ?input_type);
|
||||
return Err("failed to normalize tuple argument type");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (arg, input) in args.iter().zip(callee_body.args_iter()) {
|
||||
let input_type = callee_body.local_decls[input].ty;
|
||||
let arg_ty = arg.ty(&caller_body.local_decls, self.tcx);
|
||||
if !equal_up_to_regions(self.tcx, self.param_env, arg_ty, input_type) {
|
||||
trace!(?arg_ty, ?input_type);
|
||||
return Err("failed to normalize argument type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let old_blocks = caller_body.basic_blocks().next_index();
|
||||
self.inline_call(caller_body, &callsite, callee_body);
|
||||
let new_blocks = old_blocks..caller_body.basic_blocks().next_index();
|
||||
|
@ -263,6 +304,10 @@ impl<'tcx> Inliner<'tcx> {
|
|||
return None;
|
||||
}
|
||||
|
||||
if self.history.contains(&callee) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let fn_sig = self.tcx.bound_fn_sig(def_id).subst(self.tcx, substs);
|
||||
|
||||
return Some(CallSite {
|
||||
|
@ -285,8 +330,14 @@ impl<'tcx> Inliner<'tcx> {
|
|||
callsite: &CallSite<'tcx>,
|
||||
callee_attrs: &CodegenFnAttrs,
|
||||
) -> Result<(), &'static str> {
|
||||
if let InlineAttr::Never = callee_attrs.inline {
|
||||
return Err("never inline hint");
|
||||
match callee_attrs.inline {
|
||||
InlineAttr::Never => return Err("never inline hint"),
|
||||
InlineAttr::Always | InlineAttr::Hint => {}
|
||||
InlineAttr::None => {
|
||||
if self.tcx.sess.mir_opt_level() <= 2 {
|
||||
return Err("at mir-opt-level=2, only #[inline] is inlined");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only inline local functions if they would be eligible for cross-crate
|
||||
|
@ -407,22 +458,9 @@ impl<'tcx> Inliner<'tcx> {
|
|||
}
|
||||
|
||||
TerminatorKind::Call { func: Operand::Constant(ref f), cleanup, .. } => {
|
||||
if let ty::FnDef(def_id, substs) =
|
||||
if let ty::FnDef(def_id, _) =
|
||||
*callsite.callee.subst_mir(self.tcx, &f.literal.ty()).kind()
|
||||
{
|
||||
if let Ok(substs) =
|
||||
self.tcx.try_normalize_erasing_regions(self.param_env, substs)
|
||||
{
|
||||
if let Ok(Some(instance)) =
|
||||
Instance::resolve(self.tcx, self.param_env, def_id, substs)
|
||||
{
|
||||
if callsite.callee.def_id() == instance.def_id() {
|
||||
return Err("self-recursion");
|
||||
} else if self.history.contains(&instance) {
|
||||
return Err("already inlined");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Don't give intrinsics the extra penalty for calls
|
||||
if tcx.is_intrinsic(def_id) {
|
||||
cost += INSTR_COST;
|
||||
|
@ -482,8 +520,7 @@ impl<'tcx> Inliner<'tcx> {
|
|||
if let InlineAttr::Always = callee_attrs.inline {
|
||||
debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost);
|
||||
Ok(())
|
||||
} else {
|
||||
if cost <= threshold {
|
||||
} else if cost <= threshold {
|
||||
debug!("INLINING {:?} [cost={} <= threshold={}]", callsite, cost, threshold);
|
||||
Ok(())
|
||||
} else {
|
||||
|
@ -491,7 +528,6 @@ impl<'tcx> Inliner<'tcx> {
|
|||
Err("cost above threshold")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn inline_call(
|
||||
&self,
|
||||
|
|
|
@ -48,7 +48,7 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
|
|||
trace!(?caller, ?param_env, ?substs, "cannot normalize, skipping");
|
||||
continue;
|
||||
};
|
||||
let Some(callee) = ty::Instance::resolve(tcx, param_env, callee, substs).unwrap() else {
|
||||
let Ok(Some(callee)) = ty::Instance::resolve(tcx, param_env, callee, substs) else {
|
||||
trace!(?callee, "cannot resolve, skipping");
|
||||
continue;
|
||||
};
|
||||
|
|
|
@ -730,7 +730,8 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
|
|||
def_id,
|
||||
substs,
|
||||
ty::ClosureKind::FnOnce,
|
||||
);
|
||||
)
|
||||
.expect("failed to normalize and resolve closure during codegen");
|
||||
if should_codegen_locally(self.tcx, &instance) {
|
||||
self.output.push(create_fn_mono_item(self.tcx, instance, span));
|
||||
}
|
||||
|
|
|
@ -332,12 +332,12 @@ fn resolve_associated_item<'tcx>(
|
|||
}),
|
||||
traits::ImplSource::Closure(closure_data) => {
|
||||
let trait_closure_kind = tcx.fn_trait_kind_from_lang_item(trait_id).unwrap();
|
||||
Some(Instance::resolve_closure(
|
||||
Instance::resolve_closure(
|
||||
tcx,
|
||||
closure_data.closure_def_id,
|
||||
closure_data.substs,
|
||||
trait_closure_kind,
|
||||
))
|
||||
)
|
||||
}
|
||||
traits::ImplSource::FnPointer(ref data) => match data.fn_ty.kind() {
|
||||
ty::FnDef(..) | ty::FnPtr(..) => Some(Instance {
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn is_empty_1(xs: Iter<f32>) -> bool {
|
|||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
|
||||
// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
|
||||
// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.0, %xs.1
|
||||
// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0
|
||||
// CHECK-NEXT: ret i1 [[B:%.*]]
|
||||
{xs}.next().is_none()
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ pub fn is_empty_2(xs: Iter<f32>) -> bool {
|
|||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
|
||||
// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
|
||||
// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.0, %xs.1
|
||||
// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0
|
||||
// CHECK-NEXT: ret i1 [[D:%.*]]
|
||||
xs.map(|&x| x).next().is_none()
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// This test checks that the call to memchr/slice_contains is optimized away
|
||||
// when searching in small slices.
|
||||
|
||||
// compile-flags: -O
|
||||
// compile-flags: -O -Zinline-mir=no
|
||||
// only-x86_64
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// may e.g. multiply `size_of::<T>()` with a variable "count" (which is only
|
||||
// known to be `1` after inlining).
|
||||
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
// compile-flags: -C no-prepopulate-passes -Zinline-mir=no
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
@ -12,14 +12,12 @@ pub fn replace_byte(dst: &mut u8, src: u8) -> u8 {
|
|||
}
|
||||
|
||||
// NOTE(eddyb) the `CHECK-NOT`s ensure that the only calls of `@llvm.memcpy` in
|
||||
// the entire output, are the two direct calls we want, from `ptr::{read,write}`.
|
||||
// the entire output, are the two direct calls we want, from `ptr::replace`.
|
||||
|
||||
// CHECK-NOT: call void @llvm.memcpy
|
||||
// CHECK: ; core::ptr::read
|
||||
// CHECK: ; core::mem::replace
|
||||
// CHECK-NOT: call void @llvm.memcpy
|
||||
// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %src, i{{.*}} 1, i1 false)
|
||||
// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %dest, i{{.*}} 1, i1 false)
|
||||
// CHECK-NOT: call void @llvm.memcpy
|
||||
// CHECK: ; core::ptr::write
|
||||
// CHECK-NOT: call void @llvm.memcpy
|
||||
// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %dst, {{i8\*|ptr}} align 1 %src, i{{.*}} 1, i1 false)
|
||||
// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %dest, {{i8\*|ptr}} align 1 %src{{.*}}, i{{.*}} 1, i1 false)
|
||||
// CHECK-NOT: call void @llvm.memcpy
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ignore-windows
|
||||
//
|
||||
|
||||
// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src
|
||||
// compile-flags: -g -C no-prepopulate-passes --remap-path-prefix={{cwd}}=/the/cwd --remap-path-prefix={{src-base}}=/the/src -Zinline-mir=no
|
||||
// aux-build:remap_path_prefix_aux.rs
|
||||
|
||||
extern crate remap_path_prefix_aux;
|
||||
|
|
|
@ -47,8 +47,9 @@ pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 {
|
|||
#[no_mangle]
|
||||
// CHECK-LABEL: @wider_reduce_into_iter
|
||||
pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 {
|
||||
// CHECK: zext <8 x i8>
|
||||
// CHECK-SAME: to <8 x i16>
|
||||
// CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
|
||||
// FIXME MIR inlining messes up LLVM optimizations.
|
||||
// WOULD-CHECK: zext <8 x i8>
|
||||
// WOULD-CHECK-SAME: to <8 x i16>
|
||||
// WOULD-CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
|
||||
x.to_array().into_iter().map(u16::from).sum()
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -C opt-level=3
|
||||
// compile-flags: -C opt-level=3 -Zmerge-functions=disabled
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
|
@ -11,9 +11,10 @@ type RGB48 = [u16; 3];
|
|||
// CHECK-LABEL: @swap_rgb48
|
||||
#[no_mangle]
|
||||
pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) {
|
||||
// CHECK-NOT: alloca
|
||||
// CHECK: load i48
|
||||
// CHECK: store i48
|
||||
// FIXME MIR inlining messes up LLVM optimizations.
|
||||
// WOULD-CHECK-NOT: alloca
|
||||
// WOULD-CHECK: load i48
|
||||
// WOULD-CHECK: store i48
|
||||
swap(x, y)
|
||||
}
|
||||
|
||||
|
|
|
@ -53,16 +53,18 @@ pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> {
|
|||
// CHECK-LABEL: @vec_iterator_cast_aggregate
|
||||
#[no_mangle]
|
||||
pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> {
|
||||
// CHECK-NOT: loop
|
||||
// CHECK-NOT: call
|
||||
// FIXME These checks should be the same as other functions.
|
||||
// CHECK-NOT: @__rust_alloc
|
||||
// CHECK-NOT: @__rust_alloc
|
||||
vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @vec_iterator_cast_deaggregate
|
||||
#[no_mangle]
|
||||
pub fn vec_iterator_cast_deaggregate(vec: Vec<Bar>) -> Vec<[u64; 4]> {
|
||||
// CHECK-NOT: loop
|
||||
// CHECK-NOT: call
|
||||
// FIXME These checks should be the same as other functions.
|
||||
// CHECK-NOT: @__rust_alloc
|
||||
// CHECK-NOT: @__rust_alloc
|
||||
|
||||
// Safety: For the purpose of this test we assume that Bar layout matches [u64; 4].
|
||||
// This currently is not guaranteed for repr(Rust) types, but it happens to work here and
|
||||
|
|
26
src/test/mir-opt/inline/caller-with-trivial-bound.rs
Normal file
26
src/test/mir-opt/inline/caller-with-trivial-bound.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// ignore-wasm32 compiled with panic=abort by default
|
||||
// needs-unwind
|
||||
|
||||
#![crate_type = "lib"]
|
||||
pub trait Factory<T> {
|
||||
type Item;
|
||||
}
|
||||
|
||||
pub struct IntFactory;
|
||||
|
||||
impl<T> Factory<T> for IntFactory {
|
||||
type Item = usize;
|
||||
}
|
||||
|
||||
// EMIT_MIR caller_with_trivial_bound.foo.Inline.diff
|
||||
pub fn foo<T>()
|
||||
where
|
||||
IntFactory: Factory<T>,
|
||||
{
|
||||
let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn bar<T>() -> <IntFactory as Factory<T>>::Item {
|
||||
0usize
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
- // MIR for `foo` before Inline
|
||||
+ // MIR for `foo` after Inline
|
||||
|
||||
fn foo() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/caller-with-trivial-bound.rs:17:1: 17:1
|
||||
let mut _1: <IntFactory as Factory<T>>::Item; // in scope 0 at $DIR/caller-with-trivial-bound.rs:20:9: 20:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/caller-with-trivial-bound.rs:20:9: 20:14
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/caller-with-trivial-bound.rs:20:9: 20:14
|
||||
_1 = bar::<T>() -> bb1; // scope 0 at $DIR/caller-with-trivial-bound.rs:20:51: 20:61
|
||||
// mir::Constant
|
||||
// + span: $DIR/caller-with-trivial-bound.rs:20:51: 20:59
|
||||
// + literal: Const { ty: fn() -> <IntFactory as Factory<T>>::Item {bar::<T>}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = const (); // scope 0 at $DIR/caller-with-trivial-bound.rs:19:1: 21:2
|
||||
drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/caller-with-trivial-bound.rs:21:1: 21:2
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_1); // scope 0 at $DIR/caller-with-trivial-bound.rs:21:1: 21:2
|
||||
return; // scope 0 at $DIR/caller-with-trivial-bound.rs:21:2: 21:2
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
resume; // scope 0 at $DIR/caller-with-trivial-bound.rs:16:1: 21:2
|
||||
}
|
||||
}
|
||||
|
|
@ -5,17 +5,20 @@
|
|||
let mut _0: (); // return place in scope 0 at $DIR/inline-cycle.rs:13:10: 13:10
|
||||
let _1: (); // in scope 0 at $DIR/inline-cycle.rs:14:5: 14:24
|
||||
+ scope 1 (inlined <C as Call>::call) { // at $DIR/inline-cycle.rs:14:5: 14:24
|
||||
+ scope 2 (inlined <A<C> as Call>::call) { // at $DIR/inline-cycle.rs:43:9: 43:23
|
||||
+ scope 3 (inlined <B<C> as Call>::call) { // at $DIR/inline-cycle.rs:28:9: 28:31
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/inline-cycle.rs:14:5: 14:24
|
||||
- _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle.rs:14:5: 14:24
|
||||
+ _1 = <A<C> as Call>::call() -> bb1; // scope 1 at $DIR/inline-cycle.rs:43:9: 43:23
|
||||
+ _1 = <C as Call>::call() -> bb1; // scope 3 at $DIR/inline-cycle.rs:36:9: 36:28
|
||||
// mir::Constant
|
||||
- // + span: $DIR/inline-cycle.rs:14:5: 14:22
|
||||
- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) }
|
||||
+ // + span: $DIR/inline-cycle.rs:43:9: 43:21
|
||||
+ // + literal: Const { ty: fn() {<A<C> as Call>::call}, val: Value(Scalar(<ZST>)) }
|
||||
+ // + span: $DIR/inline-cycle.rs:36:9: 36:26
|
||||
// + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
+ let _3: (); // in scope 1 at $DIR/inline-cycle.rs:54:5: 54:8
|
||||
+ let mut _4: fn() {f}; // in scope 1 at $DIR/inline-cycle.rs:54:5: 54:6
|
||||
+ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { // at $DIR/inline-cycle.rs:54:5: 54:8
|
||||
+ scope 3 (inlined f) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
+ let _6: (); // in scope 3 at $DIR/inline-cycle.rs:59:5: 59:12
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
|
@ -21,19 +24,26 @@
|
|||
+ _2 = f; // scope 0 at $DIR/inline-cycle.rs:49:5: 49:12
|
||||
// mir::Constant
|
||||
- // + span: $DIR/inline-cycle.rs:49:5: 49:9
|
||||
- // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(Scalar(<ZST>)) }
|
||||
- // mir::Constant
|
||||
// + span: $DIR/inline-cycle.rs:49:10: 49:11
|
||||
// + literal: Const { ty: fn() {f}, val: Value(Scalar(<ZST>)) }
|
||||
+ // + span: $DIR/inline-cycle.rs:49:10: 49:11
|
||||
+ // + literal: Const { ty: fn() {f}, val: Value(Scalar(<ZST>)) }
|
||||
+ StorageLive(_3); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8
|
||||
+ StorageLive(_4); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:6
|
||||
+ _4 = move _2; // scope 1 at $DIR/inline-cycle.rs:54:5: 54:6
|
||||
+ StorageLive(_5); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8
|
||||
+ _5 = const (); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8
|
||||
+ _3 = move _4() -> bb1; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
+ StorageLive(_6); // scope 3 at $DIR/inline-cycle.rs:59:5: 59:12
|
||||
+ _6 = call::<fn() {f}>(f) -> bb1; // scope 3 at $DIR/inline-cycle.rs:59:5: 59:12
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/inline-cycle.rs:59:5: 59:9
|
||||
// + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(Scalar(<ZST>)) }
|
||||
// mir::Constant
|
||||
- // + span: $DIR/inline-cycle.rs:49:10: 49:11
|
||||
+ // + span: $DIR/inline-cycle.rs:59:10: 59:11
|
||||
// + literal: Const { ty: fn() {f}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
+ StorageDead(_6); // scope 3 at $DIR/inline-cycle.rs:59:12: 59:13
|
||||
+ StorageDead(_5); // scope 1 at $DIR/inline-cycle.rs:54:5: 54:8
|
||||
+ StorageDead(_4); // scope 1 at $DIR/inline-cycle.rs:54:7: 54:8
|
||||
+ StorageDead(_3); // scope 1 at $DIR/inline-cycle.rs:54:8: 54:9
|
||||
|
|
|
@ -4,12 +4,22 @@
|
|||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/inline-cycle-generic.rs:8:11: 8:11
|
||||
let _1: (); // in scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
|
||||
+ scope 1 (inlined <C as Call>::call) { // at $DIR/inline-cycle-generic.rs:9:5: 9:24
|
||||
+ scope 2 (inlined <B<A> as Call>::call) { // at $DIR/inline-cycle-generic.rs:38:9: 38:31
|
||||
+ scope 3 (inlined <A as Call>::call) { // at $DIR/inline-cycle-generic.rs:31:9: 31:28
|
||||
+ scope 4 (inlined <B<C> as Call>::call) { // at $DIR/inline-cycle-generic.rs:23:9: 23:31
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
|
||||
_1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
|
||||
- _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline-cycle-generic.rs:9:5: 9:24
|
||||
+ _1 = <C as Call>::call() -> bb1; // scope 4 at $DIR/inline-cycle-generic.rs:31:9: 31:28
|
||||
// mir::Constant
|
||||
// + span: $DIR/inline-cycle-generic.rs:9:5: 9:22
|
||||
- // + span: $DIR/inline-cycle-generic.rs:9:5: 9:22
|
||||
+ // + span: $DIR/inline-cycle-generic.rs:31:9: 31:26
|
||||
// + literal: Const { ty: fn() {<C as Call>::call}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
|
@ -17,6 +27,10 @@
|
|||
StorageDead(_1); // scope 0 at $DIR/inline-cycle-generic.rs:9:24: 9:25
|
||||
_0 = const (); // scope 0 at $DIR/inline-cycle-generic.rs:8:11: 10:2
|
||||
return; // scope 0 at $DIR/inline-cycle-generic.rs:10:2: 10:2
|
||||
+ }
|
||||
+
|
||||
+ bb2 (cleanup): {
|
||||
+ resume; // scope 0 at $DIR/inline-cycle-generic.rs:8:1: 10:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags: -Copt-level=0
|
||||
// normalize-stderr-test: ".nll/" -> "/"
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut &... &mut &mut &mut &mut &mut Empty>`
|
||||
--> $DIR/issue-67552.rs:28:9
|
||||
--> $DIR/issue-67552.rs:29:9
|
||||
|
|
||||
LL | rec(identity(&mut it))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: `rec` defined here
|
||||
--> $DIR/issue-67552.rs:21:1
|
||||
--> $DIR/issue-67552.rs:22:1
|
||||
|
|
||||
LL | / fn rec<T>(mut it: T)
|
||||
LL | | where
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-fail
|
||||
// check-run-results
|
||||
// compile-flags: -Zlocation-detail=line,column
|
||||
// compile-flags: -Copt-level=0 -Zlocation-detail=line,column
|
||||
// exec-env:RUST_BACKTRACE=0
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
// compile-flags:-Zpolymorphize=on -Zinline-mir=off
|
||||
#![feature(generic_const_exprs, generators, generator_trait, rustc_attrs)]
|
||||
//~^ WARN the feature `generic_const_exprs` is incomplete
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// build-fail
|
||||
// compile-flags:-Zpolymorphize=on
|
||||
// compile-flags: -Copt-level=0 -Zpolymorphize=on
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// This test checks that `T` is considered used in `foo`, because it is used in a predicate for
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:14:4
|
||||
--> $DIR/predicates.rs:15:4
|
||||
|
|
||||
LL | fn foo<I, T>(_: I)
|
||||
| ^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:23:4
|
||||
--> $DIR/predicates.rs:24:4
|
||||
|
|
||||
LL | fn baz<I, T>(_: I)
|
||||
| ^^^ - generic parameter `T` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:44:19
|
||||
--> $DIR/predicates.rs:45:19
|
||||
|
|
||||
LL | impl<'a, I, T: 'a, E> Iterator for Foo<'a, I, E>
|
||||
| - - generic parameter `E` is unused
|
||||
|
@ -22,7 +22,7 @@ LL | self.find(|_| true)
|
|||
| ^^^^^^^^
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:58:4
|
||||
--> $DIR/predicates.rs:59:4
|
||||
|
|
||||
LL | fn quux<A, B, C: Default>() -> usize
|
||||
| ^^^^ - - generic parameter `B` is unused
|
||||
|
@ -30,19 +30,19 @@ LL | fn quux<A, B, C: Default>() -> usize
|
|||
| generic parameter `A` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:75:4
|
||||
--> $DIR/predicates.rs:76:4
|
||||
|
|
||||
LL | fn foobar<F, G>() -> usize
|
||||
| ^^^^^^ - generic parameter `F` is unused
|
||||
|
||||
error: item has unused generic parameters
|
||||
--> $DIR/predicates.rs:9:4
|
||||
--> $DIR/predicates.rs:10:4
|
||||
|
|
||||
LL | fn bar<I>() {
|
||||
| ^^^ - generic parameter `I` is unused
|
||||
|
||||
note: the above error was encountered while instantiating `fn foo::<std::slice::Iter<u32>, T>`
|
||||
--> $DIR/predicates.rs:85:5
|
||||
--> $DIR/predicates.rs:86:5
|
||||
|
|
||||
LL | foo(x.iter());
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// build-fail
|
||||
//~^ ERROR overflow evaluating the requirement
|
||||
// compile-flags: -Copt-level=0
|
||||
//~^^ ERROR overflow evaluating the requirement
|
||||
|
||||
fn main() {
|
||||
let mut iter = 0u8..1;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: function cannot return without recursing
|
||||
--> $DIR/issue-83150.rs:9:1
|
||||
--> $DIR/issue-83150.rs:10:1
|
||||
|
|
||||
LL | fn func<T: Iterator<Item = u8>>(iter: &mut T) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
|
||||
|
@ -9,10 +9,10 @@ LL | func(&mut iter.map(|x| x + 1))
|
|||
= note: `#[warn(unconditional_recursion)]` on by default
|
||||
= help: a `loop` may express intention better if this is on purpose
|
||||
|
||||
error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>: Iterator`
|
||||
error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>: Iterator`
|
||||
|
|
||||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`)
|
||||
= note: required because of the requirements on the impl of `Iterator` for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>, [closure@$DIR/issue-83150.rs:10:24: 10:33]>`
|
||||
= note: required because of the requirements on the impl of `Iterator` for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut std::ops::Range<u8>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>, [closure@$DIR/issue-83150.rs:11:24: 11:33]>`
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
// known-bug: #93008
|
||||
// build-fail
|
||||
// failure-status: 101
|
||||
// compile-flags:--crate-type=lib -Zmir-opt-level=3
|
||||
// rustc-env:RUST_BACKTRACE=0
|
||||
|
||||
// normalize-stderr-test "thread 'rustc' panicked.*" -> "thread 'rustc' panicked"
|
||||
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
|
||||
// normalize-stderr-test "error: internal compiler error.*" -> "error: internal compiler error"
|
||||
// normalize-stderr-test "encountered.*with incompatible types:" "encountered ... with incompatible types:"
|
||||
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
|
||||
// normalize-stderr-test "query stack during panic:\n" -> ""
|
||||
// normalize-stderr-test "we're just showing a limited slice of the query stack\n" -> ""
|
||||
// normalize-stderr-test "end of query stack\n" -> ""
|
||||
// normalize-stderr-test "#.*\n" -> ""
|
||||
|
||||
// This is a known bug that @compiler-errors tried to fix in #94238,
|
||||
// but the solution was probably not correct.
|
||||
|
||||
pub trait Factory<T> {
|
||||
type Item;
|
||||
}
|
||||
|
||||
pub struct IntFactory;
|
||||
|
||||
impl<T> Factory<T> for IntFactory {
|
||||
type Item = usize;
|
||||
}
|
||||
|
||||
pub fn foo<T>()
|
||||
where
|
||||
IntFactory: Factory<T>,
|
||||
{
|
||||
let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn bar<T>() -> <IntFactory as Factory<T>>::Item {
|
||||
0usize
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
error: internal compiler error
|
||||
|
||||
error: internal compiler error
|
||||
encountered ... with incompatible types:
|
||||
left-hand side has type: <IntFactory as Factory<T>>::Item
|
||||
right-hand side has type: usize
|
||||
--> $DIR/select-param-env-instead-of-blanket.rs:42:5
|
||||
|
|
||||
LL | let mut x: <IntFactory as Factory<T>>::Item = bar::<T>();
|
||||
| ---------- in this inlined function call
|
||||
...
|
||||
LL | 0usize
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:128:36
|
||||
|
||||
thread 'rustc' panicked
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
// build-fail
|
||||
// compile-flags: -Zinline-mir=no
|
||||
// error-pattern: overflow evaluating the requirement `(): Sized`
|
||||
// error-pattern: function cannot return without recursing
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,10 @@
|
|||
// build-fail
|
||||
// error-pattern: reached the type-length limit while instantiating
|
||||
// compile-flags: -Copt-level=0
|
||||
// normalize-stderr-test: ".nll/" -> "/"
|
||||
|
||||
// Test that the type length limit can be changed.
|
||||
// The exact type depends on optimizations, so disable them.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![type_length_limit="4"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue