aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2019-12-17 14:51:06 +0800
committerTobias Kortkamp <tobik@FreeBSD.org>2019-12-17 14:51:06 +0800
commitd8b6bceb82816321795cfe3fe2d2b4b951dda0d1 (patch)
tree1a9f0709cf000c9718979299c097d835b498bb66 /sysutils
parent69a34fb938ed0c9dc68175143e1f2d9193fccfe3 (diff)
downloadfreebsd-ports-gnome-d8b6bceb82816321795cfe3fe2d2b4b951dda0d1.tar.gz
freebsd-ports-gnome-d8b6bceb82816321795cfe3fe2d2b4b951dda0d1.tar.zst
freebsd-ports-gnome-d8b6bceb82816321795cfe3fe2d2b4b951dda0d1.zip
sysutils/flowgger: Unbreak build with Rust 1.40.0 (D22843)
error[E0713]: borrow may still be in use when destructor runs --> .../cargo-crates/url-1.5.1/src/form_urlencoded.rs:251:40 | 249 | impl<'a> Target for ::UrlQuery<'a> { | -- lifetime `'a` defined here 250 | fn as_mut_string(&mut self) -> &mut String { &mut self.url.serialization } 251 | fn finish(self) -> &'a mut ::Url { self.url } | ^^^^^^^^ - here, drop of `self` needs exclusive access to `*self.url`, because the type `UrlQuery<'_>` implements the `Drop` trait | | | returning this value requires that `*self.url` is borrowed for `'a` error: aborting due to previous error
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/flowgger/files/patch-rust-1.40.055
1 files changed, 55 insertions, 0 deletions
diff --git a/sysutils/flowgger/files/patch-rust-1.40.0 b/sysutils/flowgger/files/patch-rust-1.40.0
new file mode 100644
index 000000000000..4d18b80af7bc
--- /dev/null
+++ b/sysutils/flowgger/files/patch-rust-1.40.0
@@ -0,0 +1,55 @@
+From 2efa106431e6fb15b73478f67e37cb307bac2be6 Mon Sep 17 00:00:00 2001
+From: Simon Sapin <simon.sapin@exyr.org>
+Date: Wed, 4 Jul 2018 22:18:36 +0200
+Subject: [PATCH] Fix a lifetime bug uncovered by NLL, thanks @lqd
+
+--- cargo-crates/url-1.5.1/src/form_urlencoded.rs.orig 2017-06-25 04:39:47 UTC
++++ cargo-crates/url-1.5.1/src/form_urlencoded.rs
+@@ -247,8 +247,16 @@ impl<'a> Target for &'a mut String {
+ // * `Serializer` keeps its target in a private field
+ // * Unlike in other `Target` impls, `UrlQuery::finished` does not return `Self`.
+ impl<'a> Target for ::UrlQuery<'a> {
+- fn as_mut_string(&mut self) -> &mut String { &mut self.url.serialization }
+- fn finish(self) -> &'a mut ::Url { self.url }
++ fn as_mut_string(&mut self) -> &mut String {
++ &mut self.url.as_mut().unwrap().serialization
++ }
++
++ fn finish(mut self) -> &'a mut ::Url {
++ let url = self.url.take().unwrap();
++ url.restore_already_parsed_fragment(self.fragment.take());
++ url
++ }
++
+ type Finished = &'a mut ::Url;
+ }
+
+--- cargo-crates/url-1.5.1/src/lib.rs.orig 2017-06-25 04:39:47 UTC
++++ cargo-crates/url-1.5.1/src/lib.rs
+@@ -1283,7 +1283,7 @@ impl Url {
+ self.serialization.push('?');
+ }
+
+- let query = UrlQuery { url: self, fragment: fragment };
++ let query = UrlQuery { url: Some(self), fragment: fragment };
+ form_urlencoded::Serializer::for_suffix(query, query_start + "?".len())
+ }
+
+@@ -2347,13 +2347,15 @@ fn io_error<T>(reason: &str) -> io::Result<T> {
+ /// Implementation detail of `Url::query_pairs_mut`. Typically not used directly.
+ #[derive(Debug)]
+ pub struct UrlQuery<'a> {
+- url: &'a mut Url,
++ url: Option<&'a mut Url>,
+ fragment: Option<String>,
+ }
+
+ impl<'a> Drop for UrlQuery<'a> {
+ fn drop(&mut self) {
+- self.url.restore_already_parsed_fragment(self.fragment.take())
++ if let Some(url) = self.url.take() {
++ url.restore_already_parsed_fragment(self.fragment.take())
++ }
+ }
+ }
+