Skip to content

Tracking Issue for future-incompatibility lint unstable_imports #163160

Description

@mejrs

This is the tracking issue for the unstable_imports future-compatibility warning and other related errors. The goal of this page is to describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.

What is the warning for?

Several import paths through the intrinsics module were accidentally allowed. They are stably available through other modules; these import paths should be used instead.

Why was this change made?

Supporting this behavior (through the rustc_allowed_through_unstable_modules attribute) significantly complicates stability checking in the compiler, we would like to be able to get rid of the hacks required for it.

Example

use {std/core}::intrinsics::{transmute/copy/copy_nonoverlapping/write_bytes};

Recommendations

Import these items through the {core/std}::mem module (for transmute) and {std/core}::ptr module (for the other items) instead. rustfix can apply these fixes automatically.

When will this warning become a hard error?

The fallout, at this time, would be significant, see #157082 (comment). Especially older rand-core versions are heavily affected, but note that since that crater run new minor versions of the affected rand-core crate have been released (much thanks to @dhardy).

Steps

  • Implement the lint
  • Raise lint level to deny
  • Change the lint to report in dependencies
  • Switch to a hard error

Implementation history

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-stabilityArea: `#[stable]`, `#[unstable]` etc.C-future-incompatibilityCategory: Future-incompatibility lints

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions