Skip to content

Where-clause based exclusion of default methods from vtable doesn't normalize correctly. #26805

Closed
@eddyb

Description

@eddyb

@Ms2ger reported that on rustc-1.3.0-dev (f3b97a7), https://github.com/mlalic/solicit ICEs with:

src/libcore/iter.rs:804:35: 804:42 error: internal compiler error: Encountered errors
`[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<http::session::DefaultStream as core::cmp::PartialOrd>)),depth=1),Unimplemented)]`
fulfilling during trans

This turned out to occur due to the instantiation of Iterator::min's default body for a vtable, while Self::Item doesn't implement Ord.
#26677 left two uses of infer::new_infer_ctxt in trans, where only infer::normalizing_infer_ctxt should be used.

Shorter testcase:

struct NonOrd;
fn main() {
    let _: Box<Iterator<Item = _>> = Box::new(vec![NonOrd].into_iter());
}
src/libcore/iter.rs:804:35: 804:42 error: internal compiler error: Encountered error
`Unimplemented` selecting `Binder(<NonOrd as core::cmp::PartialOrd>)`
during trans

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions