diff --git a/src/refine/template.rs b/src/refine/template.rs index 3419ae67..246688cc 100644 --- a/src/refine/template.rs +++ b/src/refine/template.rs @@ -625,8 +625,8 @@ where rty::RefinedType::unrefined( self.inner .for_template(self.registry) - .with_scope(&builder) - .build(param_ty.ty), + .build(param_ty.ty) + .vacuous(), ) } }); diff --git a/tests/ui/fail/option_param_order.rs b/tests/ui/fail/option_param_order.rs new file mode 100644 index 00000000..ff668922 --- /dev/null +++ b/tests/ui/fail/option_param_order.rs @@ -0,0 +1,15 @@ +//@error-in-other-file: Unsat +//@compile-flags: -C debug-assertions=off + +fn get_or(o: Option, d: i64) -> i64 { + match o { + Some(x) => x, + None => d, + } +} + +fn main() { + assert!(get_or(Some(1), 9) == 1); + // `get_or` returns the default in the `None` case, so this assertion does not hold + assert!(get_or(None, 9) == 1); +} diff --git a/tests/ui/pass/option_param_order.rs b/tests/ui/pass/option_param_order.rs new file mode 100644 index 00000000..468f5b8f --- /dev/null +++ b/tests/ui/pass/option_param_order.rs @@ -0,0 +1,14 @@ +//@check-pass +//@compile-flags: -C debug-assertions=off + +fn get_or(o: Option, d: i64) -> i64 { + match o { + Some(x) => x, + None => d, + } +} + +fn main() { + assert!(get_or(Some(1), 9) == 1); + assert!(get_or(None, 9) == 9); +}