Skip to content

FulfillmentErrorCode::Project ICE for opaques #233

@lcnr

Description

@lcnr
  • tests/ui/coercion/issue-88097.rs
fn peculiar() -> impl Fn(u8) -> u8 {
    return |x| x + 1
}

this 1) should compile 2) not ICE :3

thread 'rustc' panicked at /home/lcnr/rust/compiler/rustc_type_ir/src/predicate.rs:680:9:
expected a projection
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/788da80fcfcef3f34c90def5baa32813e39a1a41/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/788da80fcfcef3f34c90def5baa32813e39a1a41/library/core/src/panicking.rs:75:14
   2: trait_def_id<rustc_middle::ty::context::TyCtxt>
             at /home/lcnr/rust/compiler/rustc_type_ir/src/predicate.rs:680:9
   3: maybe_detailed_projection_msg
             at /home/lcnr/rust/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1660:44
   4: {closure#1}
             at /home/lcnr/rust/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1537:26
   5: and_then<(rustc_type_ir::predicate::AliasTerm<rustc_middle::ty::context::TyCtxt>, rustc_middle::ty::Term, rustc_middle::ty::Term), (alloc::string::String, rustc_span::span_encoding::Span, core::option::Option<rustc_span::span_encoding::Span>), rustc_trait_selection::error_reporting::traits::fulfillment_errors::{impl#2}::report_projection_error::{closure#0}::{closure_env#1}>
             at /rustc/788da80fcfcef3f34c90def5baa32813e39a1a41/library/core/src/option.rs:1537:24
   6: {closure#0}
             at /home/lcnr/rust/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1536:18
   7: probe<rustc_span::ErrorGuaranteed, rustc_trait_selection::error_reporting::traits::fulfillment_errors::{impl#2}::report_projection_error::{closure_env#0}>
             at /home/lcnr/rust/compiler/rustc_infer/src/infer/snapshot/mod.rs:106:17
   8: report_projection_error
             at /home/lcnr/rust/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:1443:14
   9: report_fulfillment_error
             at /home/lcnr/rust/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:277:22
  10: report_fulfillment_errors
             at /home/lcnr/rust/compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs:228:37
  11: select_obligations_where_possible<rustc_hir_typeck::fallback::{impl#0}::type_inference_fallback::{closure_env#0}>
             at /home/lcnr/rust/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:667:29
  12: type_inference_fallback
             at /home/lcnr/rust/compiler/rustc_hir_typeck/src/fallback.rs:47:14

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

in progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions