git: d837a596e953 - main - www/tor-browser: fix build: "pub _base: root::std::__1::_And<_Pred>, not found in this scope"

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sun, 30 Jun 2024 10:47:01 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d837a596e953c5327029050a030f37ec65441f1d

commit d837a596e953c5327029050a030f37ec65441f1d
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2024-06-30 10:38:51 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-06-30 10:46:25 +0000

    www/tor-browser: fix build: "pub _base: root::std::__1::_And<_Pred>, not found in this scope"
    
    error[E0412]: cannot find type `_Pred` in this scope
         --> /tmp/work/usr/ports/www/tor-browser/work/.build/x86_64-unknown-freebsd/release/build/style-ea1857e57f097f7a/out/gecko/structs.rs:34456:49
          |
    34456 |                 pub _base: root::std::__1::_And<_Pred>,
          |                                                 ^^^^^ not found in this scope
          |
    help: you might be missing a type parameter
          |
    34455 |             pub struct tuple__EnableUTypesCtor<_Pred> {
          |                                               +++++++
    
    Add patches from www/firefox-esr to fix this error and other.
    
    PR:             279693
    Approved by:    Martin Filla <freebsd@sysctl.cz> (maintainer)
---
 www/tor-browser/files/patch-bug1841919 | 75 ++++++++++++++++++++++++++++++++++
 www/tor-browser/files/patch-bug1873379 | 34 +++++++++++++++
 www/tor-browser/files/patch-bug1874059 | 25 ++++++++++++
 3 files changed, 134 insertions(+)

diff --git a/www/tor-browser/files/patch-bug1841919 b/www/tor-browser/files/patch-bug1841919
new file mode 100644
index 000000000000..93bd00f462ae
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1841919
@@ -0,0 +1,75 @@
+commit 54ebf78999815570c3cd4d94bf00daa7dec6061d
+Author: Mike Hommey <mh+mozilla@glandium.org>
+Date:   Thu Jul 6 02:34:07 2023 +0000
+
+    Bug 1841919 - Fix "variable does not need to be mutable" warnings in webrender. r=gfx-reviewers,lsalzman
+    
+    Differential Revision: https://phabricator.services.mozilla.com/D182851
+
+diff --git gfx/wr/webrender/src/compositor/sw_compositor.rs gfx/wr/webrender/src/compositor/sw_compositor.rs
+index e623870c86f3..854fef6fe2b9 100644
+--- gfx/wr/webrender/src/compositor/sw_compositor.rs
++++ gfx/wr/webrender/src/compositor/sw_compositor.rs
+@@ -1026,7 +1026,7 @@ impl SwCompositor {
+         if let Some(surface) = self.surfaces.get_mut(id) {
+             if let Some(external_image) = surface.external_image {
+                 assert!(!surface.tiles.is_empty());
+-                let mut tile = &mut surface.tiles[0];
++                let tile = &mut surface.tiles[0];
+                 if let Some(info) = self.composite_surfaces.get(&external_image) {
+                     tile.valid_rect = DeviceIntRect::from_size(info.size);
+                     return;
+diff --git gfx/wr/webrender/src/picture.rs gfx/wr/webrender/src/picture.rs
+index bd685d48a113..72c0e1efa038 100644
+--- gfx/wr/webrender/src/picture.rs
++++ gfx/wr/webrender/src/picture.rs
+@@ -2888,7 +2888,7 @@ impl TileCacheInstance {
+         let prim_clip_chain = &prim_instance.vis.clip_chain;
+ 
+         // Accumulate the exact (clipped) local rect in to the parent surface
+-        let mut surface = &mut surfaces[prim_surface_index.0];
++        let surface = &mut surfaces[prim_surface_index.0];
+         surface.clipped_local_rect = surface.clipped_local_rect.union(&prim_clip_chain.pic_coverage_rect);
+ 
+         // If the primitive is directly drawn onto this picture cache surface, then
+diff --git gfx/wr/webrender_api/src/display_item_cache.rs gfx/wr/webrender_api/src/display_item_cache.rs
+index 6cd1eb3e3a44..60d41c591d36 100644
+--- gfx/wr/webrender_api/src/display_item_cache.rs
++++ gfx/wr/webrender_api/src/display_item_cache.rs
+@@ -58,13 +58,13 @@ pub struct DisplayItemCache {
+ 
+ impl DisplayItemCache {
+     fn add_item(&mut self, key: ItemKey, item: CachedDisplayItem) {
+-        let mut entry = &mut self.entries[key as usize];
++        let entry = &mut self.entries[key as usize];
+         entry.items.push(item);
+         entry.occupied = true;
+     }
+ 
+     fn clear_entry(&mut self, key: ItemKey) {
+-        let mut entry = &mut self.entries[key as usize];
++        let entry = &mut self.entries[key as usize];
+         entry.items.clear();
+         entry.occupied = false;
+     }
+commit 8300555a01bdcc478ae103dcf2b469bf24e4dd41
+Author: Mike Hommey <mh+mozilla@glandium.org>
+Date:   Thu Jul 6 04:26:41 2023 +0000
+
+    Bug 1841919 - Fix "variable does not need to be mutable" warning in wrench. r=gfx-reviewers,jrmuizel
+    
+    Differential Revision: https://phabricator.services.mozilla.com/D182858
+
+diff --git gfx/wr/wrench/src/reftest.rs gfx/wr/wrench/src/reftest.rs
+index 136a4477205d..0e900224b883 100644
+--- gfx/wr/wrench/src/reftest.rs
++++ gfx/wr/wrench/src/reftest.rs
+@@ -514,7 +514,7 @@ impl ReftestManifest {
+                         max_difference: options.allow_max_difference,
+                         num_differences: options.allow_num_differences }),
+                 1 => {
+-                    let mut fuzzy = &mut fuzziness[0];
++                    let fuzzy = &mut fuzziness[0];
+                     fuzzy.max_difference = cmp::max(fuzzy.max_difference, options.allow_max_difference);
+                     fuzzy.num_differences = cmp::max(fuzzy.num_differences, options.allow_num_differences);
+                 },
diff --git a/www/tor-browser/files/patch-bug1873379 b/www/tor-browser/files/patch-bug1873379
new file mode 100644
index 000000000000..658bc576eef1
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1873379
@@ -0,0 +1,34 @@
+commit 627cc80defb3fa48e82ce656536d666176b9f8d1
+Author: Emilio Cobos Álvarez <emilio@crisal.io>
+Date:   Sat Jan 13 14:35:33 2024 +0000
+
+    Bug 1873379 - Ignore std::tuple harder. r=firefox-style-system-reviewers,zrhoffman
+    
+    In libc++ 18 it seems to be in a nested namespace. Make sure to account
+    for that.
+    
+    Differential Revision: https://phabricator.services.mozilla.com/D198398
+
+diff --git layout/style/ServoBindings.toml layout/style/ServoBindings.toml
+index 2aea31f8f911..2deafbfb14b6 100644
+--- layout/style/ServoBindings.toml
++++ layout/style/ServoBindings.toml
+@@ -366,6 +366,9 @@ opaque-types = [
+     "std::namespace::atomic___base", "std::atomic__My_base",
+     "std::atomic",
+     "std::atomic___base",
++    "std::tuple.*", # Causes "Cannot find type _Pred in this scope" error on mac, like rust-skia#571
++    "std::.*::tuple.*",
++
+     # We want everything but FontVariation and Float to be opaque but we don't
+     # have negative regexes.
+     "mozilla::gfx::(.{0,4}|.{6,12}|.{14,}|([^F][^o][^n][^t][^V][^a][^r][^i][^a][^t][^i][^o][^n])|([^F][^l][^o][^a][^t]))",
+@@ -391,8 +394,6 @@ opaque-types = [
+                             # for clang.
+     "mozilla::SeenPtrs",
+     "mozilla::SupportsWeakPtr",
+-    "std::tuple",
+-    "std::tuple_.*", # Causes "Cannot find type _Pred in this scope" error on mac, like rust-skia#571
+     "SupportsWeakPtr",
+     "mozilla::detail::WeakReference",
+     "mozilla::WeakPtr",
diff --git a/www/tor-browser/files/patch-bug1874059 b/www/tor-browser/files/patch-bug1874059
new file mode 100644
index 000000000000..3fa954ef9def
--- /dev/null
+++ b/www/tor-browser/files/patch-bug1874059
@@ -0,0 +1,25 @@
+commit 56c888446600991803fd92d668349101ad4bf160
+Author: Christoph Moench-Tegeder <cmt@burggraben.net>
+Date:   Tue Feb 6 22:51:27 2024 +0100
+
+    switch to -fvisibility flags
+    
+    this fixes linkage with llvm18 (which does not like the former
+    approach via the #pragma in gcc_hidden.h
+    
+    PR: 276746
+    Submitted by: dim@
+
+diff --git build/moz.configure/toolchain.configure build/moz.configure/toolchain.configure
+index d08b748db250..4696f69153f6 100644
+--- build/moz.configure/toolchain.configure
++++ build/moz.configure/toolchain.configure
+@@ -2186,7 +2186,7 @@ set_define("_LIBCPP_HIDE_FROM_ABI", libcxx_override_visibility.hide_from_abi)
+ @depends(target, build_environment)
+ def visibility_flags(target, env):
+     if target.os != "WINNT":
+-        if target.kernel == "Darwin":
++        if target.kernel == "Darwin" or target.kernel == "FreeBSD":
+             return ("-fvisibility=hidden", "-fvisibility-inlines-hidden")
+         return (
+             "-I%s/system_wrappers" % os.path.join(env.dist),