Skip to content

associated type missing default #6882

Closed
@XiangpengHao

Description

@XiangpengHao

Code example from #6792,
the pr (#6812) doesn't seem to fix it

Code

struct Test {}
trait SomeTrait {
  type Outer;

  fn broken() -> Self::Outer;
}

struct Inner {}
impl SomeTrait for Inner {
  type Outer = Test;

  fn broken() -> Self::Outer {
    Self::Outer{}
  }
}

fn main() {}

Meta

  • cargo clippy -V: clippy 0.1.52 (3a5d45f 2021-03-09)
  • rustc -Vv:
rustc 1.52.0-nightly (3a5d45f68 2021-03-09)
binary: rustc
commit-hash: 3a5d45f68cadc8fff4fbb557780f92b403b19c19
commit-date: 2021-03-09
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

error: internal compiler error: compiler/rustc_typeck/src/collect/type_of.rs:278:17: associated type missing default
  --> src/main.rs:22:3
   |
22 |   type Outer;
   |   ^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/3a5d45f68cadc8fff4fbb557780f92b403b19c19/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-clippy/issues/new

note: Clippy version: clippy 0.1.52 (3a5d45f 2021-03-09)

query stack during panic:
#0 [type_of] computing type of `SomeTrait::Outer`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `rust_test`

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

<backtrace>

Activity

added
C-bugCategory: Clippy is not doing the correct thing
I-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
on Mar 11, 2021
Y-Nak

Y-Nak commented on Mar 11, 2021

@Y-Nak
Contributor

This is fixed but the change is not synced yet.

Y-Nak

Y-Nak commented on Mar 11, 2021

@Y-Nak
Contributor

You can assure that by pasting the code to this file and running cargo dev fmt && cargo test in the clippy root.

XiangpengHao

XiangpengHao commented on Mar 11, 2021

@XiangpengHao
Author

I see, thanks! How long usually does it take to sync? Before that, I need to pin the nightly version to 20 days ago.

Y-Nak

Y-Nak commented on Mar 11, 2021

@Y-Nak
Contributor

Today! (the sync is done every other week.)

Y-Nak

Y-Nak commented on Mar 12, 2021

@Y-Nak
Contributor

Unfortunately, minor conflicts have occurred in the sync process, see #83012.
But It would be available in a few days, maybe.

XiangpengHao

XiangpengHao commented on Mar 13, 2021

@XiangpengHao
Author

Just found out the sync is merged and no more internal error observed.

Thank you for the great work!

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

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy 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

        @Y-Nak@XiangpengHao

        Issue actions

          associated type missing default · Issue #6882 · rust-lang/rust-clippy