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

Existential_type compiler stack overflow #52977

Closed
DutchGhost opened this issue Aug 2, 2018 · 5 comments · Fixed by #59459
Closed

Existential_type compiler stack overflow #52977

DutchGhost opened this issue Aug 2, 2018 · 5 comments · Fixed by #59459
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@DutchGhost
Copy link
Contributor

DutchGhost commented Aug 2, 2018

Playing with the nighly's existential types, I stumbled upon a compiler stack overflow:

#![feature(existential_type)]

existential type Foo: Fn() -> Foo;

fn crash(x: Foo) -> Foo {
    x
}

fn main() {
    
}

Error message:

Compiling playground v0.0.1 (file:///playground)

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
error: Could not compile `playground`.

To learn more, run the command again with --verbose.
@DutchGhost
Copy link
Contributor Author

A better example might be this:

#![feature(existential_type)]

pub trait Bar<T> {
    type Item;
}

existential type Foo: Bar<Foo, Item = Foo>;

fn crash(x: Foo) -> Foo {
    x
}

fn main() {
    
}

removing the Item = Foo from the existential type decleration just compiles fine

@DutchGhost DutchGhost changed the title Compiler stack overflow existential_type Compiler stack overflow Aug 2, 2018
@DutchGhost DutchGhost changed the title existential_type Compiler stack overflow Existential_type compiler stack overflow Aug 2, 2018
@kennytm kennytm added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. labels Aug 2, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Aug 3, 2018

Can you try running the compiler inside gdb and produce a backtrace?

@DutchGhost
Copy link
Contributor Author

Backtrace:
Starting program: /home/DutchGh0st/.cargo/bin/rustc main.rs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 136 is executing new program: /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff75f0700 (LWP 140)]

Thread 2 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff75f0700 (LWP 140)]
0x00007ffffece4401 in mallocx (size=96, flags=0) at /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:2278
2278    /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c: No such file or directory.
#0  0x00007ffffece4401 in mallocx (size=96, flags=0) at /checkout/src/liballoc_jemalloc/../jemalloc/src/jemalloc.c:2278
#1  0x00007ffffac7028b in _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h6df995c7d982ea03 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc-6b3bfd814e7184c8.so
#2  0x00007ffffb060b3d in rustc::ty::query::plumbing::_$LT$impl$u20$rustc..ty..context..TyCtxt$LT$$u27$a$C$$u20$$u27$gcx$C$$u20$$u27$tcx$GT$$GT$::get_query::h4615380c5ee9a0a7 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc-6b3bfd814e7184c8.so
#3  0x00007ffffb124693 in rustc::ty::query::_$LT$impl$u20$rustc..ty..context..TyCtxt$LT$$u27$a$C$$u20$$u27$tcx$C$$u20$$u27$lcx$GT$$GT$::predicates_of::hcbf22c835c6bc1a1 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc-6b3bfd814e7184c8.so
#4  0x00007ffffd824311 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#5  0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#6  0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#7  0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#8  0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#9  0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#10 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#11 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#12 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#13 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#14 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#15 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#16 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#17 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#18 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#19 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#20 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#21 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#22 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#23 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#24 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#25 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#26 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#27 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#28 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#29 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#30 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#31 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#32 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#33 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#34 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#35 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#36 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#37 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#38 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#39 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#40 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#41 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#42 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#43 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#44 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so
#45 0x00007ffffd824374 in _$LT$rustc_privacy..TypePrivacyVisitor$LT$$u27$a$C$$u20$$u27$tcx$GT$$u20$as$u20$rustc..ty..fold..TypeVisitor$LT$$u27$tcx$GT$$GT$::visit_ty::hf59619e6ff1f1998 () from /home/DutchGh0st/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/librustc_privacy-24b96028bea24937.so

@oli-obk
Copy link
Contributor

oli-obk commented Aug 6, 2018

It's recursing in

if self.in_body {
// Types in bodies.
if self.tables.node_id_to_type(hir_ty.hir_id).visit_with(self) {
return;
}
} else {
// Types in signatures.
// FIXME: This is very ineffective. Ideally each HIR type should be converted
// into a semantic type only once and the result should be cached somehow.
if rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty).visit_with(self) {
return;
}
}

Ideally this should cause cycle errors. But I'm assuming

This is very ineffective. Ideally each HIR type should be converted into a semantic type only once and the result should be cached somehow.

Manually computes this without a query. Maybe we should just make hir_ty_to_ty a query? This would solve both the FIXME and this issue.

@oli-obk
Copy link
Contributor

oli-obk commented Jan 25, 2019

Both examples now produce a cycle error. So we just need to add the two examples to src/test/ui/existential_types (if there aren't already tests for these situations)

@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. and removed A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. labels Jan 25, 2019
Centril added a commit to Centril/rust that referenced this issue Mar 27, 2019
Add some tests

close rust-lang#52977

It seems that there are no tests for this issue, so I opened this PR.
off-topic: I noticed [this test](https:/rust-lang/rust/blob/master/src/test/ui/existential_types/nested_existential_types.rs)'s indents are bad, could I include commit to fix this, or should I separate?

r? @oli-obk
Centril added a commit to Centril/rust that referenced this issue Mar 27, 2019
Add some tests

close rust-lang#52977

It seems that there are no tests for this issue, so I opened this PR.
off-topic: I noticed [this test](https:/rust-lang/rust/blob/master/src/test/ui/existential_types/nested_existential_types.rs)'s indents are bad, could I include commit to fix this, or should I separate?

r? @oli-obk
cuviper added a commit to cuviper/rust that referenced this issue Mar 28, 2019
Add some tests

close rust-lang#52977

It seems that there are no tests for this issue, so I opened this PR.
off-topic: I noticed [this test](https:/rust-lang/rust/blob/master/src/test/ui/existential_types/nested_existential_types.rs)'s indents are bad, could I include commit to fix this, or should I separate?

r? @oli-obk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants