Skip to content

Trying to use impl Trait in a trait implementation causes ICE #49841

Closed
@LunaBorowska

Description

@LunaBorowska
Contributor

Trying the following on beta:

use std::hash::{Hash, Hasher};

struct X;

impl Hash for X {
    fn hash(&self, hasher: &mut impl Hasher) {}
}

fn main() {}

I get the following error message.

   Compiling playground v0.0.1 (file:///playground)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

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: rustc 1.26.0-beta.3 (8a75d2b50 2018-04-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

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

error: Could not compile `playground`.

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

Playpen link: https://play.rust-lang.org/?gist=5f2404761b1e9eef3faca5ab5bd92167&version=beta

Activity

changed the title [-]Cannot use `impl Trait` in a trait.[/-] [+]Trying to use `impl Trait` in a trait causes ICE[/+] on Apr 10, 2018
changed the title [-]Trying to use `impl Trait` in a trait causes ICE[/-] [+]Trying to use `impl Trait` in a trait implementation causes ICE[/+] on Apr 10, 2018
added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
on Apr 10, 2018
added a commit that references this issue on Apr 26, 2018
98c2e09
added a commit that references this issue on Apr 30, 2018
214fd33
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

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@LunaBorowska

        Issue actions

          Trying to use `impl Trait` in a trait implementation causes ICE · Issue #49841 · rust-lang/rust