match terminator.kind {
TerminatorKind::Goto { target } => Some(Some(target)),
TerminatorKind::Return => Some(None),
+ TerminatorKind::Call {
+ ref func,
+ ref args,
+ destination: Some((ref place, target)),
+ cleanup: _,
+ from_hir_call: true,
+ fn_span: _,
+ } => {
+ let local = place.as_local()?;
+ let func = self.operand_to_node(func)?;
+ let args = self.tcx.arena.alloc_from_iter(
+ args.iter()
+ .map(|arg| self.operand_to_node(arg))
+ .collect::<Option<Vec<NodeId>>>()?,
+ );
+ self.locals[local] = self.nodes.push(Node::FunctionCall(func, args));
+ Some(Some(target))
+ }
TerminatorKind::Assert { ref cond, expected: false, target, .. } => {
let p = match cond {
mir::Operand::Copy(p) | mir::Operand::Move(p) => p,
--- /dev/null
+// run-pass
+#![feature(const_generics, const_evaluatable_checked)]
+#![allow(incomplete_features)]
+
+const fn test_me<T>(a: usize, b: usize) -> usize {
+ if a < b {
+ std::mem::size_of::<T>()
+ } else {
+ std::usize::MAX
+ }
+}
+
+fn test_simple<T>() -> [u8; std::mem::size_of::<T>()]
+where
+ [u8; std::mem::size_of::<T>()]: Sized,
+{
+ [0; std::mem::size_of::<T>()]
+}
+
+fn test_with_args<T, const N: usize>() -> [u8; test_me::<T>(N, N + 1) + N]
+where
+ [u8; test_me::<T>(N, N + 1) + N]: Sized,
+{
+ [0; test_me::<T>(N, N + 1) + N]
+}
+
+fn main() {
+ assert_eq!([0; 8], test_simple::<u64>());
+ assert_eq!([0; 12], test_with_args::<u64, 4>());
+}