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

Ensure an error is raised on infinite recursion #12247

Closed
wants to merge 1 commit into from

Conversation

flaper87
Copy link
Contributor

Closes #8727


struct Data(~Option<Data>);

fn generic<T>( _ : ~[(Data,T)] ) {let rec : ~[(Data,(bool,T))] = ~[]; generic( rec ); } //~ ERROR overly deep expansion of inlined function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about some newlines?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we're running tidy over tests now (or at least I think there was a PR for that), so it may be required in the future to shorten this line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a test directive to allow long lines, but I don't recall what it is off hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having some issues with making the printed, multi-line error match the error in the comment, which means this test kept failing.

I'd be ok to re-factor this patch or proposa a new one that makes it multi-line if that's needed.

@flaper87 flaper87 deleted the issue-8727 branch March 11, 2014 09:15
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
…albasi

fix: ignore impls with `#[rustc_reservation_impl]`

Fixes rust-lang#12247
Fixes rust-lang#14279

Currently core has two blanket impls for `From`: `impl<T> From<T> for T` and `impl<T> From<!> for T`. These are conflicting and thus chalk cannot uniquely solve `S: From<?0>` for any type `S`.

The latter impl is actually a reservation impl and should not be considered during trait selection. More generally, impls attributed with perma-unstable `#[rustc_reservation_impl]` attribute should be disregarded except for coherence checks. See rust-lang#64631 and rust-lang#64715 for details.

I chose to entirely ignore them in hir-ty because we don't do coherence checks.
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.

compiler diverges without error message when generic function has infinite instantiations
5 participants