diff --git a/owning_ref-pr43-fix-tests.patch b/owning_ref-pr43-fix-tests.patch new file mode 100644 index 0000000..604b775 --- /dev/null +++ b/owning_ref-pr43-fix-tests.patch @@ -0,0 +1,51 @@ +From f629c7b7db163a919cdd6a353c3318b1d66d5fad Mon Sep 17 00:00:00 2001 +From: Alexandre Bury +Date: Wed, 10 Jan 2018 15:29:34 +0100 +Subject: [PATCH] Fix tests + +Lifetime inference does not work here, we need to define the lifetimes. +But we can't do that with closures [1] so we use a function instead. + +[1]: https://github.com/rust-lang/rust/issues/22340 +--- + src/lib.rs | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/src/lib.rs b/src/lib.rs +index 21ed086..31dae97 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -1262,8 +1262,15 @@ mod tests { + let foo = [413, 612]; + let bar = &foo; + ++ // FIXME: lifetime inference fails us, and we can't easily define a lifetime for a closure ++ // (see https://github.com/rust-lang/rust/issues/22340) ++ // So we use a function to identify the lifetimes instead. ++ fn borrow<'a>(a: &'a &[i32; 2]) -> &'a i32 { ++ &a[0] ++ } ++ + let o: BoxRef<&[i32; 2]> = Box::new(bar).into(); +- let o: BoxRef<&[i32; 2], i32> = o.map(|a: &&[i32; 2]| &a[0]); ++ let o: BoxRef<&[i32; 2], i32> = o.map(borrow); + let o: BoxRef = o.erase_owner(); + + assert_eq!(*o, 413); +@@ -1693,8 +1700,15 @@ mod tests { + let mut foo = [413, 612]; + let bar = &mut foo; + ++ // FIXME: lifetime inference fails us, and we can't easily define a lifetime for a closure ++ // (see https://github.com/rust-lang/rust/issues/22340) ++ // So we use a function to identify the lifetimes instead. ++ fn borrow<'a>(a: &'a mut &mut [i32; 2]) -> &'a mut i32 { ++ &mut a[0] ++ } ++ + let o: BoxRefMut<&mut [i32; 2]> = Box::new(bar).into(); +- let o: BoxRefMut<&mut [i32; 2], i32> = o.map_mut(|a: &mut &mut [i32; 2]| &mut a[0]); ++ let o: BoxRefMut<&mut [i32; 2], i32> = o.map_mut(borrow); + let o: BoxRefMut = o.erase_owner(); + + assert_eq!(*o, 413); diff --git a/rust-owning_ref.spec b/rust-owning_ref.spec index 8ff2d81..c33b952 100644 --- a/rust-owning_ref.spec +++ b/rust-owning_ref.spec @@ -6,12 +6,15 @@ Name: rust-%{crate} Version: 0.3.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Library for creating references that carry their owner with them License: MIT URL: https://crates.io/crates/owning_ref Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# https://github.com/Kimundi/owning-ref-rs/pull/43 +# see also https://github.com/rust-lang/rust/issues/47524 +Patch1: owning_ref-pr43-fix-tests.patch ExclusiveArch: %{rust_arches} @@ -53,6 +56,9 @@ which use %{crate} from crates.io. %{cargo_registry}/%{crate}-%{version}/ %changelog +* Sat Mar 10 2018 Josh Stone - 0.3.3-4 +- fix lifetime inference regression + * Fri Feb 09 2018 Fedora Release Engineering - 0.3.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild