Closed
Description
I tried this code:
#![feature(trait_upcasting)]
pub trait A {}
pub trait B {}
pub trait C: A + B {}
impl<X: A + B> C for X {}
pub fn test<'a, T>(view: T) -> Option<&'a mut dyn B>
where
T: IntoIterator<Item = &'a mut dyn B>,
{
return Some(view.into_iter().next().unwrap());
}
fn main() {
let mut a: Vec<Box<dyn C>> = Vec::new();
test(a.iter_mut().map(|c| c.as_mut() as &mut dyn B));
}
I expected to see this happen: compile successfully
Instead, this happened: get a compile error:
Invalid InsertValueInst operands!
%13 = insertvalue { {}*, [3 x i64]* } %12, i8* %11, 1, !dbg !170
in function _ZN6viewer6viewer10controller4test1t28_$u7b$$u7b$closure$u7d$$u7d$17h1000438316d202ffE
LLVM ERROR: Broken function found, compilation aborted!
Meta
rustc --version --verbose
:
rustc 1.64.0-nightly (87588a2af 2022-07-13)
binary: rustc
commit-hash: 87588a2afd9ca903366f0deaf84d805f34469384
commit-date: 2022-07-13
host: x86_64-apple-darwin
release: 1.64.0-nightly
LLVM version: 14.0.6
no other backtrace logged
only debug build has this issue
Metadata
Metadata
Assignees
Labels
Area: Code generationCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#![feature(trait_upcasting)]`Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.This issue requires a nightly compiler in some way.