Skip to content

EncodeUtf8::as_slice results in suboptimal code #36368

@nagisa

Description

@nagisa
Member

// 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.

Activity

durka

durka commented on Sep 9, 2016

@durka
Contributor

Where are these comments from? Anyway, sounds like a case for the new panic-safe slicing stuff (#36340).

nagisa

nagisa commented on Sep 9, 2016

@nagisa
MemberAuthor
nagisa

nagisa commented on Mar 12, 2017

@nagisa
MemberAuthor

Not applicable anymore, as a different approach is now used.

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

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

        Participants

        @durka@nagisa

        Issue actions

          EncodeUtf8::as_slice results in suboptimal code · Issue #36368 · rust-lang/rust