Skip to content

ICE: Failed to normalize Alias(Weak, AliasTy { with feature(lazy_type_alias) #127351

Description

@Naserume

Code

#![feature(lazy_type_alias)]
#![allow(incomplete_features)]

struct Outer0<'a, T>(ExplicitTypeOutlives<'a, T>);
type ExplicitTypeOutlives<'a, T: 'a> = (&'a (), T);

pub struct Warns {
    _significant_drop: ExplicitTypeOutlives,
    field: String,
}

pub fn test(w: Warns) {
    _ = || drop(w.field);
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (cc8da78a0 2024-07-04)
binary: rustc
commit-hash: cc8da78a036dc3c15c35a97651b02af9a6d30c1e
commit-date: 2024-07-04
host: x86_64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7

Error output

error[E0106]: missing lifetime specifier
 --> ./E9199.rs:8:24
  |
8 |     _significant_drop: ExplicitTypeOutlives,
  |                        ^^^^^^^^^^^^^^^^^^^^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
7 ~ pub struct Warns<'a> {
8 ~     _significant_drop: ExplicitTypeOutlives<'a>,
  |

error[E0107]: missing generics for type alias `ExplicitTypeOutlives`
 --> ./E9199.rs:8:24
  |
8 |     _significant_drop: ExplicitTypeOutlives,
  |                        ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
  |
note: type alias defined here, with 1 generic parameter: `T`
 --> ./E9199.rs:5:6
  |
5 | type ExplicitTypeOutlives<'a, T: 'a> = (&'a (), T);
  |      ^^^^^^^^^^^^^^^^^^^^     -
help: add missing generic argument
  |
8 |     _significant_drop: ExplicitTypeOutlives<T>,
  |                                            +++

Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90: Failed to normalize Alias(Weak, AliasTy { args: ['{erased}, {type error}], def_id: DefId(0:8 ~ E9199[ca39]::ExplicitTypeOutlives) }), maybe try to call `try_normalize_erasing_regions` instead

thread 'rustc' panicked at compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:168:90:
Box<dyn Any>
stack backtrace:
   0:        0x1094f2d93 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfeb614152c5fc770
   1:        0x10953e17b - core::fmt::write::h19d9b55d1716a641
   2:        0x1094e8b7e - std::io::Write::write_fmt::h65bfd6c063c93506
   3:        0x1094f2b81 - std::sys::backtrace::print::h6f13abc1d63a7b7a
   4:        0x1094f5959 - std::panicking::default_hook::{{closure}}::h53504a5e8286ae49
   5:        0x1094f56da - std::panicking::default_hook::h46ce4737ada06aa6
   6:        0x1127eb07c - std[96ba86566161595a]::panicking::update_hook::<alloc[d7368e4144f22d76]::boxed::Box<rustc_driver_impl[d6cc6074f4ffa8bf]::install_ice_hook::{closure#0}>>::{closure#0}
   7:        0x1094f6699 - std::panicking::rust_panic_with_hook::h3ebbbfeff58c5313
   8:        0x11285f177 - std[96ba86566161595a]::panicking::begin_panic::<rustc_errors[8113839328e8a1a6]::ExplicitBug>::{closure#0}
   9:        0x11284afb9 - std[96ba86566161595a]::sys::backtrace::__rust_end_short_backtrace::<std[96ba86566161595a]::panicking::begin_panic<rustc_errors[8113839328e8a1a6]::ExplicitBug>::{closure#0}, !>
  10:        0x117284fc9 - std[96ba86566161595a]::panicking::begin_panic::<rustc_errors[8113839328e8a1a6]::ExplicitBug>
  11:        0x1128712b6 - <rustc_errors[8113839328e8a1a6]::diagnostic::BugAbort as rustc_errors[8113839328e8a1a6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:        0x113516315 - rustc_middle[3507220e01ce78dc]::util::bug::opt_span_bug_fmt::<rustc_span[9a6059d5c98a4f34]::span_encoding::Span>::{closure#0}
  13:        0x1134cbf57 - rustc_middle[3507220e01ce78dc]::ty::context::tls::with_opt::<rustc_middle[3507220e01ce78dc]::util::bug::opt_span_bug_fmt<rustc_span[9a6059d5c98a4f34]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:        0x1134cba95 - rustc_middle[3507220e01ce78dc]::ty::context::tls::with_context_opt::<rustc_middle[3507220e01ce78dc]::ty::context::tls::with_opt<rustc_middle[3507220e01ce78dc]::util::bug::opt_span_bug_fmt<rustc_span[9a6059d5c98a4f34]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:        0x11734862b - rustc_middle[3507220e01ce78dc]::util::bug::bug_fmt
  16:        0x11379fd3b - <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::move_paths_for_fields
  17:        0x11379fe7a - <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::open_drop_for_adt_contents
  18:        0x11379e2cb - <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::elaborate_drop
  19:        0x1137ef038 - <alloc[d7368e4144f22d76]::vec::Vec<rustc_middle[3507220e01ce78dc]::mir::BasicBlock> as alloc[d7368e4144f22d76]::vec::spec_from_iter_nested::SpecFromIterNested<rustc_middle[3507220e01ce78dc]::mir::BasicBlock, core[677ae2db44f68e98]::iter::adapters::chain::Chain<core[677ae2db44f68e98]::iter::sources::once::Once<rustc_middle[3507220e01ce78dc]::mir::BasicBlock>, core[677ae2db44f68e98]::iter::adapters::map::Map<core[677ae2db44f68e98]::iter::adapters::zip::Zip<core[677ae2db44f68e98]::iter::adapters::rev::Rev<core[677ae2db44f68e98]::slice::iter::Iter<(rustc_middle[3507220e01ce78dc]::mir::syntax::Place, core[677ae2db44f68e98]::option::Option<rustc_mir_dataflow[ed1ee99526287f86]::move_paths::MovePathIndex>)>>, core[677ae2db44f68e98]::slice::iter::Iter<rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::Unwind>>, <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::drop_halfladder::{closure#0}>>>>::from_iter
  20:        0x11379d340 - <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::drop_ladder
  21:        0x11379f180 - <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::open_drop_for_tuple
  22:        0x11379e239 - <rustc_mir_dataflow[ed1ee99526287f86]::elaborate_drops::DropCtxt<rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::Elaborator>>::elaborate_drop
  23:        0x1138b86c0 - <rustc_mir_transform[7f80daa91ef18b2a]::elaborate_drops::ElaborateDrops as rustc_middle[3507220e01ce78dc]::mir::MirPass>::run_pass
  24:        0x1137fd2ba - rustc_mir_transform[7f80daa91ef18b2a]::pass_manager::run_passes_inner
  25:        0x1138ae364 - rustc_mir_transform[7f80daa91ef18b2a]::run_analysis_to_runtime_passes
  26:        0x1138adeb7 - rustc_mir_transform[7f80daa91ef18b2a]::mir_drops_elaborated_and_const_checked
  27:        0x113eab7ac - rustc_query_impl[e04fdc29b284e1d7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e04fdc29b284e1d7]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 8usize]>>
  28:        0x113d2265e - rustc_query_system[31cd079b68d87400]::query::plumbing::try_execute_query::<rustc_query_impl[e04fdc29b284e1d7]::DynamicConfig<rustc_query_system[31cd079b68d87400]::query::caches::VecCache<rustc_hir[2175b85699631de1]::hir_id::OwnerId, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e04fdc29b284e1d7]::plumbing::QueryCtxt, false>
  29:        0x113ebca2b - rustc_query_impl[e04fdc29b284e1d7]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  30:        0x113162a98 - rustc_interface[dea1eaaf15b0b7c8]::passes::run_required_analyses
  31:        0x1131647f0 - rustc_interface[dea1eaaf15b0b7c8]::passes::analysis
  32:        0x113eabeac - rustc_query_impl[e04fdc29b284e1d7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e04fdc29b284e1d7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 1usize]>>
  33:        0x113c8ac1e - rustc_query_system[31cd079b68d87400]::query::plumbing::try_execute_query::<rustc_query_impl[e04fdc29b284e1d7]::DynamicConfig<rustc_query_system[31cd079b68d87400]::query::caches::SingleCache<rustc_middle[3507220e01ce78dc]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e04fdc29b284e1d7]::plumbing::QueryCtxt, false>
  34:        0x113eb6407 - rustc_query_impl[e04fdc29b284e1d7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:        0x112794bb7 - <rustc_interface[dea1eaaf15b0b7c8]::queries::QueryResult<&rustc_middle[3507220e01ce78dc]::ty::context::GlobalCtxt>>::enter::<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
  36:        0x1127f23cb - rustc_interface[dea1eaaf15b0b7c8]::interface::run_compiler::<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}>::{closure#1}
  37:        0x1127dc9f1 - std[96ba86566161595a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_with_globals<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_pool_with_globals<rustc_interface[dea1eaaf15b0b7c8]::interface::run_compiler<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}>::{closure#1}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>
  38:        0x1127f8d96 - <<std[96ba86566161595a]::thread::Builder>::spawn_unchecked_<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_with_globals<rustc_interface[dea1eaaf15b0b7c8]::util::run_in_thread_pool_with_globals<rustc_interface[dea1eaaf15b0b7c8]::interface::run_compiler<core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>, rustc_driver_impl[d6cc6074f4ffa8bf]::run_compiler::{closure#0}>::{closure#1}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[677ae2db44f68e98]::result::Result<(), rustc_span[9a6059d5c98a4f34]::ErrorGuaranteed>>::{closure#2} as core[677ae2db44f68e98]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:        0x1094ff83b - std::sys::pal::unix::thread::Thread::new::thread_start::he8797374daece752
  40:     0x7ff801f5318b - __pthread_start

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/240703-nightly/rustc-ice-2024-07-05T01_57_08-90724.txt` to your bug report

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0106, E0107.
For more information about an error, try `rustc --explain E0106`.

Note

Ice location:

impl<'tcx> NormalizeAfterErasingRegionsFolder<'tcx> {
fn normalize_generic_arg_after_erasing_regions(
&self,
arg: ty::GenericArg<'tcx>,
) -> ty::GenericArg<'tcx> {
let arg = self.param_env.and(arg);
self.tcx.try_normalize_generic_arg_after_erasing_regions(arg).unwrap_or_else(|_| bug!(
"Failed to normalize {:?}, maybe try to call `try_normalize_erasing_regions` instead",
arg.value
))
}
}

@rustbot label +F-lazy_type_alias +requires-incomplete-features

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-checked_type_aliases`#![feature(checked_type_aliases)]` (formerly: `lazy_type_alias`)I-ICEIssue: 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.S-has-bisectionStatus: A bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions