Skip to content

ICE: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:381:17: encountered a fresh type during canonicalization #80678

Closed
@chengniansun

Description

@chengniansun

Code

trait Bar = PartialEq;
fn main() {
    a: Bar
}

Meta

rustc --version --verbose:

rustc 1.51.0-nightly (80184183b 2021-01-03)
binary: rustc
commit-hash: 80184183ba0a53aa4f491753de9502acd3d6920c
commit-date: 2021-01-03
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly

Error output

error[E0425]: cannot find value `a` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:5
  |
3 |     a: Bar
  |     ^ expecting a type here because of type ascription

error[E0658]: trait aliases are experimental
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | trait Bar = PartialEq;
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
  = help: add `#![feature(trait_alias)]` to the crate attributes to enable

warning: trait objects without an explicit `dyn` are deprecated
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:8
  |
3 |     a: Bar
  |        ^^^ help: use `dyn`: `dyn Bar`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:381:17: encountered a fresh type during canonicalization

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958: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.51.0-nightly (80184183b 2021-01-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

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

error[E0425]: cannot find value `a` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:5
  |
3 |     a: Bar
  |     ^ expecting a type here because of type ascription

error[E0658]: trait aliases are experimental
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | trait Bar = PartialEq;
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
  = help: add `#![feature(trait_alias)]` to the crate attributes to enable

warning: trait objects without an explicit `dyn` are deprecated
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:8
  |
3 |     a: Bar
  |        ^^^ help: use `dyn`: `dyn Bar`
  |
  = note: `#[warn(bare_trait_objects)]` on by default

error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:381:17: encountered a fresh type during canonicalization

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::ty::context::tls::with_opt
   4: rustc_middle::util::bug::opt_span_bug_fmt
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_infer::infer::canonical::canonicalizer::Canonicalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
   7: rustc_middle::ty::fold::TypeFoldable::fold_with
   8: <rustc_infer::infer::canonical::canonicalizer::Canonicalizer as rustc_middle::ty::fold::TypeFolder>::fold_binder
   9: rustc_middle::ty::util::fold_list
  10: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
  11: rustc_infer::infer::canonical::canonicalizer::Canonicalizer::canonicalize
  12: rustc_infer::infer::canonical::canonicalizer::<impl rustc_infer::infer::InferCtxt>::canonicalize_response
  13: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::to_ty_saving_user_provided_ty
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  15: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  16: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  17: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  19: rustc_typeck::check::check::check_fn
  20: rustc_infer::infer::InferCtxtBuilder::enter
  21: rustc_typeck::check::typeck
  22: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::get_query_impl
  26: rustc_query_system::query::plumbing::ensure_query_impl
  27: rustc_typeck::check::typeck_item_bodies
  28: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
  29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  30: rustc_data_structures::stack::ensure_sufficient_stack
  31: rustc_query_system::query::plumbing::get_query_impl
  32: rustc_typeck::check_crate
  33: rustc_interface::passes::analysis
  34: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  36: rustc_data_structures::stack::ensure_sufficient_stack
  37: rustc_query_system::query::plumbing::get_query_impl
  38: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  39: rustc_span::with_source_map
  40: rustc_interface::interface::create_compiler_and_run
  41: rustc_span::with_session_globals
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.51.0-nightly (80184183b 2021-01-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions