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

associated type missing default #6882

Closed
XiangpengHao opened this issue Mar 11, 2021 · 6 comments
Closed

associated type missing default #6882

XiangpengHao opened this issue Mar 11, 2021 · 6 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@XiangpengHao
Copy link

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>

@XiangpengHao XiangpengHao added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Mar 11, 2021
@Y-Nak
Copy link
Contributor

Y-Nak commented Mar 11, 2021

This is fixed but the change is not synced yet.

@Y-Nak
Copy link
Contributor

Y-Nak commented Mar 11, 2021

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

@XiangpengHao
Copy link
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
Copy link
Contributor

Y-Nak commented Mar 11, 2021

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

@Y-Nak
Copy link
Contributor

Y-Nak commented Mar 12, 2021

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

@XiangpengHao
Copy link
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
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants