-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
(hand reduced & simplified)
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
pub type PubAlias0 = PubTy::PrivAssocTy;
pub struct PubTy;
impl PubTy {
type PrivAssocTy = ();
}
pub struct S(pub PubAlias0);
pub unsafe fn foo(a: S) -> S {
a
}
fn main() {}
original code
//@ check-pass
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
#![crate_type = "lib"]
pub type PubAlias0 = PubTy::PrivAssocTy;
//~^ WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
pub type PubAlias1 = PrivTy::PubAssocTy;
//~^ WARNING type `PrivTy` is more private than the item `PubAlias1`
pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>;
//~^ WARNING type `PrivTy` is more private than the item `PubAlias2`
pub struct PubTy;
impl PubTy {
type PrivAssocTy = ();
pub type PubAssocTy<T> = T;
}
struct PrivTy;
impl PrivTy {
pub type PubAssocTy = ();
}
//~ ERROR the parameter type `Self` may not live long enough
trait GatTrait {
type Gat<'a>
where
Self: 'a;
}
trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> {
fn c(&self) -> dyn SuperTrait<T>;
//~^ ERROR associated item referring to unboxed trait object for its own trait
//~| ERROR the trait `SuperTrait` cannot be made into an object
}
fn main() {}
//@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]
#![feature(repr_simd, intrinsics)]
#![allow(non_camel_case_types)]
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x2(pub f32, pub f32);
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x8(pub f32, pub f32, pub f32, pub f32,
pub f32, pub f32, pub f32, pub f32);
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f32x16(pub f32, pub f32, pub f32, pub T,
pub f32, pub f32, pub f32, pub f32,
pub f32, pub f32, pub f32, pub f32,
pub f32, pub f32, pub f32, pub f32);
extern "rust-intrinsic" {
fn simd_fsin<T>(x: T) -> T;
}
// CHECK-LABEL: @fsin_32x2
#[no_mangle]
pub unsafe fn fsin_32x2(a: f32x2) -> f32x2 {
// CHECK: call <2 x float> @llvm.sin.v2f32
simd_fsin(a)
}
// CHECK-LABEL: @fsin_32x4
#[no_mangle]
pub unsafe fn fsin_32x4(a: f32x4) -> f32x4 {
// CHECK: call <4 x float> @llvm.sin.v4f32
simd_fsin(a)
}
// CHECK-LABEL: @fsin_32x8
#[no_mangle]
pub unsafe fn fsin_32x8(a: f32x8) -> f32x8 {
// CHECK: call <8 x float> @llvm.sin.v8f32
simd_fsin(a)
}
// CHECK-LABEL: @fsin_32x16
#[no_mangle]
pub unsafe fn fsin_32x16(a: f32x16) -> f32x16 {
// CHECK: call <16 x float> @llvm.sin.v16f32
simd_fsin(a)
}
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f64x2(pub f64, pub f64);
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f64x4(pub f64, pub PubAlias0, pub f64, pub f64);
#[repr(simd)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct f64x8(pub f64, pub f64, pub f64, pub f64,
pub f64, pub f64, pub f64, pub f64);
// CHECK-LABEL: @fsin_64x4
#[no_mangle]
pub unsafe fn fsin_64x4(a: f64x4) -> f64x4 {
// CHECK: call <4 x double> @llvm.sin.v4f64
simd_fsin(a)
}
// CHECK-LABEL: @fsin_64x2
#[no_mangle]
pub unsafe fn fsin_64x2(a: f64x2) -> f64x2 {
// CHECK: call <2 x double> @llvm.sin.v2f64
simd_fsin(a)
}
// CHECK-LABEL: @fsin_64x8
#[no_mangle]
pub unsafe fn fsin_64x8(a: f64x8) -> f64x8 {
// CHECK: call <8 x double> @llvm.sin.v8f64
simd_fsin(a)
}
Meta
rustc --version --verbose
:
rustc 1.80.0-nightly (f67a1acc0 2024-06-01)
binary: rustc
commit-hash: f67a1acc04c7ecbf05751b17592dd8d245b75256
commit-date: 2024-06-01
host: aarch64-apple-darwin
release: 1.80.0-nightly
LLVM version: 18.1.6
Error output
Command: rustc
<output>
Backtrace
error: internal compiler error: compiler/rustc_middle/src/ty/inhabitedness/mod.rs:134:17: unimplemented: inhabitedness checking for inherent projections
thread 'rustc' panicked at compiler/rustc_middle/src/ty/inhabitedness/mod.rs:134:17:
Box<dyn Any>
stack backtrace:
0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
5: rustc_middle::util::bug::bug_fmt
6: <rustc_middle::ty::Ty>::inhabited_predicate
7: <&mut <rustc_middle::ty::VariantDef>::inhabited_predicate::{closure#0} as core::ops::function::FnOnce<(&rustc_middle::ty::FieldDef,)>>::call_once
8: <rustc_middle::ty::inhabitedness::inhabited_predicate::InhabitedPredicate>::all::<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::FieldDef>, <rustc_middle::ty::VariantDef>::inhabited_predicate::{closure#0}>>
9: <rustc_middle::ty::inhabitedness::inhabited_predicate::InhabitedPredicate>::any::<core::iter::adapters::map::Map<core::slice::iter::Iter<rustc_middle::ty::VariantDef>, rustc_middle::ty::inhabitedness::inhabited_predicate_adt::{closure#0}>>
10: rustc_middle::ty::inhabitedness::inhabited_predicate_adt
[... omitted 2 frames ...]
11: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>>
12: rustc_middle::ty::inhabitedness::inhabited_predicate_type
[... omitted 2 frames ...]
13: <rustc_middle::ty::Ty>::inhabited_predicate
14: <rustc_pattern_analysis::rustc::RustcPatCtxt>::ctors_for_ty
15: rustc_pattern_analysis::usefulness::compute_exhaustiveness_and_usefulness::<rustc_pattern_analysis::rustc::RustcPatCtxt>
16: rustc_pattern_analysis::usefulness::compute_match_usefulness::<rustc_pattern_analysis::rustc::RustcPatCtxt>
17: rustc_pattern_analysis::analyze_match
18: <rustc_mir_build::thir::pattern::check_match::MatchVisitor>::analyze_patterns
19: <rustc_mir_build::thir::pattern::check_match::MatchVisitor>::check_binding_is_irrefutable
20: rustc_mir_build::thir::pattern::check_match::check_match
[... omitted 2 frames ...]
21: rustc_mir_build::build::mir_build
22: rustc_mir_transform::mir_built
[... omitted 2 frames ...]
23: rustc_mir_build::check_unsafety::check_unsafety
[... omitted 2 frames ...]
24: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
25: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::enabled::par_for_each_in<&rustc_span::def_id::LocalDefId, &[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
26: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#1}>
27: rustc_interface::passes::analysis
[... omitted 2 frames ...]
28: <rustc_interface::queries::QueryResult<&rustc_middle::ty::context::GlobalCtxt>>::enter::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#3}>
29: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
30: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: please make sure that you have updated to the latest nightly
note: please attach the file at `/Users/jisukbyun/workspace/240601_100chaos_tree_combine_typ/icefiles/rustc-ice-2024-06-02T06_32_04-2403.txt` to your bug report
query stack during panic:
#0 [inhabited_predicate_adt] computing the uninhabited predicate of `DefId(0:8 ~ r_inhab_E562D7[ad83]::S)`
#1 [inhabited_predicate_type] computing the uninhabited predicate of `S`
#2 [check_match] match-checking `foo`
#3 [mir_built] building MIR for `foo`
#4 [check_unsafety] unsafety-checking `foo`
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error
Note
- ICE location:
rustc_middle/src/ty/inhabitedness/mod.rs L134
rust/compiler/rustc_middle/src/ty/inhabitedness/mod.rs
Lines 130 to 135 in f67a1ac
// FIXME(inherent_associated_types): Most likely we can just map to `GenericType` like above. // However it's unclear if the args passed to `InhabitedPredicate::instantiate` are of the correct // format, i.e. don't contain parent args. If you hit this case, please verify this beforehand. Alias(ty::Inherent, _) => { bug!("unimplemented: inhabitedness checking for inherent projections") }
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-inherent_associated_types`#![feature(inherent_associated_types)]``#![feature(inherent_associated_types)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Status
Done