Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Trait bounds not checked on specializable associated types #33017

Copy link
Copy link
@apasel422

Description

@apasel422
Issue body actions

foo.rs:

#![feature(specialization)]

trait Foo: Sized {
    type Bar: From<Self>;
}

impl Foo for i32 {
    default type Bar = ();
}

fn xyz<T: Foo>(t: T) -> T::Bar {
    t.into()
}

fn main() {
    xyz(5i32);
}
> rustc --version
rustc 1.10.0-nightly (2174bd97c 2016-04-14)
> RUST_BACKTRACE=1 rustc foo.rs 
error: internal compiler error: ../src/librustc/infer/mod.rs:544: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<() as std::convert::From<i32>>)),depth=1),Unimplemented)]` fulfilling during trans
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:536
stack backtrace:
   1:     0x7f075adfc600 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
   2:     0x7f075ae09d4b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
   3:     0x7f075ae098ec - std::panicking::default_hook::hc2c969e7453d080c
   4:     0x7f075adce8bf - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
   5:     0x7f0759d28008 - std::sys_common::unwind::begin_unwind::h24c4c0fa2cfe995a
   6:     0x7f0759d27fab - syntax::errors::Handler::span_bug::h1c6b996df38ae8d7
   7:     0x7f0759d5c152 - rustc::session::opt_span_bug_fmt::_$u7b$$u7b$closure$u7d$$u7d$::hf0fb5697f8f25f40
   8:     0x7f0759d5c042 - rustc::session::span_bug_fmt::h4591bcbadfc38558
   9:     0x7f0759d6ffb3 - rustc_trans::common::fulfill_obligation::hb97500cd4d49823c
  10:     0x7f0759e6dc39 - _<collector..MirNeighborCollector<'a, 'tcx> as rustc..mir..visit..Visitor<'tcx>>::visit_operand::hc9aaa9442e0c17d2
  11:     0x7f0759e695f6 - rustc_trans::collector::collect_items_rec::hd5e212e77fc53d1a
  12:     0x7f0759e697ad - rustc_trans::collector::collect_items_rec::hd5e212e77fc53d1a
  13:     0x7f0759dabc86 - rustc_trans::base::collect_translation_items::_$u7b$$u7b$closure$u7d$$u7d$::h33d9d5954414c1ad
  14:     0x7f0759d99510 - rustc_trans::base::trans_crate::h6ed1dbd6e572a8c2
  15:     0x7f075b36215f - rustc_driver::driver::phase_4_translate_to_llvm::hd7579aae98641824
  16:     0x7f075b36081f - rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::h5534474dbe9371c4
  17:     0x7f075b35d190 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h5a042a091cd7658c
  18:     0x7f075b356c6b - rustc::ty::context::TyCtxt::create_and_enter::h3f9051bcccbd93e4
  19:     0x7f075b35371e - rustc_driver::driver::phase_3_run_analysis_passes::h9c723484c588a35b
  20:     0x7f075b325f7f - rustc_driver::driver::compile_input::h0629572e6f316b31
  21:     0x7f075b30c4e4 - rustc_driver::run_compiler::h8902aebf8b1849a8
  22:     0x7f075b309941 - std::sys_common::unwind::try::try_fn::h4c74456035d0fcc7
  23:     0x7f075adf9d9b - __rust_try
  24:     0x7f075adf9d2d - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
  25:     0x7f075b30a18a - _<F as std..boxed..FnBox<A>>::call_box::h27f542a39f1d61ef
  26:     0x7f075ae07ee4 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  27:     0x7f0752c606a9 - start_thread
  28:     0x7f075aa5ce9c - clone
  29:                0x0 - <unknown>
schneiderfelipe

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-specializationArea: Trait impl specializationArea: Trait impl specializationC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-specialization`#![feature(specialization)]``#![feature(specialization)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.