From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/variance/variance-cell-is-invariant.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/ui/variance/variance-cell-is-invariant.rs (limited to 'tests/ui/variance/variance-cell-is-invariant.rs') diff --git a/tests/ui/variance/variance-cell-is-invariant.rs b/tests/ui/variance/variance-cell-is-invariant.rs new file mode 100644 index 000000000..62ce4f91f --- /dev/null +++ b/tests/ui/variance/variance-cell-is-invariant.rs @@ -0,0 +1,19 @@ +// Test that Cell is considered invariant with respect to its +// type. + +use std::cell::Cell; + +struct Foo<'a> { + x: Cell>, +} + +fn use_<'short,'long>(c: Foo<'short>, + s: &'short isize, + l: &'long isize, + _where:Option<&'short &'long ()>) { + let _: Foo<'long> = c; + //~^ ERROR lifetime may not live long enough +} + +fn main() { +} -- cgit v1.2.3