- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
privacy: normalize associated types before visiting #126076
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
base: master
Are you sure you want to change the base?
Conversation
| rustbot has assigned @compiler-errors. Use  | 
        
          
                compiler/rustc_privacy/src/lib.rs
              
                Outdated
          
        
      | let ty = self.tcx.type_of(self.item_def_id).instantiate_identity(); | ||
|  | ||
| // if `in_assoc_ty`, attempt to normalize `ty` | ||
| let maybe_normalized_ty = if self.in_assoc_ty { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This visitor is supposed to normalize everywhere, not just in associated types.
If that's not possible for some technical reasons, then it's fine to normalize only in a subset of cases, just need to leave an explaining comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, removing the self.in_assoc_ty check caused quite a few unexpected errors (e.g., recursion limit errors). I'll leave a comment to that effect.
I don't quite have the expertise to debug these in short-order, and the narrow issue of normalization in associated types is what's blocking me from releasing zerocopy 0.8. If it's possible to merge this narrow fix before 1.80 branches from master, I'd be quite grateful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're delaying it to 1.81 anyway, let's try out both using the new solver and always trying to normalize, even for non-assoc types.
| The general direction is right, technical details I'll leave to compiler-errors. | 
| I thought I had commented but I guess I didn't. I have a bit of concern about rushing to land this for 1.80 -- beta branches tomorrow, and I'm not confident that this is a sufficient solution to prevent overflows1, and I really want to think about this further. I want to stress that the consequence of getting this wrong means that users will have overflow errors that they simply cannot fix, and we'd likely catch this during beta crater runs and then have to scramble to revert this PR, putting us in the same position as moving carefully. So sorry 😅 I think you'll just need to wait for 1.81 for this. The special casing of this to associated type definitions here also feels kinda artificial. You can easily come up with an example that we'd want to eagerly normalize outside of associated type definitions, e.g.: trait Mirror {
    type Assoc;
}
impl<T> Mirror for T {
    type Assoc = T;
}
pub trait Foo: Iterator<Item = <i32 as Mirror>::Assoc> {}
    // the identity projection ^^^^^^^^^^^^^^^^^^^^^^^I think we can actually just use the new trait solver to avoid the overflows, since we've recently FCP'd policy to use the new trait solver in lints and the like, though I'd want to have a confidence check from @lcnr that this fits that policy. Footnotes
 | 
        
          
                compiler/rustc_privacy/src/lib.rs
              
                Outdated
          
        
      | // Ideally, we would normalize in all circumstances, but doing so | ||
| // currently causes some unexpected type errors. | ||
| let maybe_normalized_ty = if self.in_assoc_ty { | ||
| let param_env = self.tcx.param_env(self.item_def_id); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's actually try using the new trait solver, and do it everywhere. So you'll need to actually do like how @lcnr originally suggested to you 😆
I would also pull this into a helper function so that you can just propagate the error out, then do:
let infcx = tcx.infer_ctxt().with_new_trait_solver(true).build();
let ocx = ObligationCtxt::new(&infcx);
let Ok(ty) = ocx.deeply_normalize(/* more args go here */, ty) else { return Err(()) };
let errors = ocx.select_all_or_error();
if !errors.is_empty() { return Err(()); }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! This narrows us down to a single ICE on tests/ui/const-generics/issues/issue-83288.rs, that can be replicated with:
./x test ui -- tests/ui/const-generics/issues/issue-83288.rs
...which produces an ICE here:
rust/compiler/rustc_infer/src/infer/freshen.rs
Lines 174 to 176 in 3ea5e23
| ty::ConstKind::Bound(..) | ty::ConstKind::Placeholder(_) => { | |
| bug!("unexpected const {:?}", ct) | |
| } | 
The full output is:
error: internal compiler error: compiler/rustc_infer/src/infer/freshen.rs:176:17: unexpected const !1: usize
thread 'rustc' panicked at compiler/rustc_infer/src/infer/freshen.rs:176:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f76a736d0c6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc6f7188f457d2bbd
   1:     0x7f76a73d986b - core::fmt::write::h15210aeb282b288e
   2:     0x7f76a739a809 - std::io::Write::write_fmt::hc5c861224043a6d1
   3:     0x7f76a736ceff - std::sys_common::backtrace::print::hb97fd65c9958399d
   4:     0x7f76a735b229 - std::panicking::default_hook::{{closure}}::h95df17654d61b2c0
   5:     0x7f76a735b031 - std::panicking::default_hook::ha0668ff74803c87a
   6:     0x7f76a7ef1a49 - <alloc[587ff061a4add891]::boxed::Box<rustc_driver_impl[7c407987b01bf8cc]::install_ice_hook::{closure#0}> as core[b901df56f7100974]::ops::function::Fn<(&dyn for<'a, 'b> core[b901df56f7100974]::ops::function::Fn<(&'a core[b901df56f7100974]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[b901df56f7100974]::marker::Sync + core[b901df56f7100974]::marker::Send, &core[b901df56f7100974]::panic::panic_info::PanicInfo)>>::call
   7:     0x7f76a735b6f6 - std::panicking::rust_panic_with_hook::h33328749bace0874
   8:     0x7f76aa9152fb - std[15469114d45899b1]::panicking::begin_panic::<rustc_errors[c87af3ac1f6c8edf]::ExplicitBug>::{closure#0}
   9:     0x7f76aa9152a9 - std[15469114d45899b1]::sys_common::backtrace::__rust_end_short_backtrace::<std[15469114d45899b1]::panicking::begin_panic<rustc_errors[c87af3ac1f6c8edf]::ExplicitBug>::{closure#0}, !>
  10:     0x7f76a7e3abb9 - std[15469114d45899b1]::panicking::begin_panic::<rustc_errors[c87af3ac1f6c8edf]::ExplicitBug>
  11:     0x7f76aa8f9c89 - std[15469114d45899b1]::panic::panic_any::<rustc_errors[c87af3ac1f6c8edf]::ExplicitBug>
  12:     0x7f76aa8f9e86 - <rustc_errors[c87af3ac1f6c8edf]::diagnostic::BugAbort as rustc_errors[c87af3ac1f6c8edf]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  13:     0x7f76aa5ef90a - <rustc_errors[c87af3ac1f6c8edf]::diagnostic::Diag<rustc_errors[c87af3ac1f6c8edf]::diagnostic::BugAbort>>::emit
  14:     0x7f76aa59494c - <rustc_errors[c87af3ac1f6c8edf]::DiagCtxt>::bug::<alloc[587ff061a4add891]::string::String>
  15:     0x7f76aa692b41 - rustc_middle[3225073a0293a413]::util::bug::opt_span_bug_fmt::<rustc_span[90405a0d169ad75f]::span_encoding::Span>::{closure#0}
  16:     0x7f76aa6929dc - rustc_middle[3225073a0293a413]::ty::context::tls::with_opt::<rustc_middle[3225073a0293a413]::util::bug::opt_span_bug_fmt<rustc_span[90405a0d169ad75f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  17:     0x7f76aa692974 - rustc_middle[3225073a0293a413]::ty::context::tls::with_context_opt::<rustc_middle[3225073a0293a413]::ty::context::tls::with_opt<rustc_middle[3225073a0293a413]::util::bug::opt_span_bug_fmt<rustc_span[90405a0d169ad75f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  18:     0x7f76aa692989 - rustc_middle[3225073a0293a413]::ty::context::tls::with_opt::<rustc_middle[3225073a0293a413]::util::bug::opt_span_bug_fmt<rustc_span[90405a0d169ad75f]::span_encoding::Span>::{closure#0}, !>
  19:     0x7f76aa692a7c - rustc_middle[3225073a0293a413]::util::bug::opt_span_bug_fmt::<rustc_span[90405a0d169ad75f]::span_encoding::Span>
  20:     0x7f76a7e24291 - rustc_middle[3225073a0293a413]::util::bug::bug_fmt
  21:     0x7f76a9dc51e6 - <rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener as rustc_type_ir[dca2940381de7990]::fold::TypeFolder<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::fold_const
  22:     0x7f76a9b24969 - <rustc_middle[3225073a0293a413]::ty::generic_args::GenericArg as rustc_type_ir[dca2940381de7990]::fold::TypeFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener>
  23:     0x7f76a999d201 - <&rustc_middle[3225073a0293a413]::ty::list::RawList<(), rustc_middle[3225073a0293a413]::ty::generic_args::GenericArg> as rustc_type_ir[dca2940381de7990]::fold::TypeFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener>
  24:     0x7f76a99ba4dc - <rustc_middle[3225073a0293a413]::ty::predicate::TraitPredicate as rustc_type_ir[dca2940381de7990]::fold::TypeFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener>
  25:     0x7f76a99ada8e - <rustc_middle[3225073a0293a413]::ty::sty::Binder<rustc_middle[3225073a0293a413]::ty::predicate::TraitPredicate> as rustc_type_ir[dca2940381de7990]::fold::TypeSuperFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::super_fold_with::<rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener>
  26:     0x7f76a9a311de - <rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener as rustc_type_ir[dca2940381de7990]::fold::FallibleTypeFolder<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle[3225073a0293a413]::ty::predicate::TraitPredicate>
  27:     0x7f76a99ad88e - <rustc_middle[3225073a0293a413]::ty::sty::Binder<rustc_middle[3225073a0293a413]::ty::predicate::TraitPredicate> as rustc_type_ir[dca2940381de7990]::fold::TypeFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::fold_with::<rustc_infer[3ba290eb763f499]::infer::freshen::TypeFreshener>
  28:     0x7f76a9ada331 - <rustc_trait_selection[141eeb03ef3b9526]::traits::select::SelectionContext>::poly_select
  29:     0x7f76a9ac392d - <rustc_trait_selection[141eeb03ef3b9526]::traits::select::SelectionContext>::select
  30:     0x7f76a932cedb - rustc_traits[1b46a35ab3eb3b6e]::codegen::codegen_select_candidate
  31:     0x7f76a96731cc - rustc_query_impl[7e84afb844c0dc58]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7e84afb844c0dc58]::query_impl::codegen_select_candidate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 16usize]>>
  32:     0x7f76a9687f13 - <rustc_query_impl[7e84afb844c0dc58]::query_impl::codegen_select_candidate::dynamic_query::{closure#2} as core[b901df56f7100974]::ops::function::FnOnce<(rustc_middle[3225073a0293a413]::ty::context::TyCtxt, (rustc_middle[3225073a0293a413]::ty::ParamEnv, rustc_middle[3225073a0293a413]::ty::predicate::TraitRef))>>::call_once
  33:     0x7f76a94331c7 - <std[15469114d45899b1]::thread::local::LocalKey<core[b901df56f7100974]::cell::Cell<*const ()>>>::with::<rustc_middle[3225073a0293a413]::ty::context::tls::enter_context<rustc_query_system[6530a4bac8984ae5]::query::plumbing::execute_job_non_incr<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<(rustc_middle[3225073a0293a413]::ty::ParamEnv, rustc_middle[3225073a0293a413]::ty::predicate::TraitRef), rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 16usize]>>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 16usize]>>
  34:     0x7f76a958054f - rustc_query_system[6530a4bac8984ae5]::query::plumbing::try_execute_query::<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<(rustc_middle[3225073a0293a413]::ty::ParamEnv, rustc_middle[3225073a0293a413]::ty::predicate::TraitRef), rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt, false>
  35:     0x7f76a9688870 - rustc_query_impl[7e84afb844c0dc58]::query_impl::codegen_select_candidate::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f76a8e62abd - rustc_ty_utils[1ee9e922b5e056c8]::instance::resolve_instance
  37:     0x7f76a9666ecc - rustc_query_impl[7e84afb844c0dc58]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7e84afb844c0dc58]::query_impl::resolve_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 32usize]>>
  38:     0x7f76a95e2923 - <rustc_query_impl[7e84afb844c0dc58]::query_impl::resolve_instance::dynamic_query::{closure#2} as core[b901df56f7100974]::ops::function::FnOnce<(rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<(rustc_span[90405a0d169ad75f]::def_id::DefId, &rustc_middle[3225073a0293a413]::ty::list::RawList<(), rustc_middle[3225073a0293a413]::ty::generic_args::GenericArg>)>)>>::call_once
  39:     0x7f76a9431697 - <std[15469114d45899b1]::thread::local::LocalKey<core[b901df56f7100974]::cell::Cell<*const ()>>>::with::<rustc_middle[3225073a0293a413]::ty::context::tls::enter_context<rustc_query_system[6530a4bac8984ae5]::query::plumbing::execute_job_non_incr<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<(rustc_span[90405a0d169ad75f]::def_id::DefId, &rustc_middle[3225073a0293a413]::ty::list::RawList<(), rustc_middle[3225073a0293a413]::ty::generic_args::GenericArg>)>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 32usize]>>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 32usize]>>
  40:     0x7f76a9547b24 - rustc_query_system[6530a4bac8984ae5]::query::plumbing::try_execute_query::<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<(rustc_span[90405a0d169ad75f]::def_id::DefId, &rustc_middle[3225073a0293a413]::ty::list::RawList<(), rustc_middle[3225073a0293a413]::ty::generic_args::GenericArg>)>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt, false>
  41:     0x7f76a95e2f46 - rustc_query_impl[7e84afb844c0dc58]::query_impl::resolve_instance::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f76aa626f13 - <rustc_middle[3225073a0293a413]::ty::instance::Instance>::resolve
  43:     0x7f76aa614104 - <rustc_middle[3225073a0293a413]::ty::context::TyCtxt>::const_eval_resolve
  44:     0x7f76a9834dd0 - <rustc_middle[3225073a0293a413]::mir::consts::Const>::eval
  45:     0x7f76a987d7e9 - <rustc_const_eval[c5bff4a87f7085c]::interpret::eval_context::InterpCx<rustc_const_eval[c5bff4a87f7085c]::const_eval::machine::CompileTimeInterpreter>>::push_stack_frame
  46:     0x7f76a99473e4 - rustc_const_eval[c5bff4a87f7085c]::const_eval::eval_queries::eval_in_interpreter::<rustc_middle[3225073a0293a413]::mir::consts::ConstAlloc>
  47:     0x7f76a988dfa4 - rustc_const_eval[c5bff4a87f7085c]::const_eval::eval_queries::eval_to_allocation_raw_provider
  48:     0x7f76a966f2a4 - rustc_query_impl[7e84afb844c0dc58]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7e84afb844c0dc58]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>
  49:     0x7f76a96c53ab - <rustc_query_impl[7e84afb844c0dc58]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2} as core[b901df56f7100974]::ops::function::FnOnce<(rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>)>>::call_once
  50:     0x7f76a94313f5 - <std[15469114d45899b1]::thread::local::LocalKey<core[b901df56f7100974]::cell::Cell<*const ()>>>::with::<rustc_middle[3225073a0293a413]::ty::context::tls::enter_context<rustc_query_system[6530a4bac8984ae5]::query::plumbing::execute_job_non_incr<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>
  51:     0x7f76a9542722 - rustc_query_system[6530a4bac8984ae5]::query::plumbing::try_execute_query::<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt, false>
  52:     0x7f76a96c59e3 - rustc_query_impl[7e84afb844c0dc58]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  53:     0x7f76a9895342 - rustc_const_eval[c5bff4a87f7085c]::const_eval::valtrees::eval_to_valtree
  54:     0x7f76a98a49c3 - <rustc_const_eval[c5bff4a87f7085c]::provide::{closure#0} as core[b901df56f7100974]::ops::function::FnOnce<(rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>)>>::call_once
  55:     0x7f76a9663834 - rustc_query_impl[7e84afb844c0dc58]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7e84afb844c0dc58]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>
  56:     0x7f76a94921cb - <rustc_query_impl[7e84afb844c0dc58]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[b901df56f7100974]::ops::function::FnOnce<(rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>)>>::call_once
  57:     0x7f76a94313f5 - <std[15469114d45899b1]::thread::local::LocalKey<core[b901df56f7100974]::cell::Cell<*const ()>>>::with::<rustc_middle[3225073a0293a413]::ty::context::tls::enter_context<rustc_query_system[6530a4bac8984ae5]::query::plumbing::execute_job_non_incr<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>::{closure#0}, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>
  58:     0x7f76a9542722 - rustc_query_system[6530a4bac8984ae5]::query::plumbing::try_execute_query::<rustc_query_impl[7e84afb844c0dc58]::DynamicConfig<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[7e84afb844c0dc58]::plumbing::QueryCtxt, false>
  59:     0x7f76a9350623 - rustc_query_impl[7e84afb844c0dc58]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  60:     0x7f76aa613366 - rustc_middle[3225073a0293a413]::query::plumbing::query_get_at::<rustc_query_system[6530a4bac8984ae5]::query::caches::DefaultCache<rustc_middle[3225073a0293a413]::ty::ParamEnvAnd<rustc_middle[3225073a0293a413]::mir::interpret::GlobalId>, rustc_middle[3225073a0293a413]::query::erase::Erased<[u8; 24usize]>>>
  61:     0x7f76aa6153cf - <rustc_middle[3225073a0293a413]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  62:     0x7f76aa614643 - <rustc_middle[3225073a0293a413]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  63:     0x7f76a9d162cb - <rustc_infer[3ba290eb763f499]::infer::InferCtxt>::const_eval_resolve
  64:     0x7f76a9d11b46 - <rustc_infer[3ba290eb763f499]::infer::InferCtxt>::try_const_eval_resolve
  65:     0x7f76a9b808fa - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::normalize_at_least_one_step
  66:     0x7f76a9a35500 - <rustc_infer[3ba290eb763f499]::infer::InferCtxt>::probe::<core[b901df56f7100974]::result::Result<rustc_type_ir[dca2940381de7990]::canonical::Canonical<rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::traits::solve::Response>, rustc_middle[3225073a0293a413]::traits::query::NoSolution>, <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::probe::ProbeCtxt<<rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::compute_normalizes_to_goal::{closure#0}::{closure#0}, core[b901df56f7100974]::result::Result<rustc_type_ir[dca2940381de7990]::canonical::Canonical<rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::traits::solve::Response>, rustc_middle[3225073a0293a413]::traits::query::NoSolution>>>::enter<<rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::compute_normalizes_to_goal::{closure#0}::{closure#1}>::{closure#0}>
  67:     0x7f76a9b55a90 - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::probe::ProbeCtxt<<rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::compute_normalizes_to_goal::{closure#0}::{closure#0}, core[b901df56f7100974]::result::Result<rustc_type_ir[dca2940381de7990]::canonical::Canonical<rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::traits::solve::Response>, rustc_middle[3225073a0293a413]::traits::query::NoSolution>>>::enter::<<rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::compute_normalizes_to_goal::{closure#0}::{closure#1}>
  68:     0x7f76a9b7a43c - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::compute_goal
  69:     0x7f76a9bf55bd - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::enter_canonical::<core[b901df56f7100974]::result::Result<rustc_type_ir[dca2940381de7990]::canonical::Canonical<rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::traits::solve::Response>, rustc_middle[3225073a0293a413]::traits::query::NoSolution>, <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}::{closure#0}>
  70:     0x7f76a9c0c507 - <rustc_query_system[6530a4bac8984ae5]::dep_graph::graph::DepGraph<rustc_middle[3225073a0293a413]::dep_graph::DepsType>>::with_anon_task::<rustc_middle[3225073a0293a413]::ty::context::TyCtxt, <rustc_trait_selection[141eeb03ef3b9526]::solve::search_graph::SearchGraph>::with_new_goal<<rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#3}, (rustc_trait_selection[141eeb03ef3b9526]::solve::search_graph::StackEntry, core[b901df56f7100974]::result::Result<rustc_type_ir[dca2940381de7990]::canonical::Canonical<rustc_middle[3225073a0293a413]::ty::context::TyCtxt, rustc_middle[3225073a0293a413]::traits::solve::Response>, rustc_middle[3225073a0293a413]::traits::query::NoSolution>)>
  71:     0x7f76a9be0165 - <rustc_trait_selection[141eeb03ef3b9526]::solve::search_graph::SearchGraph>::with_new_goal::<<rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>
  72:     0x7f76a9b7981b - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::evaluate_goal_raw
  73:     0x7f76a9b79419 - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::evaluate_goal
  74:     0x7f76a9bf4db3 - <rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::EvalCtxt>::enter_root::<core[b901df56f7100974]::result::Result<(bool, rustc_middle[3225073a0293a413]::traits::solve::Certainty), rustc_middle[3225073a0293a413]::traits::query::NoSolution>, <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal::{closure#0}>
  75:     0x7f76a99c692a - <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal
  76:     0x7f76a9b4dfc1 - <rustc_trait_selection[141eeb03ef3b9526]::solve::fulfill::FulfillmentCtxt as rustc_infer[3ba290eb763f499]::traits::engine::TraitEngine>::select_where_possible
  77:     0x7f76a9a5930b - <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation::{closure#0}
  78:     0x7f76a9a3a2c9 - <rustc_infer[3ba290eb763f499]::infer::InferCtxt>::probe::<core[b901df56f7100974]::result::Result<rustc_middle[3225073a0293a413]::traits::select::EvaluationResult, rustc_middle[3225073a0293a413]::traits::select::OverflowError>, <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation::{closure#0}>
  79:     0x7f76a99c7a86 - <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  80:     0x7f76a99c7d50 - <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  81:     0x7f76a99c79ea - <rustc_infer[3ba290eb763f499]::infer::InferCtxt as rustc_trait_selection[141eeb03ef3b9526]::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
  82:     0x7f76a99c4bab - <rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::NormalizationFolder>::normalize_unevaluated_const
  83:     0x7f76a99c5c5f - <rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::NormalizationFolder as rustc_type_ir[dca2940381de7990]::fold::FallibleTypeFolder<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_const
  84:     0x7f76a9a216f8 - <rustc_middle[3225073a0293a413]::ty::consts::Const as rustc_type_ir[dca2940381de7990]::fold::TypeFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::NormalizationFolder>
  85:     0x7f76a99cb886 - <rustc_middle[3225073a0293a413]::ty::Ty as rustc_type_ir[dca2940381de7990]::fold::TypeSuperFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::NormalizationFolder>
  86:     0x7f76a99c5342 - <rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::NormalizationFolder as rustc_type_ir[dca2940381de7990]::fold::FallibleTypeFolder<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_ty
  87:     0x7f76a8dd94a8 - <rustc_middle[3225073a0293a413]::ty::Ty as rustc_type_ir[dca2940381de7990]::fold::TypeFoldable<rustc_middle[3225073a0293a413]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::NormalizationFolder>
  88:     0x7f76a8df5f15 - rustc_trait_selection[141eeb03ef3b9526]::solve::normalize::deeply_normalize::<rustc_middle[3225073a0293a413]::ty::Ty>
  89:     0x7f76a8df132c - <rustc_infer[3ba290eb763f499]::infer::at::At as rustc_trait_selection[141eeb03ef3b9526]::traits::normalize::NormalizeExt>::deeply_normalize::<rustc_middle[3225073a0293a413]::ty::Ty>
  90:     0x7f76a8dd65c1 - <rustc_trait_selection[141eeb03ef3b9526]::traits::engine::ObligationCtxt>::deeply_normalize::<rustc_middle[3225073a0293a413]::ty::Ty>
  91:     0x7f76a8db94eb - <rustc_privacy[cde37e8f24eab9c8]::SearchInterfaceForPrivateItemsVisitor>::ty
  92:     0x7f76a8dbafed - rustc_privacy[cde37e8f24eab9c8]::check_private_in_public
  (additional frames elided)
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: please make sure that you have updated to the latest nightly
note: rustc 1.79.0-dev running on x86_64-unknown-linux-gnu
note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/home/ubuntu/.cargo -Z ignore-directory-in-diagnostics-source-blocks=/home/ubuntu/projects/rust/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0
query stack during panic:
#0 [codegen_select_candidate] computing candidate for `<!0 as Indices<!1>>`
#1 [resolve_instance] resolving instance `<!0 as Indices<!1>>::NUM_ELEMS`
#2 [eval_to_allocation_raw] const-evaluating + checking `Tensor::data::{constant#0}`
#3 [eval_to_valtree] evaluating type-level constant
#4 [check_private_in_public] checking for private elements in public interfaces
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*it gets us down to own ICE if I fallback to the unnormalized type in the event of errors. If I don't do that and .unwrap instead, there are many more ICEs:
    [ui] tests/ui/associated-consts/issue-88599-ref-self.rs
    [ui] tests/ui/associated-inherent-types/generic-const-exprs.rs
    [ui] tests/ui/const-generics/generic_const_exprs/assoc_const_unification/const_equate_assoc_consts.rs
    [ui] tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-1.rs
    [ui] tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
    [ui] tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.rs
    [ui] tests/ui/const-generics/generic_const_exprs/issue-86710.rs
    [ui] tests/ui/const-generics/generic_const_exprs/issue-84408.rs
    [ui] tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs
    [ui] tests/ui/const-generics/generic_const_exprs/issue-96699.rs
    [ui] tests/ui/const-generics/generic_const_exprs/nested_uneval_unification-2.rs
    [ui] tests/ui/const-generics/generic_const_exprs/nested_uneval_unification-1.rs
    [ui] tests/ui/const-generics/generic_const_exprs/issue-82268.rs
    [ui] tests/ui/const-generics/generic_const_exprs/ty-alias-substitution.rs
    [ui] tests/ui/const-generics/generic_const_exprs/poly-const-uneval-ice-106423.rs
    [ui] tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs
    [ui] tests/ui/const-generics/inhabited-assoc-ty-ice-1.rs
    [ui] tests/ui/const-generics/inhabited-assoc-ty-ice-2.rs
    [ui] tests/ui/const-generics/issues/issue-105821.rs
    [ui] tests/ui/const-generics/issues/issue-83288.rs
    [ui] tests/ui/const-generics/issues/issue-90455.rs
    [ui] tests/ui/const-generics/parent_generics_of_encoding.rs
    [ui] tests/ui/const-generics/try_unify_ignore_lifetimes.rs
    [ui] tests/ui/consts/issue-104396.rs
    [ui] tests/ui/generic-const-items/evaluatable-bounds.rs
    [ui] tests/ui/privacy/where-priv-type.rs
    [ui] tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds.rs
    [ui] tests/ui/specialization/specialization-projection-alias.rs
    [ui] tests/ui/traits/issue-82830.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#![feature(generic_const_exprs)] means you can just move the test back into tests/crashes and mark it known-bug and reopen the issue it refers to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| These commits modify the  If this was unintentional then you should revert the changes before this PR is merged. | 
| since we're not in a rush, I'd like to do a crater run just to get any regressions out of the way... would rather catch this rather than during beta crater @bors try | 
| 🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming  
 You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses  Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how  Error message | 
| I would block this until the current set of optimizations necessary for bootstrap + fuchsia land, worried that this is going to cause too many hangs if we don't do that. Should take a few weeks | 
| Rebased! Let's see if I have the ability to kick off a  @bors try | 
| @jswrenn: 🔑 Insufficient privileges: not in try users | 
| @bors try | 
privacy: normalize associated types before visiting This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> -->
| 💥 Test timed out | 
| Could try it again I guess, but otherwise you may need to reach out for help on zulip or spend more time investigating this. @bors try | 
privacy: normalize associated types before visiting This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713 <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> -->
| 💥 Test timed out | 
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| Try to launch the dist builder image locally to reproduce the hang: there’s documentation about testing with docker in the rustc dev guide. | 
| ☔ The latest upstream changes (presumably #125443) made this pull request unmergeable. Please resolve the merge conflicts. | 
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
 @lcnr How's this going? | 
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy. Fixes rust-lang#45713
| Yeah, unfortunately, it looks like this still times out. :( | 
| ☔ The latest upstream changes (presumably #130724) made this pull request unmergeable. Please resolve the merge conflicts. | 
| I would wait a few more months. There is one remaining major failure with the next solver. I am currently working on that one and once it is fixed, cc rust-lang/types-team#129, we will focus on performance as all perf tests will compile at that point | 
This permits associated types to reference private types and traits, so long as the normalized type does not itself violate type privacy.
Fixes #45713