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

Updating lints page to reflect recent changes #127504

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 30 additions & 11 deletions src/doc/rustc/src/lints/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,38 @@
users some time to fix the code to accommodate the change. After some time,
the warning may become an error.

The following is an example of what a future-incompatible looks like:
The following is an example of what future-incompatible code looks like:

```rust,compile_fail
#![allow(unused)]
enum E {
A,
}
impl Drop for E {
fn drop(&mut self) {
println!("Drop");
}
}

#[allow(cenum_impl_drop_cast)]
fn main() {
let e = E::A;
let i = e as u32;
}
```

This will produce the following warning:

```text
warning: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
--> lint_example.rs:11:13
|
11 | let y = &x.data.0;
| ^^^^^^^^^
|
= note: `#[warn(safe_packed_borrows)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
= note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
> warning: cannot cast enum `E` into integer `u32` because it implements `Drop`
> --> src/main.rs:14:13
> |
> 14 | let i = e as u32;
> | ^^^^^^^^
> |
> = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
> = note: for more information, see issue #73333 <https://github.com/rust-lang/rust/issues/73333>
>

Check failure on line 73 in src/doc/rustc/src/lints/index.md

View workflow job for this annotation

GitHub Actions / PR - mingw-check-tidy

trailing whitespace
```

For more information about the process and policy of future-incompatible
Expand Down
Loading