Skip to content

Commit 5d110c3

Browse files
committed
WIP: firefox: backport some changes to fix build with newer rust
* cssparser fails to build with: error[E0425]: cannot find value `MAX_LENGTH` in this scope error[E0425]: cannot find value `MAP` in this scope as shown in: http://errors.yoctoproject.org/Errors/Details/731831/ which leads to rust-lang/rust#76480 https://bugzilla.mozilla.org/show_bug.cgi?id=1663677 * but this still isn't enough to build firefox with current rust 1.71.0 in oe-core I've tried to backport multiple changes like: https://bugzilla.mozilla.org/show_bug.cgi?id=1663715#c5 https://hg.mozilla.org/releases/mozilla-esr78/rev/5db8c1e9f643ec26fc93e7a3fc7a90c742b11030 https://hg.mozilla.org/releases/mozilla-esr78/rev/6445a3a0e81d6aeeaa976be784edf2de9fab84de https://hg.mozilla.org/mozilla-central/rev/e2cede25c027 https://phabricator.services.mozilla.com/D89473 https://hg.mozilla.org/mozilla-central/rev/da77d5528a08 https://phabricator.services.mozilla.com/D83816 * but it's neverending story of more and more fixes and esr68 is just too old and not worth spending more time on it (just to measure build time across different Yocto releases) * still doesn't build http://errors.yoctoproject.org/Errors/Details/731829/ Signed-off-by: Martin Jansa <[email protected]>
1 parent 8e048d0 commit 5d110c3

8 files changed

+12556
-0
lines changed

meta-firefox/recipes-browser/firefox/firefox/0002-Backport-D89473-to-fix-build-with-newer-rust.patch

Lines changed: 584 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
From bd43c2d63ed843668fe8cbc1b7cf4c3f67f4a9da Mon Sep 17 00:00:00 2001
2+
From: Martin Jansa <[email protected]>
3+
Date: Wed, 16 Aug 2023 19:56:58 +0200
4+
Subject: [PATCH] Backport D83816 to fix build with newer rust
5+
6+
Upstream-Status: Backport [https://hg.mozilla.org/mozilla-central/rev/da77d5528a08]
7+
---
8+
servo/components/derive_common/cg.rs | 22 +++++++++----------
9+
.../style_derive/to_computed_value.rs | 4 +++-
10+
2 files changed, 14 insertions(+), 12 deletions(-)
11+
12+
diff --git a/servo/components/derive_common/cg.rs b/servo/components/derive_common/cg.rs
13+
index 7a8fbc2440..f66b7cde19 100644
14+
--- a/servo/components/derive_common/cg.rs
15+
+++ b/servo/components/derive_common/cg.rs
16+
@@ -131,19 +131,19 @@ pub fn fmap_trait_output(input: &DeriveInput, trait_path: &Path, trait_output: &
17+
segment.into()
18+
}
19+
20+
-pub fn map_type_params<F>(ty: &Type, params: &[&TypeParam], f: &mut F) -> Type
21+
+pub fn map_type_params<F>(ty: &Type, params: &[&TypeParam], self_type: &Path, f: &mut F) -> Type
22+
where
23+
F: FnMut(&Ident) -> Type,
24+
{
25+
match *ty {
26+
Type::Slice(ref inner) => Type::from(TypeSlice {
27+
- elem: Box::new(map_type_params(&inner.elem, params, f)),
28+
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
29+
..inner.clone()
30+
}),
31+
Type::Array(ref inner) => {
32+
//ref ty, ref expr) => {
33+
Type::from(TypeArray {
34+
- elem: Box::new(map_type_params(&inner.elem, params, f)),
35+
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
36+
..inner.clone()
37+
})
38+
},
39+
@@ -152,7 +152,7 @@ where
40+
elems: inner
41+
.elems
42+
.iter()
43+
- .map(|ty| map_type_params(&ty, params, f))
44+
+ .map(|ty| map_type_params(&ty, params, self_type, f))
45+
.collect(),
46+
..inner.clone()
47+
}),
48+
@@ -167,7 +167,7 @@ where
49+
}
50+
Type::from(TypePath {
51+
qself: None,
52+
- path: map_type_params_in_path(path, params, f),
53+
+ path: map_type_params_in_path(path, params, self_type, f),
54+
})
55+
},
56+
Type::Path(TypePath {
57+
@@ -175,21 +175,21 @@ where
58+
ref path,
59+
}) => Type::from(TypePath {
60+
qself: qself.as_ref().map(|qself| QSelf {
61+
- ty: Box::new(map_type_params(&qself.ty, params, f)),
62+
+ ty: Box::new(map_type_params(&qself.ty, params, self_type, f)),
63+
position: qself.position,
64+
..qself.clone()
65+
}),
66+
- path: map_type_params_in_path(path, params, f),
67+
+ path: map_type_params_in_path(path, params, self_type, f),
68+
}),
69+
Type::Paren(ref inner) => Type::from(TypeParen {
70+
- elem: Box::new(map_type_params(&inner.elem, params, f)),
71+
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
72+
..inner.clone()
73+
}),
74+
ref ty => panic!("type {:?} cannot be mapped yet", ty),
75+
}
76+
}
77+
78+
-fn map_type_params_in_path<F>(path: &Path, params: &[&TypeParam], f: &mut F) -> Path
79+
+fn map_type_params_in_path<F>(path: &Path, params: &[&TypeParam], self_type: &Path, f: &mut F) -> Path
80+
where
81+
F: FnMut(&Ident) -> Type,
82+
{
83+
@@ -209,11 +209,11 @@ where
84+
.map(|arg| match arg {
85+
ty @ &GenericArgument::Lifetime(_) => ty.clone(),
86+
&GenericArgument::Type(ref data) => {
87+
- GenericArgument::Type(map_type_params(data, params, f))
88+
+ GenericArgument::Type(map_type_params(data, params, self_type, f))
89+
},
90+
&GenericArgument::Binding(ref data) => {
91+
GenericArgument::Binding(Binding {
92+
- ty: map_type_params(&data.ty, params, f),
93+
+ ty: map_type_params(&data.ty, params, self_type, f),
94+
..data.clone()
95+
})
96+
},
97+
diff --git a/servo/components/style_derive/to_computed_value.rs b/servo/components/style_derive/to_computed_value.rs
98+
index ed6e07a2f5..c9b3b70051 100644
99+
--- a/servo/components/style_derive/to_computed_value.rs
100+
+++ b/servo/components/style_derive/to_computed_value.rs
101+
@@ -58,6 +58,8 @@ pub fn derive_to_value(
102+
cg::add_predicate(&mut where_clause, parse_quote!(#param: #trait_path));
103+
}
104+
105+
+ let computed_value_type = cg::fmap_trait_output(&input, &trait_path, &output_type_name);
106+
+
107+
let to_body = cg::fmap_match(&input, bind_style, |binding| {
108+
if field_bound(&binding) {
109+
let ty = &binding.ast().ty;
110+
@@ -65,6 +67,7 @@ pub fn derive_to_value(
111+
let output_type = cg::map_type_params(
112+
ty,
113+
&params,
114+
+ &computed_value_type,
115+
&mut |ident| parse_quote!(<#ident as #trait_path>::#output_type_name),
116+
);
117+
118+
@@ -84,7 +87,6 @@ pub fn derive_to_value(
119+
120+
input.generics.where_clause = where_clause;
121+
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
122+
- let computed_value_type = cg::fmap_trait_output(&input, &trait_path, &output_type_name);
123+
124+
let impl_ = trait_impl(from_body, to_body);
125+

0 commit comments

Comments
 (0)