Skip to content

EncodeUtf8 iterator implementation results in bad code #35099

Closed
@nagisa

Description

@nagisa

Provided #35098 (more precisely f729e17 commit) lands, iterating x.encode_utf8().as_slice() results in considerably better code compared to x.encode_utf8().

One major problem with the EncodeUtf8 iterator is the fact that it uses checked indexing, despite it being obvious this iterator cannot index out-of-bounds. However, even if that problem is fixed, noticeably worse code is still generated, but I couldn’t exactly pinpoint why.

cc @alexcrichton #32204

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