Skip to content

ICE: compiler/rustc_mir/src/borrow_check/universal_regions.rs:533:26: expected defining type for DefId(0:10 ~ mutant[317d]::{impl#0}::foo::{closure#0}): [type error] #86719

Closed
@chengniansun

Description

@chengniansun

Code

trait Bar {
    type E;
}
impl<S> Bar for S {
    type E = impl ;
    fn foo() -> Self::E {
        |_| true
    }
}

Meta

rustc --version --verbose:

rustc 1.55.0-nightly (a435b49e8 2021-06-28)
binary: rustc
commit-hash: a435b49e86d16e98dcc6595dd471f95e823f41aa
commit-date: 2021-06-28
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1

Error output

error: at least one trait must be specified
 --> mutant.rs:5:14
  |
5 |     type E = impl ;
  |              ^^^^

error[E0407]: method `foo` is not a member of trait `Bar`
 --> mutant.rs:6:5
  |
6 | /     fn foo() -> Self::E {
7 | |         |_| true
8 | |     }
  | |_____^ not a member of trait `Bar`

error[E0658]: `impl Trait` in type aliases is unstable
 --> mutant.rs:5:14
  |
5 |     type E = impl ;
  |              ^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `mutant`
 --> mutant.rs:1:1
  |
1 | / trait Bar {
2 | |     type E;
3 | | }
4 | | impl<S> Bar for S {
... |
8 | |     }
9 | | }
  | |_^ consider adding a `main` function to `mutant.rs`

error[E0282]: type annotations needed
 --> mutant.rs:7:10
  |
7 |         |_| true
  |          ^ consider giving this closure parameter a type

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:533:26: expected defining type for `DefId(0:10 ~ mutant[317d]::{impl#0}::foo::{closure#0})`: `[type error]`
 --> mutant.rs:7:9
  |
7 |         |_| true
  |         ^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/a435b49e86d16e98dcc6595dd471f95e823f41aa/compiler/rustc_errors/src/lib.rs:953:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

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.55.0-nightly (a435b49e8 2021-06-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at mutant.rs:4:1: 9:2>::foo::{closure#0}`
#1 [type_of] computing type of `<impl at mutant.rs:4:1: 9:2>::E::{opaque#0}`
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0282, E0407, E0601, E0658.
For more information about an error, try `rustc --explain E0282`.
Backtrace

error: at least one trait must be specified
 --> mutant.rs:5:14
  |
5 |     type E = impl ;
  |              ^^^^

error[E0407]: method `foo` is not a member of trait `Bar`
 --> mutant.rs:6:5
  |
6 | /     fn foo() -> Self::E {
7 | |         |_| true
8 | |     }
  | |_____^ not a member of trait `Bar`

error[E0658]: `impl Trait` in type aliases is unstable
 --> mutant.rs:5:14
  |
5 |     type E = impl ;
  |              ^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(min_type_alias_impl_trait)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `mutant`
 --> mutant.rs:1:1
  |
1 | / trait Bar {
2 | |     type E;
3 | | }
4 | | impl<S> Bar for S {
... |
8 | |     }
9 | | }
  | |_^ consider adding a `main` function to `mutant.rs`

error[E0282]: type annotations needed
 --> mutant.rs:7:10
  |
7 |         |_| true
  |          ^ consider giving this closure parameter a type

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:533:26: expected defining type for `DefId(0:10 ~ mutant[317d]::{impl#0}::foo::{closure#0})`: `[type error]`
 --> mutant.rs:7:9
  |
7 |         |_| true
  |         ^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/a435b49e86d16e98dcc6595dd471f95e823f41aa/compiler/rustc_errors/src/lib.rs:953:9
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::span_bug
   3: rustc_errors::Handler::span_bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::span_bug_fmt
   7: rustc_mir::borrow_check::universal_regions::UniversalRegions::new
   8: rustc_mir::borrow_check::nll::replace_regions_in_mir
   9: rustc_mir::borrow_check::do_mir_borrowck
  10: rustc_infer::infer::InferCtxtBuilder::enter
  11: rustc_mir::borrow_check::mir_borrowck
  12: core::ops::function::FnOnce::call_once
  13: rustc_query_system::query::plumbing::get_query_impl
  14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
  15: rustc_typeck::collect::type_of::find_opaque_ty_constraints::ConstraintLocator::check
  16: <rustc_typeck::collect::type_of::find_opaque_ty_constraints::ConstraintLocator as rustc_hir::intravisit::Visitor>::visit_expr
  17: rustc_hir::intravisit::Visitor::visit_nested_body
  18: rustc_hir::intravisit::walk_impl_item
  19: rustc_hir::intravisit::Visitor::visit_nested_impl_item
  20: rustc_hir::intravisit::walk_impl_item_ref
  21: rustc_hir::intravisit::walk_item
  22: rustc_typeck::collect::type_of::type_of
  23: rustc_query_system::query::plumbing::get_query_impl
  24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::type_of
  25: rustc_typeck::check::check::check_item_type
  26: rustc_middle::hir::map::Map::visit_item_likes_in_module
  27: rustc_typeck::check::check::check_mod_item_types
  28: rustc_query_system::query::plumbing::get_query_impl
  29: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
  30: rustc_session::utils::<impl rustc_session::session::Session>::time
  31: rustc_typeck::check_crate
  32: rustc_interface::passes::analysis
  33: rustc_query_system::query::plumbing::get_query_impl
  34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  35: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  36: rustc_span::with_source_map
  37: rustc_interface::interface::create_compiler_and_run
  38: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

note: the compiler unexpectedly panicked. this is a bug.

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.55.0-nightly (a435b49e8 2021-06-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at mutant.rs:4:1: 9:2>::foo::{closure#0}`
#1 [type_of] computing type of `<impl at mutant.rs:4:1: 9:2>::E::{opaque#0}`
#2 [check_mod_item_types] checking item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0282, E0407, E0601, E0658.
For more information about an error, try `rustc --explain E0282`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions