Skip to content

Miri and miri-related code contains repetitions of (n << amt) >> amt #49937

Description

@oli-obk

All of these should be deduplicated under a common set of functions that do sign extension or truncation of integers.

The functions should live somewhere in librustc, so probably librustc::mir::interpret, because they are also needed in librustc::ty::layout.

The parts that need to be figured out:

  • what information is needed in each function (so we don't have to prepend all function calls with an "almost the same" computation of e.g. type layouts.
  • are there many uses of sign extension followed by truncation and should these be a single function, too?

Activity

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

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions