Skip to content
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

ICE with invalid generics to std::slice::Iter #85237

Closed
K4rakara opened this issue May 12, 2021 · 6 comments
Closed

ICE with invalid generics to std::slice::Iter #85237

K4rakara opened this issue May 12, 2021 · 6 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) A-metadata Area: Crate metadata C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@K4rakara
Copy link

Code

extern crate rand;

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct PieceShape([(isize, isize); 4]);
impl PieceShape {
    pub fn iter(&self) -> std::slice::Iter<Item = (isize, isize)> {
        self.0.iter()
    }
    pub fn iter_mut(&mut self) -> std::slice::IterMut<Item = (isize, isize)> {
        self.0.iter_mut()
    }
}

fn main() {
    
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (7af1f55ae 2021-04-15)
binary: rustc
commit-hash: 7af1f55ae359e731c2c303f5d98e42a1a8163af0
commit-date: 2021-04-15
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

   Compiling rust-repo v0.1.0 (/tmp/rust-repo)
error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder.rs:1233:18: cannot get associated-item of `DefKey { parent: Some(DefIndex(9472)), disambiguated_data: DisambiguatedDefPathData { data: ValueNs("ptr"), disambiguator: 0 } }`

thread 'rustc' panicked at 'Box<Any>', /rustc/7af1f55ae359e731c2c303f5d98e42a1a8163af0/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.53.0-nightly (7af1f55ae 2021-04-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [associated_item] computing associated item data for `std::slice::Iter::ptr`
#1 [associated_items] collecting associated items of std::slice::Iter
end of query stack
error: aborting due to previous error

error: could not compile `rust-repo`

To learn more, run the command again with --verbose.
Backtrace

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_metadata::rmeta::decoder::<impl rustc_metadata::creader::CrateMetadataRef>::get_associated_item
   8: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern::associated_item
   9: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::associated_item>::compute
  10: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  12: rustc_data_structures::stack::ensure_sufficient_stack
  13: rustc_query_system::query::plumbing::force_query_with_job
  14: rustc_query_system::query::plumbing::get_query_impl
  15: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::associated_item
  16: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  17: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  18: rustc_ty_utils::ty::associated_items
  19: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::associated_items>::compute
  20: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::force_query_with_job
  24: rustc_query_system::query::plumbing::get_query_impl
  25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::associated_items
  26: <rustc_resolve::late::lifetimes::LifetimeContext as rustc_hir::intravisit::Visitor>::visit_path
  27: <rustc_resolve::late::lifetimes::LifetimeContext as rustc_hir::intravisit::Visitor>::visit_ty
  28: rustc_resolve::late::lifetimes::LifetimeContext::visit_fn_like_elision
  29: <rustc_resolve::late::lifetimes::LifetimeContext as rustc_hir::intravisit::Visitor>::visit_fn
  30: rustc_hir::intravisit::walk_impl_item
  31: <rustc_resolve::late::lifetimes::LifetimeContext as rustc_hir::intravisit::Visitor>::visit_impl_item
  32: rustc_hir::intravisit::walk_item
  33: <rustc_resolve::late::lifetimes::LifetimeContext as rustc_hir::intravisit::Visitor>::visit_item
  34: rustc_resolve::late::lifetimes::do_resolve
  35: rustc_resolve::late::lifetimes::resolve_lifetimes
  36: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::resolve_lifetimes>::compute
  37: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  38: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  39: rustc_data_structures::stack::ensure_sufficient_stack
  40: rustc_query_system::query::plumbing::force_query_with_job
  41: rustc_query_system::query::plumbing::get_query_impl
  42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_lifetimes
  43: rustc_resolve::late::lifetimes::resolve_lifetimes_for
  44: core::ops::function::FnOnce::call_once
  45: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  46: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  47: rustc_query_system::query::plumbing::force_query_with_job
  48: rustc_query_system::query::plumbing::get_query_impl
  49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::named_region_map
  50: rustc_middle::ty::context::TyCtxt::named_region
  51: rustc_hir::intravisit::walk_ty
  52: rustc_hir::intravisit::walk_fn_decl
  53: rustc_typeck::collect::generics_of
  54: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::generics_of>::compute
  55: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  56: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  57: rustc_data_structures::stack::ensure_sufficient_stack
  58: rustc_query_system::query::plumbing::force_query_with_job
  59: rustc_query_system::query::plumbing::get_query_impl
  60: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::generics_of
  61: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_impl_item
  62: rustc_middle::hir::map::Map::visit_item_likes_in_module
  63: rustc_typeck::collect::collect_mod_item_types
  64: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  65: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  66: rustc_query_system::query::plumbing::force_query_with_job
  67: rustc_query_system::query::plumbing::get_query_impl
  68: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_mod_item_types
  69: rustc_session::session::Session::track_errors
  70: rustc_typeck::check_crate
  71: rustc_interface::passes::analysis
  72: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  73: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  74: rustc_data_structures::stack::ensure_sufficient_stack
  75: rustc_query_system::query::plumbing::force_query_with_job
  76: rustc_query_system::query::plumbing::get_query_impl
  77: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  78: rustc_interface::passes::QueryContext::enter
  79: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  80: rustc_span::with_source_map
  81: rustc_interface::interface::create_compiler_and_run
  82: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@K4rakara K4rakara added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 12, 2021
@jonas-schievink jonas-schievink added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 12, 2021
@LeSeulArtichaut
Copy link
Contributor

I can't reproduce this on the playground. @K4rakara does running cargo clean and re-building make the ICE disappear?

@LeSeulArtichaut LeSeulArtichaut added A-metadata Area: Crate metadata A-associated-items Area: Associated items (types, constants & functions) labels May 12, 2021
@K4rakara
Copy link
Author

yeah, still occurs after running cargo clean and rebuilding

@apiraino
Copy link
Contributor

apiraino commented May 12, 2021

@K4rakara does it also reproduce with others rust versions? Can you try latest nightly or a beta/stable? it could help us pointing out a specific release (if any) where this happens. thanks!

@K4rakara
Copy link
Author

@apiraino: On both 1.54.0-nighty (5c02926) and 1.53.0-beta.2 (4bac69d) it does not reproduce, so theres a chance this has been fixed already

@LeSeulArtichaut
Copy link
Contributor

This was fixed by #83944

@apiraino
Copy link
Contributor

Thanks for the feedback, in this case I'll close this issue as duplicate

@LeSeulArtichaut LeSeulArtichaut removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-metadata Area: Crate metadata C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants