Skip to content

[ER] cfg(overflow_checks) #91130

Closed
@leonardo-m

Description

@leonardo-m

An enhancement request discussed here:
https://users.rust-lang.org/t/detecting-overflow-checks/67698/

(That thread also contains a hacky solution by Yandros).

I propose to add a config like this:

#[cfg(overflow_checks)]

I would like to use it to enable/disable lines of code that perform safe unsafe "as" casts replacing them with casts when I compile with debug builds or with release builds compiled with "-C overflow-checks".

Activity

leonardo-m

leonardo-m commented on Nov 22, 2021

@leonardo-m
Author

@rustbot modify labels: C-enhancement

added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
on Nov 22, 2021
hkratz

hkratz commented on Nov 25, 2021

@hkratz
Contributor

@rustbot label A-attributes T-compiler

added
A-attributesArea: Attributes (`#[…]`, `#![…]`)
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 25, 2021
schuelermine

schuelermine commented on Mar 22, 2023

@schuelermine
Contributor

I’d also be interested in this.

AngelicosPhosphoros

AngelicosPhosphoros commented on May 11, 2023

@AngelicosPhosphoros
Contributor

Tracking issue: #111466

added a commit that references this issue on May 11, 2023
7c263ad
added a commit that references this issue on May 13, 2023

Rollup merge of rust-lang#111096 - AngelicosPhosphoros:overflow_check…

36125c4
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-attributesArea: Attributes (`#[…]`, `#![…]`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.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

      Participants

      @hkratz@AngelicosPhosphoros@leonardo-m@rustbot@schuelermine

      Issue actions

        [ER] cfg(overflow_checks) · Issue #91130 · rust-lang/rust