Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable 64-bit checked multiplication on 32-bit #12276

Merged
merged 1 commit into from
Feb 15, 2014

Conversation

alexcrichton
Copy link
Member

This was just waiting for compiler-rt support, which was added in #12027

Closes #8449

This was just waiting for compiler-rt support, which was added in rust-lang#12027

Closes rust-lang#8449
bors added a commit that referenced this pull request Feb 15, 2014
This was just waiting for compiler-rt support, which was added in #12027

Closes #8449
@bors bors closed this Feb 15, 2014
@bors bors merged commit 90311fc into rust-lang:master Feb 15, 2014
@alexcrichton alexcrichton deleted the issue-8449 branch February 16, 2014 00:40
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
…f-impl, r=jonas-schievink

feat: Improve "Generate `Deref` impl" assist

Fixes rust-lang/rust-analyzer#12265
Fixes rust-lang/rust-analyzer#12266

The assist will now generate a `DerefMut` impl if a `Deref` impl is already present.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 7, 2024
…lyxyas

Fix FP in `threadlocal!` when falling back to `os_local`

**Issue**: The lint always triggers for some targets.
**Why**: The lint assumes an `__init` function is not present for const initializers.
This does not hold for all targets. Some targets always have an initializer function.
**Fix**: If an initializer function exists, we check that it is not a `const` fn.

Lint overview before the patch:

1. Outside `threadlocal!`, then exit early.
2. In `threadlocal!` and `__init` does not exist => is const already, exit early.
3. In `threadlocal!` and `__init` exists and `__init` body can be `const` => we lint.

Lint overview after the patch:

1. Outside `threadlocal!`, then exit early.
2. In `threadlocal!` and `__init` does not exist => is const already, exit early.
3. In `threadlocal!` and `__init` exists and is `const fn` => is const already, exit early.
4. In `threadlocal!` and `__init` exists and is not `const fn` and `__init` body can be `const` => we lint.

The patch adds step 3.

changelog: Fixed fp in [`thread_local_initializer_can_be_made_const`] where fallback implementation of `threadlocal!` was always linted.

## Verifying the changes
For each of these platforms [ mac, x86_64-windows-gnu, x86_64-windows-msvc ]:

1. switched to master, ran bless. Found a failure for windows-gnu.
2. switched to patch, ran bless. Success for all three platforms.

## How platform affects the lint:

The compiler performs a [conditional compilation depending on platform features](https://doc.rust-lang.org/src/std/sys/common/thread_local/mod.rs.html). The `os_local` fallback includes a call to `__init`, without step 3, we lint in all cases.

```rust
cfg_if::cfg_if! {
    if #[cfg(any(all(target_family = "wasm", not(target_feature = "atomics")), target_os = "uefi"))] {
        #[doc(hidden)]
        mod static_local;
        #[doc(hidden)]
        pub use static_local::{Key, thread_local_inner};
    } else if #[cfg(target_thread_local)] {
        #[doc(hidden)]
        mod fast_local;
        #[doc(hidden)]
        pub use fast_local::{Key, thread_local_inner};
    } else {
        #[doc(hidden)]
        mod os_local;
        #[doc(hidden)]
        pub use os_local::{Key, thread_local_inner};
    }
}
```

r? `@llogiq`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

64-bit signed/unsigned overflow checked multiplication unavailable on 32-bit
2 participants