Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 opened this issue Jun 29, 2021 · 1 comment · Fixed by #94081
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@chengniansun
Copy link

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`.

@chengniansun chengniansun added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 29, 2021
@jonas-schievink jonas-schievink added the F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` label Jun 29, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Jul 4, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 6, 2021
@FabianWolff
Copy link
Contributor

Could be a duplicate of #83919.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Development

Successfully merging a pull request may close this issue.

5 participants