Skip to content

EncodeUtf8::as_slice results in suboptimal code #36368

Closed
@nagisa

Description

@nagisa

// We know for sure this method cannot slice out-of-bounds because:
// * 0 ≤ self.pos ≤ 3
// * self.buf.len() = 4
//
// This way the slicing will always succeed, but LLVM is incapable of figuring out both
// these conditions hold, resulting in suboptimal code, especially after inlining,
// containing bound checks and unwinding support code.

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