Skip to content

Don't loop infinitely on 0-size structs in repr - #7683

Merged
bors merged 1 commit into
rust-lang:masterfrom
alexcrichton:issue-7625
Jul 11, 2013
Merged

Don't loop infinitely on 0-size structs in repr#7683
bors merged 1 commit into
rust-lang:masterfrom
alexcrichton:issue-7625

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

Closes #7625

bors added a commit that referenced this pull request Jul 11, 2013
@bors bors closed this Jul 11, 2013
@bors
bors merged commit 6d4d2c9 into rust-lang:master Jul 11, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 7, 2021
…1995

fix for issue rust-lang#7683

Fixes rust-lang#7683.

For Repeat  [x; y] (x is the type and y is the times to repeat) . When y > 32, the compiler will report an error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7148558162685e91056e0550797ea74c

Because https://github.com/rust-lang/rust/blob/6cdd42f9f8dd4e5e5ba0aa816bc4c99ab8b102f9/library/std/src/primitive_docs.rs#L538
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.

So here to detect this situation.

changelog: [`derivable_impls`]: No longer lints when arrays bigger than 32 elements are involved
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
7732: Don't lower TypeBound::Lifetime as GenericPredicate::Error r=flodiebold a=Veykril

Basically we just discard the typebound for now instead when lowering to `GenericPredicate`. I think this shouldn't have any other side effects?

Fixes rust-lang#7683(hopefully for real this time)

I also played around with introducing `GenericPredicate::LifetimeOutlives` and `GenericPredicate::TypeOutlives`(see Veykril/rust-analyzer@b9d6904) but that won't fix this issue(at least not for now) due to lifetime predicate mismatches when resolving methods so I figure this is a good way to fix it for now.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fmt!'s pretty printer dies on vectors of unit struct

3 participants