From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/lambda-infer-unresolved.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/ui/lambda-infer-unresolved.rs (limited to 'tests/ui/lambda-infer-unresolved.rs') diff --git a/tests/ui/lambda-infer-unresolved.rs b/tests/ui/lambda-infer-unresolved.rs new file mode 100644 index 000000000..9cc466b28 --- /dev/null +++ b/tests/ui/lambda-infer-unresolved.rs @@ -0,0 +1,15 @@ +// run-pass + +#![allow(unused_mut)] +// This should typecheck even though the type of e is not fully +// resolved when we finish typechecking the ||. + + +struct Refs { refs: Vec , n: isize } + +pub fn main() { + let mut e = Refs{refs: vec![], n: 0}; + let _f = || println!("{}", e.n); + let x: &[isize] = &e.refs; + assert_eq!(x.len(), 0); +} -- cgit v1.2.3