Skip to content

ICE: compiler/rustc_middle/src/ty/fold.rs:829:17: Trying to collect bound vars with a bound region: DebruijnIndex(0) BoundRegion { var: 0, kind: BrAnon(0) } #85350

Closed
@chengniansun

Description

@chengniansun

Code

impl FnMut(&Context) for 'tcx {
fn print () -> Self :: Output{ }
}

Meta

rustc --version --verbose:

rustc 1.54.0-nightly (1025db84a 2021-05-14)
binary: rustc
commit-hash: 1025db84a68b948139b5adcd55da31bce32da8f3
commit-date: 2021-05-14
host: x86_64-unknown-linux-gnu
release: 1.54.0-nightly
LLVM version: 12.0.1

Error output

error: lifetime in trait object type must be followed by `+`
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |                          ^^^^

error[E0407]: method `print` is not a member of trait `FnMut`
 --> mutant.rs:2:1
  |
2 | fn print () -> Self :: Output{ }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `FnMut`

error[E0412]: cannot find type `Context` in this scope
 --> mutant.rs:1:13
  |
1 | impl FnMut(&Context) for 'tcx {
  |             ^^^^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 | use std::task::Context;
  |

warning: trait objects without an explicit `dyn` are deprecated
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |                          ^^^^ help: use `dyn`: `dyn 'tcx`
  |
  = note: `#[warn(bare_trait_objects)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
  = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>

error[E0601]: `main` function not found in crate `mutant`
 --> mutant.rs:1:1
  |
1 | / impl FnMut(&Context) for 'tcx {
2 | | fn print () -> Self :: Output{ }
3 | | }
  | |_^ consider adding a `main` function to `mutant.rs`

error[E0224]: at least one trait is required for an object type
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |                          ^^^^

error[E0261]: use of undeclared lifetime name `'tcx`
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |     -                    ^^^^ undeclared lifetime
  |     |
  |     help: consider introducing lifetime `'tcx` here: `<'tcx>`
  |
  = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0229]: associated type bindings are not allowed here
 --> mutant.rs:1:6
  |
1 | impl FnMut(&Context) for 'tcx {
  |      ^^^^^^^^^^^^^^^ associated type not allowed here

error: internal compiler error: compiler/rustc_middle/src/ty/fold.rs:829:17: Trying to collect bound vars with a bound region: DebruijnIndex(0) BoundRegion { var: 0, kind: BrAnon(0) }

thread 'rustc' panicked at 'Box<Any>', /rustc/1025db84a68b948139b5adcd55da31bce32da8f3/library/std/src/panic.rs:59:5
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.54.0-nightly (1025db84a 2021-05-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_sig] computing function signature of `<impl at mutant.rs:1:1: 3:2>::print`
#1 [collect_mod_item_types] collecting item types in top-level module
end of query stack
error: aborting due to 8 previous errors; 1 warning emitted

Some errors have detailed explanations: E0224, E0229, E0261, E0407, E0412, E0601.
For more information about an error, try `rustc --explain E0224`.
Backtrace

error: lifetime in trait object type must be followed by `+`
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |                          ^^^^

error[E0407]: method `print` is not a member of trait `FnMut`
 --> mutant.rs:2:1
  |
2 | fn print () -> Self :: Output{ }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `FnMut`

error[E0412]: cannot find type `Context` in this scope
 --> mutant.rs:1:13
  |
1 | impl FnMut(&Context) for 'tcx {
  |             ^^^^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 | use std::task::Context;
  |

warning: trait objects without an explicit `dyn` are deprecated
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |                          ^^^^ help: use `dyn`: `dyn 'tcx`
  |
  = note: `#[warn(bare_trait_objects)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
  = note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>

error[E0601]: `main` function not found in crate `mutant`
 --> mutant.rs:1:1
  |
1 | / impl FnMut(&Context) for 'tcx {
2 | | fn print () -> Self :: Output{ }
3 | | }
  | |_^ consider adding a `main` function to `mutant.rs`

error[E0224]: at least one trait is required for an object type
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |                          ^^^^

error[E0261]: use of undeclared lifetime name `'tcx`
 --> mutant.rs:1:26
  |
1 | impl FnMut(&Context) for 'tcx {
  |     -                    ^^^^ undeclared lifetime
  |     |
  |     help: consider introducing lifetime `'tcx` here: `<'tcx>`
  |
  = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes

error[E0229]: associated type bindings are not allowed here
 --> mutant.rs:1:6
  |
1 | impl FnMut(&Context) for 'tcx {
  |      ^^^^^^^^^^^^^^^ associated type not allowed here

error: internal compiler error: compiler/rustc_middle/src/ty/fold.rs:829:17: Trying to collect bound vars with a bound region: DebruijnIndex(0) BoundRegion { var: 0, kind: BrAnon(0) }

thread 'rustc' panicked at 'Box<Any>', /rustc/1025db84a68b948139b5adcd55da31bce32da8f3/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with
   8: <rustc_middle::ty::fold::BoundVarsCollector as rustc_middle::ty::fold::TypeVisitor>::visit_ty
   9: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with
  10: <rustc_middle::ty::fold::BoundVarsCollector as rustc_middle::ty::fold::TypeVisitor>::visit_ty
  11: rustc_middle::ty::sty::Binder<T>::bind
  12: <dyn rustc_typeck::astconv::AstConv>::associated_path_to_ty
  13: <dyn rustc_typeck::astconv::AstConv>::ast_ty_to_ty_inner
  14: <dyn rustc_typeck::astconv::AstConv>::ty_of_fn
  15: rustc_typeck::collect::fn_sig
  16: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::fn_sig>::compute
  17: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  18: rustc_data_structures::stack::ensure_sufficient_stack
  19: rustc_query_system::query::plumbing::force_query_with_job
  20: rustc_query_system::query::plumbing::get_query_impl
  21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::fn_sig
  22: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_impl_item
  23: rustc_middle::hir::map::Map::visit_item_likes_in_module
  24: rustc_typeck::collect::collect_mod_item_types
  25: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  26: rustc_query_system::query::plumbing::force_query_with_job
  27: rustc_query_system::query::plumbing::get_query_impl
  28: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  29: rustc_session::session::Session::track_errors
  30: rustc_typeck::check_crate
  31: rustc_interface::passes::analysis
  32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  33: rustc_data_structures::stack::ensure_sufficient_stack
  34: rustc_query_system::query::plumbing::force_query_with_job
  35: rustc_query_system::query::plumbing::get_query_impl
  36: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  37: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  38: rustc_span::with_source_map
  39: rustc_interface::interface::create_compiler_and_run
  40: 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.54.0-nightly (1025db84a 2021-05-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_sig] computing function signature of `<impl at mutant.rs:1:1: 3:2>::print`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 8 previous errors; 1 warning emitted

Some errors have detailed explanations: E0224, E0229, E0261, E0407, E0412, E0601.
For more information about an error, try `rustc --explain E0224`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions