diff options
| author | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-05-30 15:41:43 +0200 |
|---|---|---|
| committer | Oliver Schneider <github35764891676564198441@oli-obk.de> | 2018-05-31 10:22:45 +0200 |
| commit | 03474943ec5cfd713064e085000cfe9f405a28ef (patch) | |
| tree | a33749430672c2457d3ee130f3bfef8414888410 /src | |
| parent | 823013349ffc58e243560f21886152cc62917f1d (diff) | |
| download | rust-03474943ec5cfd713064e085000cfe9f405a28ef.tar.gz rust-03474943ec5cfd713064e085000cfe9f405a28ef.zip | |
ScalarPair for two element tuples was treated wrongly in closure calls
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/terminator/mod.rs | 36 | ||||
| m--------- | src/tools/miri | 10 |
2 files changed, 29 insertions, 17 deletions
diff --git a/src/librustc_mir/interpret/terminator/mod.rs b/src/librustc_mir/interpret/terminator/mod.rs index 634a0c9ada8..9151bfbdd1b 100644 --- a/src/librustc_mir/interpret/terminator/mod.rs +++ b/src/librustc_mir/interpret/terminator/mod.rs @@ -291,10 +291,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { // and need to pack arguments Abi::Rust => { trace!( - "arg_locals: {:?}", + "arg_locals: {:#?}", self.frame().mir.args_iter().collect::<Vec<_>>() ); - trace!("args: {:?}", args); + trace!("args: {:#?}", args); let local = arg_locals.nth(1).unwrap(); for (i, &valty) in args.into_iter().enumerate() { let dest = self.eval_place(&mir::Place::Local(local).field( @@ -321,10 +321,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { let mut arg_locals = self.frame().mir.args_iter(); trace!("ABI: {:?}", sig.abi); trace!( - "arg_locals: {:?}", + "arg_locals: {:#?}", self.frame().mir.args_iter().collect::<Vec<_>>() ); - trace!("args: {:?}", args); + trace!("args: {:#?}", args); match sig.abi { Abi::RustCall => { assert_eq!(args.len(), 2); @@ -376,14 +376,26 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { } break; } - let dest = self.eval_place(&mir::Place::Local( - arg_locals.next().unwrap(), - ))?; - let valty = ValTy { - value: other, - ty: layout.ty, - }; - self.write_value(valty, dest)?; + { + let mut write_next = |value| { + let dest = self.eval_place(&mir::Place::Local( + arg_locals.next().unwrap(), + ))?; + let valty = ValTy { + value: Value::Scalar(value), + ty: layout.ty, + }; + self.write_value(valty, dest) + }; + match other { + Value::Scalar(value) | Value::ScalarPair(value, _) => write_next(value)?, + _ => unreachable!(), + } + if let Value::ScalarPair(_, value) = other { + write_next(value)?; + } + } + assert!(arg_locals.next().is_none()); } } } else { diff --git a/src/tools/miri b/src/tools/miri -Subproject 49ca1746482e3c8221d8e8c7161b7d92ae076c8 +Subproject ac667d372f4094debfb9b7e29041f9e4a874fa6 |
