Skip to content

adt_const_params: ICE when using reference to user-defined unsized type as const generic #119299

Description

@fcard

Code

#![feature(adt_const_params)]
#![allow(incomplete_features)]

use std::marker::ConstParamTy;

#[derive(Eq, PartialEq)]
struct ConstStrU(*const u8, usize);

impl ConstParamTy for &'static ConstStrU {}

impl ConstStrU {
  const fn from_bytes(bytes: &'static [u8]) -> Self {
    Self(bytes.as_ptr(), bytes.len())
  }
}

const fn chars_s<const S: &'static ConstStrU>() -> [char; 3] {
  ['a','b','c']
}

fn main() {
  const A: &'static ConstStrU = &ConstStrU::from_bytes(b"abc");
  chars_s::<A>();
}

Removing the pointer from ConstStrU unbreaks the code.

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (3d0e6bed6 2023-12-21)
binary: rustc
commit-hash: 3d0e6bed600c0175628e96f1118293cf44fb97bd
commit-date: 2023-12-21
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Error output

error: internal compiler error: no errors encountered even though `span_delayed_bug` issued

error: internal compiler error: `ty::Const::eval` called on a non-valtree-compatible type
  |
  = note: delayed at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/compiler/rustc_middle/src/ty/consts.rs:325:38
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic_without_consuming
             1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             2: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
             3: <rustc_middle::ty::consts::Const>::eval.cold.0
             4: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
             5: <&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection::traits::project::AssocTypeNormalizer>
             6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::normalize::<&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg>>
             7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::instantiate_value_path
             8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_path
             9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
            10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            13: rustc_hir_typeck::check::check_fn
            14: rustc_hir_typeck::typeck
            15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            17: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
            18: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}
            19: rustc_hir_analysis::check_crate
            20: rustc_interface::passes::analysis
            21: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            23: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            24: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
            25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
            28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
            29: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/std/src/sys/unix/thread.rs:108:17
            30: start_thread
                       at ./nptl/pthread_create.c:444:8
            31: __GI___clone3
                       at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
          

error: internal compiler error: `ty::Const::eval` called on a non-valtree-compatible type
  |
  = note: delayed at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/compiler/rustc_middle/src/ty/consts.rs:325:38
             0: <rustc_errors::DiagCtxtInner>::emit_diagnostic_without_consuming
             1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
             2: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
             3: <rustc_middle::ty::consts::Const>::eval.cold.0
             4: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
             5: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
             6: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
             7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
             8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
             9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            12: rustc_hir_typeck::check::check_fn
            13: rustc_hir_typeck::typeck
            14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            16: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
            17: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}
            18: rustc_hir_analysis::check_crate
            19: rustc_interface::passes::analysis
            20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            22: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            23: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
            24: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            25: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
            27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
            28: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/std/src/sys/unix/thread.rs:108:17
            29: start_thread
                       at ./nptl/pthread_create.c:444:8
            30: __GI___clone3
                       at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
          
Backtrace

delayed span bug: `ty::Const::eval` called on a non-valtree-compatible type
   0: <rustc_errors::DiagCtxtInner>::emit_diagnostic_without_consuming
   1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
   2: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
   3: <rustc_middle::ty::consts::Const>::eval.cold.0
   4: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
   5: <&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection::traits::project::AssocTypeNormalizer>
   6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::normalize::<&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg>>
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::instantiate_value_path
   8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_path
   9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
  10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  13: rustc_hir_typeck::check::check_fn
  14: rustc_hir_typeck::typeck
  15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
  16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  17: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  18: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}
  19: rustc_hir_analysis::check_crate
  20: rustc_interface::passes::analysis
  21: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
  22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  23: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  24: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
  25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
  28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
  29: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/std/src/sys/unix/thread.rs:108:17
  30: start_thread
             at ./nptl/pthread_create.c:444:8
  31: __GI___clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

delayed span bug: `ty::Const::eval` called on a non-valtree-compatible type
   0: <rustc_errors::DiagCtxtInner>::emit_diagnostic_without_consuming
   1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
   2: <rustc_errors::DiagCtxt>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
   3: <rustc_middle::ty::consts::Const>::eval.cold.0
   4: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
   5: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
   6: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
   8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_call
   9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  12: rustc_hir_typeck::check::check_fn
  13: rustc_hir_typeck::typeck
  14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
  15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  16: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  17: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}
  18: rustc_hir_analysis::check_crate
  19: rustc_interface::passes::analysis
  20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
  21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  22: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  23: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
  24: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  25: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
  27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/alloc/src/boxed.rs:2015:9
  28: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/3d0e6bed600c0175628e96f1118293cf44fb97bd/library/std/src/sys/unix/thread.rs:108:17
  29: start_thread
             at ./nptl/pthread_create.c:444:8
  30: __GI___clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78



rustc version: 1.77.0-nightly (3d0e6bed6 2023-12-21)
platform: x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Activity

  1. added
    C-bugCategory: This is a bug.
    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.
    on Dec 25, 2023
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 25, 2023
  3. sjwang05 commented on Dec 25, 2023

    @sjwang05
    Contributor

    Regression in nightly-2023-06-03

    found 9 bors merge commits in the specified range
    commit[0] 2023-06-01: Auto merge of #111660 - Kobzol:try-build-skip-docs, r=mark-simulacrum
    commit[1] 2023-06-01: Auto merge of #112184 - matthiaskrgr:rollup-tlh72el, r=matthiaskrgr
    commit[2] 2023-06-02: Auto merge of #111553 - cjgillot:mir-e2e, r=scottmcm
    commit[3] 2023-06-02: Auto merge of #111677 - fee1-dead-contrib:rustc_const_eval-translatable, r=oli-obk,RalfJung
    commit[4] 2023-06-02: Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errors
    commit[5] 2023-06-02: Auto merge of #112203 - flip1995:clippyup, r=Manishearth
    commit[6] 2023-06-02: Auto merge of #112152 - jyn514:doc-msg, r=clubby789
    commit[7] 2023-06-02: Auto merge of #112212 - matthiaskrgr:rollup-e5ilgf0, r=matthiaskrgr
    commit[8] 2023-06-02: Auto merge of #112162 - nnethercote:clarify-mono-item-usage, r=wesleywiser
    ERROR: no CI builds available between d59363a and dd5d7c7 within last 167 days

  4. Luk-ESC commented on Dec 29, 2023

    @Luk-ESC
    Contributor

    Minimized:

    #![feature(adt_const_params)]
    #![allow(incomplete_features)]
    
    use std::marker::ConstParamTy;
    
    #[derive(Eq, PartialEq)]
    struct Wrapper(*const ());
    
    impl ConstParamTy for &'static Wrapper {}
    
    fn take_const<const W: &'static Wrapper>() {}
    
    fn main() {
      const W: &Wrapper = &Wrapper(&());
      
      take_const::<W>();
    }

    You can't impl ConstParamTy for Wrapper because *const _ is not ConstParamTy, but you can impl<'a> ConstParamTy for &'a Wrapper, which should not be allowed

  5. RalfJung commented on Jan 12, 2024

    @RalfJung
    Member

    Indeed, what should happen here is that the code errors because you can't impl ConstParamTy for a type that contains a raw pointer.

    Cc @lcnr

  6. RalfJung commented on Jan 12, 2024

    @RalfJung
    Member

    Ah, in fact this is a duplicate of #112124.

  7. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions