-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #4975 - JohnTitor:fix-4968, r=phansch
Fix ICE on `unsound_collection_transmute` Fixes #4968 Check if `Ty`s are normalizable. It might show hidden false negative, I'm not sure. Also, the regression tests are placed on two dirs, so move them to `/crashes`. I think it will be easier to find the right place. changelog: Fix ICE on `unsound_collection_transmute`
- Loading branch information
Showing
16 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
macro_rules! use_self { | ||
( | ||
impl $ty:ident { | ||
fn func(&$this:ident) { | ||
[fields($($field:ident)*)] | ||
} | ||
} | ||
) => ( | ||
impl $ty { | ||
fn func(&$this) { | ||
let $ty { $($field),* } = $this; | ||
} | ||
} | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// check-pass | ||
|
||
// Test for https://github.com/rust-lang/rust-clippy/issues/4968 | ||
|
||
#![warn(clippy::unsound_collection_transmute)] | ||
|
||
trait Trait { | ||
type Assoc; | ||
} | ||
|
||
use std::mem::{self, ManuallyDrop}; | ||
|
||
#[allow(unused)] | ||
fn func<T: Trait>(slice: Vec<T::Assoc>) { | ||
unsafe { | ||
let _: Vec<ManuallyDrop<T::Assoc>> = mem::transmute(slice); | ||
} | ||
} | ||
|
||
fn main() {} |