Closed
Description
auto-reduced (treereduce-rust):
#![feature(type_alias_impl_trait)]
mod defining_scope {
use super::*;
pub type Alias<T> = impl Sized;
pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
x
}
}
struct Container<T: Trait<U>, U> {
x: <T as Trait<U>>::Assoc,
}
trait Trait<T> {
type Assoc;
}
impl<T> Trait<T> for T {
type Assoc = Box<u32>;
}
impl<T> Trait<T> for defining_scope::Alias<T> {
type Assoc = usize;
}
fn main() {}
original:
//revisions: old next
//[next] compile-flags: -Znext-solver
// A regression test for #105787
//[old] known-bug: #105787
//[old] check-pass
#![feature(type_alias_impl_trait)]
mod defining_scope {
use super::*;
pub type Alias<T> = impl Sized;
pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
x
}
}
struct Container<T: Trait<U>, U> {
x: <T as Trait<U>>::Assoc,
}
trait Trait<T> {
type Assoc;
}
impl<T> Trait<T> for T {
type Assoc = Box<u32>;
}
impl<T> Trait<T> for defining_scope::Alias<T> {
//[next]~^ ERROR conflicting implementations of trait
type Assoc = usize;
}
fn main() {
Default::default()
}
Version information
rustc 1.77.0-nightly (2d7be7393 2023-12-23)
binary: rustc
commit-hash: 2d7be73931e0978c8758a672cc7258b417a7e999
commit-date: 2023-12-23
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
warning: struct `Container` is never constructed
--> /tmp/icemaker_global_tempdir.fzzOAlARA6tK/rustc_testrunner_tmpdir_reporting.utiWfmv9NFbE/mvce.rs:11:8
|
11 | struct Container<T: Trait<U>, U> {
| ^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: function `cast` is never used
--> /tmp/icemaker_global_tempdir.fzzOAlARA6tK/rustc_testrunner_tmpdir_reporting.utiWfmv9NFbE/mvce.rs:6:12
|
6 | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
| ^^^^
error: internal compiler error: no errors encountered even though `span_delayed_bug` issued
error: internal compiler error: unexpected ambiguity: Canonical { value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder { value: TraitPredicate(<T as std::marker::Sized>, polarity:Positive), bound_vars: [] }], reveal: All }, value: AliasTy { args: [T/#0, T/#0], def_id: DefId(0:15 ~ mvce[8437]::Trait::Assoc) } }, max_universe: U0, variables: [] } Canonical { value: QueryResponse { var_values: CanonicalVarValues { var_values: [] }, region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: ^0 } }, max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }] }
|
= note: delayed at compiler/rustc_trait_selection/src/traits/query/normalize.rs:295:34
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic_without_consuming
1: <rustc_errors::DiagCtxt>::emit_diagnostic_without_consuming
2: <rustc_errors::DiagCtxt>::emit_diagnostic
3: <rustc_session::session::Session>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
4: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_ty
5: <rustc_traits::normalize_erasing_regions::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::generic_args::GenericArg>)>>::call_once
6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::try_normalize_generic_arg_after_erasing_regions::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::generic_args::GenericArg>, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
8: rustc_query_impl::query_impl::try_normalize_generic_arg_after_erasing_regions::get_query_non_incr::__rust_end_short_backtrace
9: <rustc_middle::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_ty
10: rustc_ty_utils::needs_drop::needs_drop_raw
11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::needs_drop_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Ty>, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
13: rustc_query_impl::query_impl::needs_drop_raw::get_query_non_incr::__rust_end_short_backtrace
14: <rustc_mir_transform::elaborate_drops::ElaborateDrops as rustc_middle::mir::MirPass>::run_pass
15: rustc_mir_transform::run_analysis_to_runtime_passes
16: rustc_mir_transform::mir_drops_elaborated_and_const_checked
17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
19: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
20: rustc_interface::passes::analysis
21: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
23: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
24: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
25: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
26: <<std::thread::Builder>::spawn_unchecked_<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#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2015:9
28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/alloc/src/boxed.rs:2015:9
29: std::sys::unix::thread::Thread::new::thread_start
at /rustc/2d7be73931e0978c8758a672cc7258b417a7e999/library/std/src/sys/unix/thread.rs:108:17
30: <unknown>
31: <unknown>
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: rustc 1.77.0-nightly (2d7be7393 2023-12-23) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to 2 previous errors; 2 warnings emitted
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.