Skip to content

hopefully irrelevant candidate behavior difference of Sized/trivial builtin impls #162

Closed
@lcnr

Description

@lcnr
struct MaybeSized<T: ?Sized>(T);

fn is_sized<T: Sized>() -> Box<T> { todo!() }

fn foo<T: ?Sized>()
where
    MaybeSized<T>: Sized,
{
    is_sized::<MaybeSized<_>>();
}

this compiles with the old solver, inferring the _ to T. It has a ParamEnv and a BuiltinCandidate { has_nested: true } candidate and prefers the ParamEnv candidate here.

The new solver encounters a trivial impl candidate and a ParamEnv one, preferring the trivial builtin.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions