Auto merge of #131458 - matthiaskrgr:rollup-82qeotv, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #131382 (Add "reference" as a known compiletest header) - #131420 (Dont ICE when encountering post-mono layout cycle error) - #131424 (compiler: Stop reexporting enum-globs from `rustc_target::abi`) - #131426 (Fix quotation marks around debug line in `src/ci/run.sh`) - #131435 (Ignore broken-pipe-no-ice on apple (specifically macOS) for now) - #131447 (add more crash tests) - #131456 (Fix typo in E0793) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
fc0f045dd1
@ -3416,6 +3416,7 @@ dependencies = [
|
|||||||
"measureme",
|
"measureme",
|
||||||
"object 0.36.4",
|
"object 0.36.4",
|
||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_attr",
|
"rustc_attr",
|
||||||
"rustc_codegen_ssa",
|
"rustc_codegen_ssa",
|
||||||
@ -3456,6 +3457,7 @@ dependencies = [
|
|||||||
"object 0.36.4",
|
"object 0.36.4",
|
||||||
"pathdiff",
|
"pathdiff",
|
||||||
"regex",
|
"regex",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_arena",
|
"rustc_arena",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_attr",
|
"rustc_attr",
|
||||||
@ -3493,6 +3495,7 @@ name = "rustc_const_eval"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_attr",
|
"rustc_attr",
|
||||||
@ -3772,6 +3775,7 @@ name = "rustc_hir_typeck"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_ast_ir",
|
"rustc_ast_ir",
|
||||||
"rustc_attr",
|
"rustc_attr",
|
||||||
@ -4027,6 +4031,7 @@ dependencies = [
|
|||||||
"gsgdt",
|
"gsgdt",
|
||||||
"polonius-engine",
|
"polonius-engine",
|
||||||
"rustc-rayon-core",
|
"rustc-rayon-core",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_apfloat",
|
"rustc_apfloat",
|
||||||
"rustc_arena",
|
"rustc_arena",
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
@ -4522,6 +4527,7 @@ name = "rustc_ty_utils"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"rustc_abi",
|
||||||
"rustc_ast_ir",
|
"rustc_ast_ir",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_errors",
|
"rustc_errors",
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
//! Adapted from <https://github.com/rust-lang/rust/blob/31c0645b9d2539f47eecb096142474b29dc542f7/compiler/rustc_codegen_ssa/src/mir/place.rs>
|
//! Adapted from <https://github.com/rust-lang/rust/blob/31c0645b9d2539f47eecb096142474b29dc542f7/compiler/rustc_codegen_ssa/src/mir/place.rs>
|
||||||
//! (<https://github.com/rust-lang/rust/pull/104535>)
|
//! (<https://github.com/rust-lang/rust/pull/104535>)
|
||||||
|
|
||||||
use rustc_target::abi::{Int, TagEncoding, Variants};
|
use rustc_abi::Primitive::Int;
|
||||||
|
use rustc_abi::{TagEncoding, Variants};
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
extern crate jobserver;
|
extern crate jobserver;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustc_middle;
|
extern crate rustc_middle;
|
||||||
|
extern crate rustc_abi;
|
||||||
extern crate rustc_ast;
|
extern crate rustc_ast;
|
||||||
extern crate rustc_codegen_ssa;
|
extern crate rustc_codegen_ssa;
|
||||||
extern crate rustc_data_structures;
|
extern crate rustc_data_structures;
|
||||||
|
@ -7,6 +7,8 @@ use gccjit::{
|
|||||||
BinaryOp, Block, ComparisonOp, Context, Function, LValue, Location, RValue, ToRValue, Type,
|
BinaryOp, Block, ComparisonOp, Context, Function, LValue, Location, RValue, ToRValue, Type,
|
||||||
UnaryOp,
|
UnaryOp,
|
||||||
};
|
};
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
|
||||||
use rustc_apfloat::{Float, Round, Status, ieee};
|
use rustc_apfloat::{Float, Round, Status, ieee};
|
||||||
use rustc_codegen_ssa::MemFlags;
|
use rustc_codegen_ssa::MemFlags;
|
||||||
use rustc_codegen_ssa::common::{
|
use rustc_codegen_ssa::common::{
|
||||||
@ -28,7 +30,6 @@ use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
|
|||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_span::def_id::DefId;
|
use rustc_span::def_id::DefId;
|
||||||
use rustc_target::abi::call::FnAbi;
|
use rustc_target::abi::call::FnAbi;
|
||||||
use rustc_target::abi::{self, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
|
|
||||||
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi};
|
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi};
|
||||||
|
|
||||||
use crate::common::{SignType, TypeReflection, type_is_pointer};
|
use crate::common::{SignType, TypeReflection, type_is_pointer};
|
||||||
@ -998,12 +999,12 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||||||
) {
|
) {
|
||||||
let vr = scalar.valid_range(bx);
|
let vr = scalar.valid_range(bx);
|
||||||
match scalar.primitive() {
|
match scalar.primitive() {
|
||||||
abi::Int(..) => {
|
abi::Primitive::Int(..) => {
|
||||||
if !scalar.is_always_valid(bx) {
|
if !scalar.is_always_valid(bx) {
|
||||||
bx.range_metadata(load, vr);
|
bx.range_metadata(load, vr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abi::Pointer(_) if vr.start < vr.end && !vr.contains(0) => {
|
abi::Primitive::Pointer(_) if vr.start < vr.end && !vr.contains(0) => {
|
||||||
bx.nonnull_metadata(load);
|
bx.nonnull_metadata(load);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
use gccjit::{LValue, RValue, ToRValue, Type};
|
use gccjit::{LValue, RValue, ToRValue, Type};
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::HasDataLayout;
|
||||||
|
use rustc_abi::Primitive::Pointer;
|
||||||
use rustc_codegen_ssa::traits::{
|
use rustc_codegen_ssa::traits::{
|
||||||
BaseTypeCodegenMethods, ConstCodegenMethods, MiscCodegenMethods, StaticCodegenMethods,
|
BaseTypeCodegenMethods, ConstCodegenMethods, MiscCodegenMethods, StaticCodegenMethods,
|
||||||
};
|
};
|
||||||
use rustc_middle::mir::Mutability;
|
use rustc_middle::mir::Mutability;
|
||||||
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
|
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
|
||||||
use rustc_middle::ty::layout::LayoutOf;
|
use rustc_middle::ty::layout::LayoutOf;
|
||||||
use rustc_target::abi::{self, HasDataLayout, Pointer};
|
|
||||||
|
|
||||||
use crate::consts::const_alloc_to_gcc;
|
use crate::consts::const_alloc_to_gcc;
|
||||||
use crate::context::CodegenCx;
|
use crate::context::CodegenCx;
|
||||||
|
@ -32,6 +32,7 @@ extern crate tempfile;
|
|||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
|
||||||
// The rustc crates we need
|
// The rustc crates we need
|
||||||
|
extern crate rustc_abi;
|
||||||
extern crate rustc_apfloat;
|
extern crate rustc_apfloat;
|
||||||
extern crate rustc_ast;
|
extern crate rustc_ast;
|
||||||
extern crate rustc_attr;
|
extern crate rustc_attr;
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
use gccjit::{Struct, Type};
|
use gccjit::{Struct, Type};
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::Primitive::*;
|
||||||
|
use rustc_abi::{Abi, FieldsShape, Integer, PointeeInfo, Size, Variants};
|
||||||
use rustc_codegen_ssa::traits::{
|
use rustc_codegen_ssa::traits::{
|
||||||
BaseTypeCodegenMethods, DerivedTypeCodegenMethods, LayoutTypeCodegenMethods,
|
BaseTypeCodegenMethods, DerivedTypeCodegenMethods, LayoutTypeCodegenMethods,
|
||||||
};
|
};
|
||||||
@ -8,11 +11,8 @@ use rustc_middle::bug;
|
|||||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
|
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
|
||||||
|
use rustc_target::abi::TyAbiInterface;
|
||||||
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
|
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
|
||||||
use rustc_target::abi::{
|
|
||||||
self, Abi, FieldsShape, Float, Int, Integer, PointeeInfo, Pointer, Size, TyAbiInterface,
|
|
||||||
Variants,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
|
use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
|
||||||
use crate::context::CodegenCx;
|
use crate::context::CodegenCx;
|
||||||
|
@ -14,6 +14,7 @@ libc = "0.2"
|
|||||||
measureme = "11"
|
measureme = "11"
|
||||||
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
|
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
|
||||||
rustc-demangle = "0.1.21"
|
rustc-demangle = "0.1.21"
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_attr = { path = "../rustc_attr" }
|
rustc_attr = { path = "../rustc_attr" }
|
||||||
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
|
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::Primitive::Int;
|
||||||
|
use rustc_abi::{HasDataLayout, Size};
|
||||||
use rustc_codegen_ssa::MemFlags;
|
use rustc_codegen_ssa::MemFlags;
|
||||||
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
|
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
|
||||||
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
|
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
|
||||||
@ -11,7 +14,6 @@ pub(crate) use rustc_middle::ty::layout::{WIDE_PTR_ADDR, WIDE_PTR_EXTRA};
|
|||||||
use rustc_middle::{bug, ty};
|
use rustc_middle::{bug, ty};
|
||||||
use rustc_session::config;
|
use rustc_session::config;
|
||||||
pub(crate) use rustc_target::abi::call::*;
|
pub(crate) use rustc_target::abi::call::*;
|
||||||
use rustc_target::abi::{self, HasDataLayout, Int, Size};
|
|
||||||
use rustc_target::spec::SanitizerSet;
|
use rustc_target::spec::SanitizerSet;
|
||||||
pub(crate) use rustc_target::spec::abi::Abi;
|
pub(crate) use rustc_target::spec::abi::Abi;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
@ -3,6 +3,8 @@ use std::ops::Deref;
|
|||||||
use std::{iter, ptr};
|
use std::{iter, ptr};
|
||||||
|
|
||||||
use libc::{c_char, c_uint};
|
use libc::{c_char, c_uint};
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::{Align, Size, WrappingRange};
|
||||||
use rustc_codegen_ssa::MemFlags;
|
use rustc_codegen_ssa::MemFlags;
|
||||||
use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, SynchronizationScope, TypeKind};
|
use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, SynchronizationScope, TypeKind};
|
||||||
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
|
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
|
||||||
@ -20,7 +22,6 @@ use rustc_sanitizers::{cfi, kcfi};
|
|||||||
use rustc_session::config::OptLevel;
|
use rustc_session::config::OptLevel;
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_target::abi::call::FnAbi;
|
use rustc_target::abi::call::FnAbi;
|
||||||
use rustc_target::abi::{self, Align, Size, WrappingRange};
|
|
||||||
use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target};
|
use rustc_target::spec::{HasTargetSpec, SanitizerSet, Target};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
@ -505,12 +506,12 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match scalar.primitive() {
|
match scalar.primitive() {
|
||||||
abi::Int(..) => {
|
abi::Primitive::Int(..) => {
|
||||||
if !scalar.is_always_valid(bx) {
|
if !scalar.is_always_valid(bx) {
|
||||||
bx.range_metadata(load, scalar.valid_range(bx));
|
bx.range_metadata(load, scalar.valid_range(bx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abi::Pointer(_) => {
|
abi::Primitive::Pointer(_) => {
|
||||||
if !scalar.valid_range(bx).contains(0) {
|
if !scalar.valid_range(bx).contains(0) {
|
||||||
bx.nonnull_metadata(load);
|
bx.nonnull_metadata(load);
|
||||||
}
|
}
|
||||||
@ -521,7 +522,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abi::Float(_) => {}
|
abi::Primitive::Float(_) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
//! Code that is useful in various codegen modules.
|
//! Code that is useful in various codegen modules.
|
||||||
|
|
||||||
use libc::{c_char, c_uint};
|
use libc::{c_char, c_uint};
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::Primitive::Pointer;
|
||||||
|
use rustc_abi::{AddressSpace, HasDataLayout};
|
||||||
use rustc_ast::Mutability;
|
use rustc_ast::Mutability;
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher};
|
||||||
@ -9,7 +12,6 @@ use rustc_middle::bug;
|
|||||||
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
|
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::cstore::DllImport;
|
use rustc_session::cstore::DllImport;
|
||||||
use rustc_target::abi::{self, AddressSpace, HasDataLayout, Pointer};
|
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::consts::const_alloc_to_llvm;
|
use crate::consts::const_alloc_to_llvm;
|
||||||
|
@ -1187,10 +1187,11 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
fn_abi_request: FnAbiRequest<'tcx>,
|
fn_abi_request: FnAbiRequest<'tcx>,
|
||||||
) -> ! {
|
) -> ! {
|
||||||
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
|
match err {
|
||||||
self.tcx.dcx().emit_fatal(Spanned { span, node: err })
|
FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::Cycle(_)) => {
|
||||||
} else {
|
self.tcx.dcx().emit_fatal(Spanned { span, node: err });
|
||||||
match fn_abi_request {
|
}
|
||||||
|
_ => match fn_abi_request {
|
||||||
FnAbiRequest::OfFnPtr { sig, extra_args } => {
|
FnAbiRequest::OfFnPtr { sig, extra_args } => {
|
||||||
span_bug!(span, "`fn_abi_of_fn_ptr({sig}, {extra_args:?})` failed: {err:?}",);
|
span_bug!(span, "`fn_abi_of_fn_ptr({sig}, {extra_args:?})` failed: {err:?}",);
|
||||||
}
|
}
|
||||||
@ -1200,7 +1201,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
|
|||||||
"`fn_abi_of_instance({instance}, {extra_args:?})` failed: {err:?}",
|
"`fn_abi_of_instance({instance}, {extra_args:?})` failed: {err:?}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
|
use rustc_abi::Primitive::{Float, Int, Pointer};
|
||||||
|
use rustc_abi::{Abi, Align, FieldsShape, Scalar, Size, Variants};
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
|
||||||
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
|
use rustc_middle::ty::{self, CoroutineArgsExt, Ty, TypeVisitableExt};
|
||||||
use rustc_target::abi::{Abi, Align, FieldsShape, Float, Int, Pointer, Scalar, Size, Variants};
|
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
@ -14,6 +14,7 @@ itertools = "0.12"
|
|||||||
jobserver = "0.1.28"
|
jobserver = "0.1.28"
|
||||||
pathdiff = "0.2.0"
|
pathdiff = "0.2.0"
|
||||||
regex = "1.4"
|
regex = "1.4"
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_arena = { path = "../rustc_arena" }
|
rustc_arena = { path = "../rustc_arena" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_attr = { path = "../rustc_attr" }
|
rustc_attr = { path = "../rustc_attr" }
|
||||||
|
@ -3,12 +3,13 @@ use std::fmt;
|
|||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
use either::Either;
|
use either::Either;
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::{Abi, Align, Size};
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
use rustc_middle::mir::interpret::{Pointer, Scalar, alloc_range};
|
use rustc_middle::mir::interpret::{Pointer, Scalar, alloc_range};
|
||||||
use rustc_middle::mir::{self, ConstValue};
|
use rustc_middle::mir::{self, ConstValue};
|
||||||
use rustc_middle::ty::Ty;
|
use rustc_middle::ty::Ty;
|
||||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||||
use rustc_target::abi::{self, Abi, Align, Size};
|
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::place::{PlaceRef, PlaceValue};
|
use super::place::{PlaceRef, PlaceValue};
|
||||||
@ -207,7 +208,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
|
|||||||
match alloc.0.read_scalar(
|
match alloc.0.read_scalar(
|
||||||
bx,
|
bx,
|
||||||
alloc_range(start, size),
|
alloc_range(start, size),
|
||||||
/*read_provenance*/ matches!(s.primitive(), abi::Pointer(_)),
|
/*read_provenance*/ matches!(s.primitive(), abi::Primitive::Pointer(_)),
|
||||||
) {
|
) {
|
||||||
Ok(val) => bx.scalar_to_backend(val, s, ty),
|
Ok(val) => bx.scalar_to_backend(val, s, ty),
|
||||||
Err(_) => bx.const_poison(ty),
|
Err(_) => bx.const_poison(ty),
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
use rustc_abi::Primitive::{Int, Pointer};
|
||||||
|
use rustc_abi::{Align, FieldsShape, Size, TagEncoding, Variants};
|
||||||
use rustc_middle::mir::tcx::PlaceTy;
|
use rustc_middle::mir::tcx::PlaceTy;
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty};
|
||||||
use rustc_middle::{bug, mir};
|
use rustc_middle::{bug, mir};
|
||||||
use rustc_target::abi::{
|
use rustc_target::abi::VariantIdx;
|
||||||
Align, FieldsShape, Int, Pointer, Size, TagEncoding, VariantIdx, Variants,
|
|
||||||
};
|
|
||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
use super::operand::OperandValue;
|
use super::operand::OperandValue;
|
||||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
either = "1"
|
either = "1"
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_apfloat = "0.2.0"
|
rustc_apfloat = "0.2.0"
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_attr = { path = "../rustc_attr" }
|
rustc_attr = { path = "../rustc_attr" }
|
||||||
|
@ -4,13 +4,14 @@
|
|||||||
use std::assert_matches::assert_matches;
|
use std::assert_matches::assert_matches;
|
||||||
|
|
||||||
use either::{Either, Left, Right};
|
use either::{Either, Left, Right};
|
||||||
|
use rustc_abi as abi;
|
||||||
|
use rustc_abi::{Abi, HasDataLayout, Size};
|
||||||
use rustc_hir::def::Namespace;
|
use rustc_hir::def::Namespace;
|
||||||
use rustc_middle::mir::interpret::ScalarSizeMismatch;
|
use rustc_middle::mir::interpret::ScalarSizeMismatch;
|
||||||
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter};
|
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter};
|
||||||
use rustc_middle::ty::{ConstInt, ScalarInt, Ty, TyCtxt};
|
use rustc_middle::ty::{ConstInt, ScalarInt, Ty, TyCtxt};
|
||||||
use rustc_middle::{bug, mir, span_bug, ty};
|
use rustc_middle::{bug, mir, span_bug, ty};
|
||||||
use rustc_target::abi::{self, Abi, HasDataLayout, Size};
|
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
@ -117,7 +118,7 @@ impl<Prov: Provenance> Immediate<Prov> {
|
|||||||
match (self, abi) {
|
match (self, abi) {
|
||||||
(Immediate::Scalar(scalar), Abi::Scalar(s)) => {
|
(Immediate::Scalar(scalar), Abi::Scalar(s)) => {
|
||||||
assert_eq!(scalar.size(), s.size(cx), "{msg}: scalar value has wrong size");
|
assert_eq!(scalar.size(), s.size(cx), "{msg}: scalar value has wrong size");
|
||||||
if !matches!(s.primitive(), abi::Pointer(..)) {
|
if !matches!(s.primitive(), abi::Primitive::Pointer(..)) {
|
||||||
// This is not a pointer, it should not carry provenance.
|
// This is not a pointer, it should not carry provenance.
|
||||||
assert!(
|
assert!(
|
||||||
matches!(scalar, Scalar::Int(..)),
|
matches!(scalar, Scalar::Int(..)),
|
||||||
@ -131,7 +132,7 @@ impl<Prov: Provenance> Immediate<Prov> {
|
|||||||
a.size(cx),
|
a.size(cx),
|
||||||
"{msg}: first component of scalar pair has wrong size"
|
"{msg}: first component of scalar pair has wrong size"
|
||||||
);
|
);
|
||||||
if !matches!(a.primitive(), abi::Pointer(..)) {
|
if !matches!(a.primitive(), abi::Primitive::Pointer(..)) {
|
||||||
assert!(
|
assert!(
|
||||||
matches!(a_val, Scalar::Int(..)),
|
matches!(a_val, Scalar::Int(..)),
|
||||||
"{msg}: first component of scalar pair should be an integer, but has provenance"
|
"{msg}: first component of scalar pair should be an integer, but has provenance"
|
||||||
@ -142,7 +143,7 @@ impl<Prov: Provenance> Immediate<Prov> {
|
|||||||
b.size(cx),
|
b.size(cx),
|
||||||
"{msg}: second component of scalar pair has wrong size"
|
"{msg}: second component of scalar pair has wrong size"
|
||||||
);
|
);
|
||||||
if !matches!(b.primitive(), abi::Pointer(..)) {
|
if !matches!(b.primitive(), abi::Primitive::Pointer(..)) {
|
||||||
assert!(
|
assert!(
|
||||||
matches!(b_val, Scalar::Int(..)),
|
matches!(b_val, Scalar::Int(..)),
|
||||||
"{msg}: second component of scalar pair should be an integer, but has provenance"
|
"{msg}: second component of scalar pair should be an integer, but has provenance"
|
||||||
@ -572,7 +573,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||||||
assert_eq!(size, mplace.layout.size, "abi::Scalar size does not match layout size");
|
assert_eq!(size, mplace.layout.size, "abi::Scalar size does not match layout size");
|
||||||
let scalar = alloc.read_scalar(
|
let scalar = alloc.read_scalar(
|
||||||
alloc_range(Size::ZERO, size),
|
alloc_range(Size::ZERO, size),
|
||||||
/*read_provenance*/ matches!(s, abi::Pointer(_)),
|
/*read_provenance*/ matches!(s, abi::Primitive::Pointer(_)),
|
||||||
)?;
|
)?;
|
||||||
Some(ImmTy::from_scalar(scalar, mplace.layout))
|
Some(ImmTy::from_scalar(scalar, mplace.layout))
|
||||||
}
|
}
|
||||||
@ -588,11 +589,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||||||
assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields
|
assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields
|
||||||
let a_val = alloc.read_scalar(
|
let a_val = alloc.read_scalar(
|
||||||
alloc_range(Size::ZERO, a_size),
|
alloc_range(Size::ZERO, a_size),
|
||||||
/*read_provenance*/ matches!(a, abi::Pointer(_)),
|
/*read_provenance*/ matches!(a, abi::Primitive::Pointer(_)),
|
||||||
)?;
|
)?;
|
||||||
let b_val = alloc.read_scalar(
|
let b_val = alloc.read_scalar(
|
||||||
alloc_range(b_offset, b_size),
|
alloc_range(b_offset, b_size),
|
||||||
/*read_provenance*/ matches!(b, abi::Pointer(_)),
|
/*read_provenance*/ matches!(b, abi::Primitive::Pointer(_)),
|
||||||
)?;
|
)?;
|
||||||
Some(ImmTy::from_immediate(Immediate::ScalarPair(a_val, b_val), mplace.layout))
|
Some(ImmTy::from_immediate(Immediate::ScalarPair(a_val, b_val), mplace.layout))
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
An unaligned references to a field of a [packed] struct got created.
|
An unaligned reference to a field of a [packed] struct got created.
|
||||||
|
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
itertools = "0.12"
|
itertools = "0.12"
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_ast_ir = { path = "../rustc_ast_ir" }
|
rustc_ast_ir = { path = "../rustc_ast_ir" }
|
||||||
rustc_attr = { path = "../rustc_attr" }
|
rustc_attr = { path = "../rustc_attr" }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use hir::HirId;
|
use hir::HirId;
|
||||||
|
use rustc_abi::Primitive::Pointer;
|
||||||
use rustc_errors::codes::*;
|
use rustc_errors::codes::*;
|
||||||
use rustc_errors::struct_span_code_err;
|
use rustc_errors::struct_span_code_err;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
@ -6,7 +7,7 @@ use rustc_index::Idx;
|
|||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
|
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
|
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
|
||||||
use rustc_target::abi::{Pointer, VariantIdx};
|
use rustc_target::abi::VariantIdx;
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
use super::FnCtxt;
|
use super::FnCtxt;
|
||||||
|
@ -12,6 +12,7 @@ field-offset = "0.3.5"
|
|||||||
gsgdt = "0.1.2"
|
gsgdt = "0.1.2"
|
||||||
polonius-engine = "0.13.0"
|
polonius-engine = "0.13.0"
|
||||||
rustc-rayon-core = { version = "0.5.0", optional = true }
|
rustc-rayon-core = { version = "0.5.0", optional = true }
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_apfloat = "0.2.0"
|
rustc_apfloat = "0.2.0"
|
||||||
rustc_arena = { path = "../rustc_arena" }
|
rustc_arena = { path = "../rustc_arena" }
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
|
@ -2,11 +2,15 @@ use std::num::NonZero;
|
|||||||
use std::ops::Bound;
|
use std::ops::Bound;
|
||||||
use std::{cmp, fmt};
|
use std::{cmp, fmt};
|
||||||
|
|
||||||
|
use rustc_abi::Primitive::{self, Float, Int, Pointer};
|
||||||
|
use rustc_abi::{
|
||||||
|
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutS,
|
||||||
|
PointeeInfo, PointerKind, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout, Variants,
|
||||||
|
};
|
||||||
use rustc_error_messages::DiagMessage;
|
use rustc_error_messages::DiagMessage;
|
||||||
use rustc_errors::{
|
use rustc_errors::{
|
||||||
Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
|
Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
|
||||||
};
|
};
|
||||||
use rustc_hir as hir;
|
|
||||||
use rustc_hir::LangItem;
|
use rustc_hir::LangItem;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_index::IndexVec;
|
use rustc_index::IndexVec;
|
||||||
@ -15,10 +19,11 @@ use rustc_session::config::OptLevel;
|
|||||||
use rustc_span::symbol::{Symbol, sym};
|
use rustc_span::symbol::{Symbol, sym};
|
||||||
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
|
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
|
||||||
use rustc_target::abi::call::FnAbi;
|
use rustc_target::abi::call::FnAbi;
|
||||||
use rustc_target::abi::*;
|
use rustc_target::abi::{FieldIdx, TyAbiInterface, VariantIdx, call};
|
||||||
use rustc_target::spec::abi::Abi as SpecAbi;
|
use rustc_target::spec::abi::Abi as SpecAbi;
|
||||||
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, PanicStrategy, Target, WasmCAbi};
|
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, PanicStrategy, Target, WasmCAbi};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
use {rustc_abi as abi, rustc_hir as hir};
|
||||||
|
|
||||||
use crate::error::UnsupportedFnAbi;
|
use crate::error::UnsupportedFnAbi;
|
||||||
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||||
@ -27,9 +32,10 @@ use crate::ty::normalize_erasing_regions::NormalizationError;
|
|||||||
use crate::ty::{self, CoroutineArgsExt, Ty, TyCtxt, TypeVisitableExt};
|
use crate::ty::{self, CoroutineArgsExt, Ty, TyCtxt, TypeVisitableExt};
|
||||||
|
|
||||||
#[extension(pub trait IntegerExt)]
|
#[extension(pub trait IntegerExt)]
|
||||||
impl Integer {
|
impl abi::Integer {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx> {
|
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>, signed: bool) -> Ty<'tcx> {
|
||||||
|
use abi::Integer::{I8, I16, I32, I64, I128};
|
||||||
match (*self, signed) {
|
match (*self, signed) {
|
||||||
(I8, false) => tcx.types.u8,
|
(I8, false) => tcx.types.u8,
|
||||||
(I16, false) => tcx.types.u16,
|
(I16, false) => tcx.types.u16,
|
||||||
@ -44,7 +50,8 @@ impl Integer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: ty::IntTy) -> Integer {
|
fn from_int_ty<C: HasDataLayout>(cx: &C, ity: ty::IntTy) -> abi::Integer {
|
||||||
|
use abi::Integer::{I8, I16, I32, I64, I128};
|
||||||
match ity {
|
match ity {
|
||||||
ty::IntTy::I8 => I8,
|
ty::IntTy::I8 => I8,
|
||||||
ty::IntTy::I16 => I16,
|
ty::IntTy::I16 => I16,
|
||||||
@ -54,7 +61,8 @@ impl Integer {
|
|||||||
ty::IntTy::Isize => cx.data_layout().ptr_sized_integer(),
|
ty::IntTy::Isize => cx.data_layout().ptr_sized_integer(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn from_uint_ty<C: HasDataLayout>(cx: &C, ity: ty::UintTy) -> Integer {
|
fn from_uint_ty<C: HasDataLayout>(cx: &C, ity: ty::UintTy) -> abi::Integer {
|
||||||
|
use abi::Integer::{I8, I16, I32, I64, I128};
|
||||||
match ity {
|
match ity {
|
||||||
ty::UintTy::U8 => I8,
|
ty::UintTy::U8 => I8,
|
||||||
ty::UintTy::U16 => I16,
|
ty::UintTy::U16 => I16,
|
||||||
@ -102,7 +110,7 @@ impl Integer {
|
|||||||
tcx.data_layout().c_enum_min_size
|
tcx.data_layout().c_enum_min_size
|
||||||
} else {
|
} else {
|
||||||
// repr(Rust) enums try to be as small as possible
|
// repr(Rust) enums try to be as small as possible
|
||||||
I8
|
Integer::I8
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there are no negative values, we can use the unsigned fit.
|
// If there are no negative values, we can use the unsigned fit.
|
||||||
@ -115,9 +123,10 @@ impl Integer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[extension(pub trait FloatExt)]
|
#[extension(pub trait FloatExt)]
|
||||||
impl Float {
|
impl abi::Float {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||||
|
use abi::Float::*;
|
||||||
match *self {
|
match *self {
|
||||||
F16 => tcx.types.f16,
|
F16 => tcx.types.f16,
|
||||||
F32 => tcx.types.f32,
|
F32 => tcx.types.f32,
|
||||||
@ -127,6 +136,7 @@ impl Float {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn from_float_ty(fty: ty::FloatTy) -> Self {
|
fn from_float_ty(fty: ty::FloatTy) -> Self {
|
||||||
|
use abi::Float::*;
|
||||||
match fty {
|
match fty {
|
||||||
ty::FloatTy::F16 => F16,
|
ty::FloatTy::F16 => F16,
|
||||||
ty::FloatTy::F32 => F32,
|
ty::FloatTy::F32 => F32,
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
pub use Float::*;
|
use Float::*;
|
||||||
pub use Integer::*;
|
use Primitive::*;
|
||||||
pub use Primitive::*;
|
|
||||||
use rustc_data_structures::intern::Interned;
|
use rustc_data_structures::intern::Interned;
|
||||||
use rustc_macros::HashStable_Generic;
|
use rustc_macros::HashStable_Generic;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
itertools = "0.12"
|
itertools = "0.12"
|
||||||
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_ast_ir = { path = "../rustc_ast_ir" }
|
rustc_ast_ir = { path = "../rustc_ast_ir" }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
rustc_errors = { path = "../rustc_errors" }
|
rustc_errors = { path = "../rustc_errors" }
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
|
use rustc_abi::Float::*;
|
||||||
|
use rustc_abi::Primitive::{Float, Pointer};
|
||||||
|
use rustc_abi::{Abi, AddressSpace, PointerKind, Scalar, Size};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::lang_items::LangItem;
|
use rustc_hir::lang_items::LangItem;
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
@ -14,7 +17,6 @@ use rustc_target::abi::call::{
|
|||||||
ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, Conv, FnAbi, PassMode, Reg, RegKind,
|
ArgAbi, ArgAttribute, ArgAttributes, ArgExtension, Conv, FnAbi, PassMode, Reg, RegKind,
|
||||||
RiscvInterruptKind,
|
RiscvInterruptKind,
|
||||||
};
|
};
|
||||||
use rustc_target::abi::*;
|
|
||||||
use rustc_target::spec::abi::Abi as SpecAbi;
|
use rustc_target::spec::abi::Abi as SpecAbi;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
@ -2,7 +2,12 @@ use std::fmt::Debug;
|
|||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use hir::def_id::DefId;
|
use hir::def_id::DefId;
|
||||||
use rustc_hir as hir;
|
use rustc_abi::Integer::{I8, I32};
|
||||||
|
use rustc_abi::Primitive::{self, Float, Int, Pointer};
|
||||||
|
use rustc_abi::{
|
||||||
|
Abi, AbiAndPrefAlign, AddressSpace, Align, FieldsShape, HasDataLayout, LayoutCalculatorError,
|
||||||
|
LayoutS, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding, Variants, WrappingRange,
|
||||||
|
};
|
||||||
use rustc_index::bit_set::BitSet;
|
use rustc_index::bit_set::BitSet;
|
||||||
use rustc_index::{IndexSlice, IndexVec};
|
use rustc_index::{IndexSlice, IndexVec};
|
||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
@ -18,8 +23,9 @@ use rustc_middle::ty::{
|
|||||||
use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo};
|
use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo};
|
||||||
use rustc_span::sym;
|
use rustc_span::sym;
|
||||||
use rustc_span::symbol::Symbol;
|
use rustc_span::symbol::Symbol;
|
||||||
use rustc_target::abi::*;
|
use rustc_target::abi::{FIRST_VARIANT, FieldIdx, Layout, VariantIdx};
|
||||||
use tracing::{debug, instrument, trace};
|
use tracing::{debug, instrument, trace};
|
||||||
|
use {rustc_abi as abi, rustc_hir as hir};
|
||||||
|
|
||||||
use crate::errors::{
|
use crate::errors::{
|
||||||
MultipleArrayFieldsSimdType, NonPrimitiveSimdType, OversizedSimdType, ZeroLengthSimdType,
|
MultipleArrayFieldsSimdType, NonPrimitiveSimdType, OversizedSimdType, ZeroLengthSimdType,
|
||||||
@ -202,9 +208,9 @@ fn layout_of_uncached<'tcx>(
|
|||||||
value: Int(I32, false),
|
value: Int(I32, false),
|
||||||
valid_range: WrappingRange { start: 0, end: 0x10FFFF },
|
valid_range: WrappingRange { start: 0, end: 0x10FFFF },
|
||||||
})),
|
})),
|
||||||
ty::Int(ity) => scalar(Int(Integer::from_int_ty(dl, ity), true)),
|
ty::Int(ity) => scalar(Int(abi::Integer::from_int_ty(dl, ity), true)),
|
||||||
ty::Uint(ity) => scalar(Int(Integer::from_uint_ty(dl, ity), false)),
|
ty::Uint(ity) => scalar(Int(abi::Integer::from_uint_ty(dl, ity), false)),
|
||||||
ty::Float(fty) => scalar(Float(Float::from_float_ty(fty))),
|
ty::Float(fty) => scalar(Float(abi::Float::from_float_ty(fty))),
|
||||||
ty::FnPtr(..) => {
|
ty::FnPtr(..) => {
|
||||||
let mut ptr = scalar_unit(Pointer(dl.instruction_address_space));
|
let mut ptr = scalar_unit(Pointer(dl.instruction_address_space));
|
||||||
ptr.valid_range_mut().start = 1;
|
ptr.valid_range_mut().start = 1;
|
||||||
@ -563,7 +569,7 @@ fn layout_of_uncached<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let get_discriminant_type =
|
let get_discriminant_type =
|
||||||
|min, max| Integer::repr_discr(tcx, ty, &def.repr(), min, max);
|
|min, max| abi::Integer::repr_discr(tcx, ty, &def.repr(), min, max);
|
||||||
|
|
||||||
let discriminants_iter = || {
|
let discriminants_iter = || {
|
||||||
def.is_enum()
|
def.is_enum()
|
||||||
@ -816,7 +822,7 @@ fn coroutine_layout<'tcx>(
|
|||||||
|
|
||||||
// `info.variant_fields` already accounts for the reserved variants, so no need to add them.
|
// `info.variant_fields` already accounts for the reserved variants, so no need to add them.
|
||||||
let max_discr = (info.variant_fields.len() - 1) as u128;
|
let max_discr = (info.variant_fields.len() - 1) as u128;
|
||||||
let discr_int = Integer::fit_unsigned(max_discr);
|
let discr_int = abi::Integer::fit_unsigned(max_discr);
|
||||||
let tag = Scalar::Initialized {
|
let tag = Scalar::Initialized {
|
||||||
value: Primitive::Int(discr_int, /* signed = */ false),
|
value: Primitive::Int(discr_int, /* signed = */ false),
|
||||||
valid_range: WrappingRange { start: 0, end: max_discr },
|
valid_range: WrappingRange { start: 0, end: max_discr },
|
||||||
|
@ -55,7 +55,7 @@ fi
|
|||||||
# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined,
|
# If runner uses an incompatible option and `FORCE_CI_RUSTC` is not defined,
|
||||||
# switch to in-tree rustc.
|
# switch to in-tree rustc.
|
||||||
if [ "$FORCE_CI_RUSTC" == "" ]; then
|
if [ "$FORCE_CI_RUSTC" == "" ]; then
|
||||||
echo "debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured."
|
echo 'debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.'
|
||||||
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1
|
DISABLE_CI_RUSTC_IF_INCOMPATIBLE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||||||
"pretty-compare-only",
|
"pretty-compare-only",
|
||||||
"pretty-expanded",
|
"pretty-expanded",
|
||||||
"pretty-mode",
|
"pretty-mode",
|
||||||
|
"reference",
|
||||||
"regex-error-pattern",
|
"regex-error-pattern",
|
||||||
"remap-src-base",
|
"remap-src-base",
|
||||||
"revisions",
|
"revisions",
|
||||||
|
37
tests/crashes/130956.rs
Normal file
37
tests/crashes/130956.rs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
//@ known-bug: #130956
|
||||||
|
|
||||||
|
mod impl_trait_mod {
|
||||||
|
use super::*;
|
||||||
|
pub type OpaqueBlock = impl Trait;
|
||||||
|
pub type OpaqueIf = impl Trait;
|
||||||
|
|
||||||
|
pub struct BlockWrapper(OpaqueBlock);
|
||||||
|
pub struct IfWrapper(pub OpaqueIf);
|
||||||
|
|
||||||
|
pub fn if_impl() -> Parser<OpaqueIf> {
|
||||||
|
bind(option(block()), |_| block())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
use impl_trait_mod::*;
|
||||||
|
|
||||||
|
pub trait Trait {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
pub struct Parser<P>(P);
|
||||||
|
pub struct Bind<P, F>(P, F);
|
||||||
|
impl<P, F> Trait for Bind<P, F> { type Assoc = (); }
|
||||||
|
impl Trait for BlockWrapper { type Assoc = (); }
|
||||||
|
impl Trait for IfWrapper { type Assoc = (); }
|
||||||
|
|
||||||
|
pub fn block() -> Parser<BlockWrapper> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
pub fn option<P: Trait>(arg: Parser<P>) -> Parser<impl Trait> {
|
||||||
|
bind(arg, |_| block())
|
||||||
|
}
|
||||||
|
fn bind<P: Trait, P2, F: Fn(P::Assoc) -> Parser<P2>>(_: Parser<P>, _: F) -> Parser<Bind<P, F>>
|
||||||
|
{ loop {} }
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
if_impl().0;
|
||||||
|
}
|
13
tests/crashes/130967.rs
Normal file
13
tests/crashes/130967.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
//@ known-bug: #130967
|
||||||
|
|
||||||
|
trait Producer {
|
||||||
|
type Produced;
|
||||||
|
fn make_one() -> Self::Produced;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E: ?Sized> Producer for () {
|
||||||
|
type Produced = Option<E>;
|
||||||
|
fn make_one() -> Self::Produced {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
15
tests/crashes/131046.rs
Normal file
15
tests/crashes/131046.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//@ known-bug: #131046
|
||||||
|
|
||||||
|
trait Owner {
|
||||||
|
const C<const N: u32>: u32;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Owner for () {
|
||||||
|
const C<const N: u32>: u32 = N;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
take0::<128>(());
|
||||||
|
}
|
7
tests/crashes/131048.rs
Normal file
7
tests/crashes/131048.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//@ known-bug: #131048
|
||||||
|
|
||||||
|
impl<A> std::ops::CoerceUnsized<A> for A {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
format_args!("Hello, world!");
|
||||||
|
}
|
27
tests/crashes/131050.rs
Normal file
27
tests/crashes/131050.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//@ known-bug: #131050
|
||||||
|
//@ compile-flags: --edition=2021
|
||||||
|
|
||||||
|
fn query_as<D>() {}
|
||||||
|
|
||||||
|
async fn create_user() {
|
||||||
|
query_as();
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn post_user_filter() -> impl Filter {
|
||||||
|
AndThen(&(), || async { create_user().await })
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn get_app() -> impl Send {
|
||||||
|
post_user_filter().await
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Filter {}
|
||||||
|
|
||||||
|
struct AndThen<T, F>(T, F);
|
||||||
|
|
||||||
|
impl<T, F, R> Filter for AndThen<T, F>
|
||||||
|
where
|
||||||
|
F: Fn() -> R,
|
||||||
|
R: Send,
|
||||||
|
{
|
||||||
|
}
|
8
tests/crashes/131052.rs
Normal file
8
tests/crashes/131052.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//@ known-bug: #131052
|
||||||
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
|
struct ConstBytes<const T: &'static [*mut u8; 3]>;
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
|
||||||
|
}
|
12
tests/crashes/131101.rs
Normal file
12
tests/crashes/131101.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
//@ known-bug: #131101
|
||||||
|
trait Foo<const N: u8> {
|
||||||
|
fn do_x(&self) -> [u8; N];
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar;
|
||||||
|
|
||||||
|
impl Foo<const 3> for Bar {
|
||||||
|
fn do_x(&self) -> [u8; 3] {
|
||||||
|
[0u8; 3]
|
||||||
|
}
|
||||||
|
}
|
4
tests/crashes/131102.rs
Normal file
4
tests/crashes/131102.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
//@ known-bug: #131102
|
||||||
|
pub struct Blorb<const N: u16>([String; N]);
|
||||||
|
pub struct Wrap(Blorb<0>);
|
||||||
|
pub const fn i(_: Wrap) {}
|
6
tests/crashes/131103.rs
Normal file
6
tests/crashes/131103.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//@ known-bug: #131103
|
||||||
|
struct Struct<const N: i128>(pub [u8; N]);
|
||||||
|
|
||||||
|
pub fn function(value: Struct<3>) -> u8 {
|
||||||
|
value.0[0]
|
||||||
|
}
|
19
tests/crashes/131190.rs
Normal file
19
tests/crashes/131190.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
//@ known-bug: #131190
|
||||||
|
//@ compile-flags: -Cinstrument-coverage --edition=2018
|
||||||
|
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
pub fn block_on<T>(fut: impl Future<Output = T>) -> T {}
|
||||||
|
|
||||||
|
async fn call_once(f: impl async FnOnce(DropMe)) {
|
||||||
|
f(DropMe("world")).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DropMe(&'static str);
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
block_on(async {
|
||||||
|
let async_closure = async move |a: DropMe| {};
|
||||||
|
call_once(async_closure).await;
|
||||||
|
});
|
||||||
|
}
|
16
tests/crashes/131227.rs
Normal file
16
tests/crashes/131227.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//@ known-bug: #131227
|
||||||
|
//@ compile-flags: -Zmir-opt-level=3
|
||||||
|
|
||||||
|
static mut G: () = ();
|
||||||
|
|
||||||
|
fn myfunc() -> i32 {
|
||||||
|
let var = &raw mut G;
|
||||||
|
if var.is_null() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
myfunc();
|
||||||
|
}
|
7
tests/crashes/131292.rs
Normal file
7
tests/crashes/131292.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//@ known-bug: #131292
|
||||||
|
//@ only-x86_64
|
||||||
|
use std::arch::asm;
|
||||||
|
|
||||||
|
unsafe fn f6() {
|
||||||
|
asm!(concat!(r#"lJÆ<F0908FBF>.<>"#, "{}/day{:02}.txt"));
|
||||||
|
}
|
25
tests/crashes/131294-2.rs
Normal file
25
tests/crashes/131294-2.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//@ known-bug: #131294
|
||||||
|
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/rust/issues/131294#issuecomment-2395088049 second comment
|
||||||
|
struct Rows;
|
||||||
|
|
||||||
|
impl Iterator for Rows {
|
||||||
|
type Item = String;
|
||||||
|
|
||||||
|
fn next() -> Option<String> {
|
||||||
|
let args = format_args!("Hello world");
|
||||||
|
|
||||||
|
{
|
||||||
|
match args.as_str() {
|
||||||
|
Some(t) => t.to_owned(),
|
||||||
|
None => String::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Rows.next();
|
||||||
|
}
|
16
tests/crashes/131294.rs
Normal file
16
tests/crashes/131294.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//@ known-bug: #131294
|
||||||
|
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
|
||||||
|
|
||||||
|
struct Rows;
|
||||||
|
|
||||||
|
impl Iterator for Rows {
|
||||||
|
type Item = String;
|
||||||
|
|
||||||
|
fn next() -> Option<Self::Item> {
|
||||||
|
std::fmt::format(format_args!("Hello world")).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Rows.next();
|
||||||
|
}
|
9
tests/crashes/131295.rs
Normal file
9
tests/crashes/131295.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//@ known-bug: #131295
|
||||||
|
|
||||||
|
#![feature(generic_const_exprs)]
|
||||||
|
|
||||||
|
async fn foo<'a>() -> [(); {
|
||||||
|
let _y: &'a ();
|
||||||
|
4
|
||||||
|
}] {
|
||||||
|
}
|
12
tests/crashes/131298.rs
Normal file
12
tests/crashes/131298.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
//@ known-bug: #131298
|
||||||
|
|
||||||
|
fn dyn_hoops<T>() -> *const dyn Iterator<Item = impl Captures> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
|
mod typeck {
|
||||||
|
type Opaque = impl Sized;
|
||||||
|
fn define() -> Opaque {
|
||||||
|
let _: Opaque = super::dyn_hoops::<u8>();
|
||||||
|
}
|
||||||
|
}
|
40
tests/crashes/131342-2.rs
Normal file
40
tests/crashes/131342-2.rs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
//@ known-bug: #131342
|
||||||
|
// see also: 131342.rs
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
problem_thingy(Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Once;
|
||||||
|
|
||||||
|
impl Iterator for Once {
|
||||||
|
type Item = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn problem_thingy(items: impl Iterator) {
|
||||||
|
let peeker = items.peekable();
|
||||||
|
problem_thingy(&peeker);
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Iterator {
|
||||||
|
type Item;
|
||||||
|
|
||||||
|
fn peekable(self) -> Peekable<Self>
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Peekable<I: Iterator> {
|
||||||
|
_peeked: I::Item,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I: Iterator> Iterator for Peekable<I> {
|
||||||
|
type Item = I::Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<I: Iterator + ?Sized> Iterator for &I {
|
||||||
|
type Item = I::Item;
|
||||||
|
}
|
16
tests/crashes/131342.rs
Normal file
16
tests/crashes/131342.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//@ known-bug: #131342
|
||||||
|
// see also: 131342-2.rs
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut items = vec![1, 2, 3, 4, 5].into_iter();
|
||||||
|
problem_thingy(&mut items);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn problem_thingy(items: &mut impl Iterator<Item = u8>) {
|
||||||
|
let mut peeker = items.peekable();
|
||||||
|
match peeker.peek() {
|
||||||
|
Some(_) => (),
|
||||||
|
None => return (),
|
||||||
|
}
|
||||||
|
problem_thingy(&mut peeker);
|
||||||
|
}
|
9
tests/crashes/131347.rs
Normal file
9
tests/crashes/131347.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//@ known-bug: #131347
|
||||||
|
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
|
||||||
|
|
||||||
|
struct S;
|
||||||
|
static STUFF: [i8] = [0; S::N];
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
assert_eq!(STUFF, [0; 63]);
|
||||||
|
}
|
33
tests/crashes/131373.rs
Normal file
33
tests/crashes/131373.rs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//@ known-bug: #131373
|
||||||
|
|
||||||
|
trait LockReference: 'static {
|
||||||
|
type Ref<'a>;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SliceRef<'a, T: ?Sized> {
|
||||||
|
_x: &'a T,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a, T: ?Sized, SR: LockReference> IntoIterator for SliceRef<'a, T>
|
||||||
|
where
|
||||||
|
&'a T: IntoIterator<Item = &'a SR>,
|
||||||
|
{
|
||||||
|
type Item = SR::Ref<'a>;
|
||||||
|
type IntoIter = std::iter::Map<<&'a T as IntoIterator>::IntoIter,
|
||||||
|
for<'c> fn(&'c SR) -> SR::Ref<'c>>;
|
||||||
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LockReference for () {
|
||||||
|
type Ref<'a> = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn locked() -> SliceRef<'static, [()]> {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let _ = locked().into_iter();
|
||||||
|
}
|
12
tests/crashes/131406.rs
Normal file
12
tests/crashes/131406.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
//@ known-bug: #131406
|
||||||
|
|
||||||
|
trait Owner {
|
||||||
|
const C<const N: u32>: u32 = N;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Owner for () {}
|
||||||
|
fn take0<const N: u64>(_: impl Owner<C<N> = { N }>) {}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
take0::<128>(());
|
||||||
|
}
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
//@ ignore-cross-compile (needs to run test binary)
|
//@ ignore-cross-compile (needs to run test binary)
|
||||||
|
|
||||||
|
//@ ignore-apple
|
||||||
|
// FIXME(#131436): on macOS rustc is still reporting the std broken pipe io error panick but it
|
||||||
|
// doesn't fail with 101 exit status (it terminates with a wait status of SIGPIPE). It doesn't say
|
||||||
|
// Internal Compiler Error strangely, but it doesn't even go through normal diagnostic infra. Very
|
||||||
|
// strange.
|
||||||
|
|
||||||
#![feature(anonymous_pipe)]
|
#![feature(anonymous_pipe)]
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
59
tests/ui/layout/post-mono-layout-cycle-2.rs
Normal file
59
tests/ui/layout/post-mono-layout-cycle-2.rs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
//@ build-fail
|
||||||
|
//@ edition: 2021
|
||||||
|
|
||||||
|
#![feature(async_closure, noop_waker)]
|
||||||
|
|
||||||
|
use std::future::Future;
|
||||||
|
use std::pin::pin;
|
||||||
|
use std::task::*;
|
||||||
|
|
||||||
|
pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
|
||||||
|
let mut fut = pin!(fut);
|
||||||
|
// Poll loop, just to test the future...
|
||||||
|
let ctx = &mut Context::from_waker(Waker::noop());
|
||||||
|
|
||||||
|
loop {
|
||||||
|
match fut.as_mut().poll(ctx) {
|
||||||
|
Poll::Pending => {}
|
||||||
|
Poll::Ready(t) => break t,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Blah {
|
||||||
|
async fn iter<T>(&mut self, iterator: T)
|
||||||
|
where
|
||||||
|
T: IntoIterator<Item = ()>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Blah for () {
|
||||||
|
async fn iter<T>(&mut self, iterator: T)
|
||||||
|
//~^ ERROR recursion in an async fn requires boxing
|
||||||
|
where
|
||||||
|
T: IntoIterator<Item = ()>,
|
||||||
|
{
|
||||||
|
Blah::iter(self, iterator).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Wrap<T: Blah> {
|
||||||
|
t: T,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Blah> Wrap<T>
|
||||||
|
where
|
||||||
|
T: Blah,
|
||||||
|
{
|
||||||
|
async fn ice(&mut self) {
|
||||||
|
//~^ ERROR a cycle occurred during layout computation
|
||||||
|
let arr: [(); 0] = [];
|
||||||
|
self.t.iter(arr.into_iter()).await;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
block_on(async {
|
||||||
|
let mut t = Wrap { t: () };
|
||||||
|
t.ice();
|
||||||
|
})
|
||||||
|
}
|
23
tests/ui/layout/post-mono-layout-cycle-2.stderr
Normal file
23
tests/ui/layout/post-mono-layout-cycle-2.stderr
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
error[E0733]: recursion in an async fn requires boxing
|
||||||
|
--> $DIR/post-mono-layout-cycle-2.rs:30:5
|
||||||
|
|
|
||||||
|
LL | / async fn iter<T>(&mut self, iterator: T)
|
||||||
|
LL | |
|
||||||
|
LL | | where
|
||||||
|
LL | | T: IntoIterator<Item = ()>,
|
||||||
|
| |___________________________________^
|
||||||
|
LL | {
|
||||||
|
LL | Blah::iter(self, iterator).await
|
||||||
|
| -------------------------------- recursive call here
|
||||||
|
|
|
||||||
|
= note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
|
||||||
|
|
||||||
|
error: a cycle occurred during layout computation
|
||||||
|
--> $DIR/post-mono-layout-cycle-2.rs:47:5
|
||||||
|
|
|
||||||
|
LL | async fn ice(&mut self) {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0733`.
|
25
tests/ui/layout/post-mono-layout-cycle.rs
Normal file
25
tests/ui/layout/post-mono-layout-cycle.rs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//@ build-fail
|
||||||
|
//~^ cycle detected when computing layout of `Wrapper<()>`
|
||||||
|
|
||||||
|
trait Trait {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Trait for () {
|
||||||
|
type Assoc = Wrapper<()>;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Wrapper<T: Trait> {
|
||||||
|
_x: <T as Trait>::Assoc,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn abi<T: Trait>(_: Option<Wrapper<T>>) {}
|
||||||
|
//~^ ERROR a cycle occurred during layout computation
|
||||||
|
|
||||||
|
fn indirect<T: Trait>() {
|
||||||
|
abi::<T>(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
indirect::<()>();
|
||||||
|
}
|
16
tests/ui/layout/post-mono-layout-cycle.stderr
Normal file
16
tests/ui/layout/post-mono-layout-cycle.stderr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
error[E0391]: cycle detected when computing layout of `Wrapper<()>`
|
||||||
|
|
|
||||||
|
= note: ...which requires computing layout of `<() as Trait>::Assoc`...
|
||||||
|
= note: ...which again requires computing layout of `Wrapper<()>`, completing the cycle
|
||||||
|
= note: cycle used when computing layout of `core::option::Option<Wrapper<()>>`
|
||||||
|
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
|
||||||
|
|
||||||
|
error: a cycle occurred during layout computation
|
||||||
|
--> $DIR/post-mono-layout-cycle.rs:16:1
|
||||||
|
|
|
||||||
|
LL | fn abi<T: Trait>(_: Option<Wrapper<T>>) {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0391`.
|
Loading…
x
Reference in New Issue
Block a user