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

we never try to normalize unused alias definitions #139

Open
lcnr opened this issue Jan 21, 2025 · 2 comments
Open

we never try to normalize unused alias definitions #139

lcnr opened this issue Jan 21, 2025 · 2 comments

Comments

@lcnr
Copy link
Contributor

lcnr commented Jan 21, 2025

causing check builds to pass

affected tests

  • we never try to normalize unused inherent associated types
    • tests/ui/associated-inherent-types/normalization-overflow.rs
  • we never try to normalize lazy type aliases
    • tests/ui/infinite/infinite-type-alias-mutual-recursion.rs
struct T;

impl T {
    type This = Self::This; //~ ERROR overflow evaluating associated type `T::This`
}

fn main() {}
@lcnr lcnr moved this to todo in -Znext-solver=globally Jan 29, 2025
@lcnr lcnr closed this as completed by moving to todo in -Znext-solver=globally Jan 29, 2025
@lcnr lcnr reopened this Jan 29, 2025
@lcnr lcnr moved this from toduu to todo in -Znext-solver=globally Jan 29, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Mar 6, 2025

we also do not eagerly try to normalize struct fields

trait Trait {
    type Diverges<D: Trait>;
}

impl<T> Trait for T {
    type Diverges<D: Trait> = D::Diverges<D>;
}

struct Foo {
    field: Box<<u8 as Trait>::Diverges<u8>>,
}

@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 6, 2025

The same is also true of defaulted type parameters:

trait Trait {
    type Diverges<D: Trait>;
}

impl<T> Trait for T {
    type Diverges<D: Trait> = D::Diverges<D>;
}

struct Bar<T: ?Sized = <u8 as Trait>::Diverges<u8>>(Box<T>);

Though this is not a new solver regression as the old solver also fails to emit an error here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants