-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
Description
Code:
trait Trait {}
struct Wrap<T>(T);
impl<T: Trait> Trait for Wrap<T> {}
fn f(x: impl Trait) -> impl Trait {
f(Wrap(x))
}
This code probably shouldn't compile, since it would probably need to instantiate infinitely many versions of the f function.
It currently doesn't compile as it should. However, it does produce the following error, which is very confusing:
Compiling playground v0.0.1 (file:///playground)
error[E0275]: overflow evaluating the requirement `impl Trait: std::marker::Freeze`
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because it appears within the type `impl Trait`
= note: required because it appears within the type `impl Trait`
= note: required because it appears within the type `impl Trait`
= note: required because it appears within the type `impl Trait`
(many more lines repeating this here...)
= note: required because it appears within the type `impl Trait`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0275`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
I have no idea what std::marker::Freeze
is, and it appearing in the error message will probably be confusing to other users as well. I'm not sure whether this will happen in actual code though.
Most likely a reincarnation of #44349.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team