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 on ?Sized handling #48728

Closed
HyeonuPark opened this issue Mar 4, 2018 · 5 comments
Closed

ICE on ?Sized handling #48728

HyeonuPark opened this issue Mar 4, 2018 · 5 comments
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@HyeonuPark
Copy link

HyeonuPark commented Mar 4, 2018

This code reproduce it.
https://play.rust-lang.org/?gist=e6f3aa15d3399c3300dd38b0a627cbf4&version=stable

I tried this code:

#[derive(Clone)]
struct Node<T: ?Sized>(Box<T>);

impl<T: Clone + ?Sized> Clone for Node<[T]> {
    fn clone(&self) -> Self {
        Node(Box::clone(&self.0))
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.24.1 (d3ae9a9e0 2018-02-27)
binary: rustc
commit-hash: d3ae9a9e08edf12de0ed82af57ba2a56c26496ea
commit-date: 2018-02-27
host: x86_64-unknown-linux-gnu
release: 1.24.1
LLVM version: 4.0
Backtrace: 
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::panicking::panic
             at /checkout/src/libcore/panicking.rs:51
  10: <std::thread::local::LocalKey<T>>::with
  11: rustc::ty::context::GlobalCtxt::enter_local
  12: rustc::traits::specialize::specialization_graph::Graph::insert
  13: rustc::traits::specialize::specialization_graph_provider
  14: rustc::dep_graph::graph::DepGraph::with_task_impl
  15: rustc_errors::Handler::track_diagnostics
  16: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::specialization_graph_of<'tcx>>::force
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::specialization_graph_of<'tcx>>::try_get
  19: rustc::ty::maps::TyCtxtAt::specialization_graph_of
  20: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::specialization_graph_of
  21: rustc_typeck::coherence::overlap::check_impl
  22: rustc_typeck::coherence::coherent_trait
  23: rustc::dep_graph::graph::DepGraph::with_task_impl
  24: rustc_errors::Handler::track_diagnostics
  25: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  26: rustc::ty::maps::<impl rustc::ty::maps::queries::coherent_trait<'tcx>>::force
  27: rustc::ty::maps::<impl rustc::ty::maps::queries::coherent_trait<'tcx>>::try_get
  28: rustc::ty::maps::TyCtxtAt::coherent_trait
  29: rustc::ty::maps::<impl rustc::ty::maps::queries::coherent_trait<'tcx>>::ensure
  30: rustc_typeck::coherence::check_coherence
  31: rustc_typeck::check_crate
  32: <std::thread::local::LocalKey<T>>::with
  33: <std::thread::local::LocalKey<T>>::with
  34: rustc::ty::context::TyCtxt::create_and_enter
  35: rustc_driver::driver::compile_input
  36: rustc_driver::run_compiler

And an angry imp there! 👿

@frewsxcv frewsxcv added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 4, 2018
@matthewjasper
Copy link
Contributor

Correctly compiles on 1.23. Version without derive:

trait M {}

struct Node<T: ?Sized>(Box<T>);

impl <T: Clone + ?Sized> M for Node<T> {}

impl <T> M for Node<[T]> {}

@matthewjasper matthewjasper added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Mar 4, 2018
HyeonuPark added a commit to HyeonuPark/Nal that referenced this issue Mar 4, 2018
@matthewjasper
Copy link
Contributor

It looks like this is the unwrap causing this

on_overlap(overlap(selcx, impl1_def_id, impl2_def_id).unwrap())

Introduced in #47738 cc @nikomatsakis

@TimNN TimNN added the C-bug Category: This is a bug. label Mar 6, 2018
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Mar 22, 2018
@nikomatsakis nikomatsakis self-assigned this Mar 22, 2018
@varkor varkor mentioned this issue Mar 22, 2018
@nikomatsakis nikomatsakis added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2018
@nikomatsakis
Copy link
Contributor

Argh this got mistagged (no T-compiler) and hence overlooked by me :(

@nikomatsakis
Copy link
Contributor

Fix in #49714

bors added a commit that referenced this issue Apr 8, 2018
mem-categorization, coherence fix

make mem-categorization use adjusted type for patterns: Fixes #49631

do not propagate `Err` when determing causal info: Fixes #48728

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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

6 participants