mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
5af56cac38
On some architectures, vector types may have a different ABI when relevant target features are enabled. As discussed in https://github.com/rust-lang/lang-team/issues/235, this turns out to very easily lead to unsound code. This commit makes it an error to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant.
16 lines
318 B
Rust
16 lines
318 B
Rust
//@ known-bug: #131342
|
|
|
|
fn main() {
|
|
let mut items = vec![1, 2, 3, 4, 5].into_iter();
|
|
problem_thingy(&mut items);
|
|
}
|
|
|
|
fn problem_thingy(items: &mut impl Iterator<Item = u8>) {
|
|
let mut peeker = items.peekable();
|
|
match peeker.peek() {
|
|
Some(_) => (),
|
|
None => return (),
|
|
}
|
|
problem_thingy(&mut peeker);
|
|
}
|