Hi. Since this was just merged (1 day ago), it causes a compilation error when building latest firefox (from the mercurial repo) as follows:
0:05.92 error: use of unstable library feature 'clamp' (see issue #44095)
0:05.92 --> /home/xftroxgpx/build/1packages/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/app_units/src/app_unit.rs:192:22
0:05.92 |
0:05.92 192 | *self = self.clamp()
0:05.92 | ^^^^^
0:05.92 |
0:05.92 = help: add #![feature(clamp)] to the crate attributes to enable
0:05.92
0:05.92 error[E0061]: this function takes 2 parameters but 0 parameters were supplied
0:05.92 --> /home/xftroxgpx/build/1packages/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/app_units/src/app_unit.rs:192:22
0:05.92 |
0:05.92 192 | *self = self.clamp()
0:05.93 | ^^^^^ expected 2 parameters
0:05.93
0:05.93 error[E0308]: mismatched types
0:05.93 --> /home/xftroxgpx/build/1packages/firefox-hg/makepkg_pacman/firefox-hg/src/firefox-hg/third_party/rust/app_units/src/app_unit.rs:192:17
0:05.93 |
0:05.93 192 | *self = self.clamp()
0:05.93 | ^^^^^^^^^^^^ expected struct `app_unit::Au`, found mutable reference
0:05.93 |
0:05.93 = note: expected type `app_unit::Au`
0:05.93 found type `&mut app_unit::Au`
0:05.93 = help: here are some functions which might fulfill your needs:
0:05.93 - .abs()
0:05.94 - .clamp()
0:05.94
0:05.95 error: aborting due to 3 previous errors
0:05.95
0:06.38 error: Could not compile `app_units`.
0:06.38
However clamp is (re?)defined internally:
impl Au {
/// FIXME(pcwalton): Workaround for lack of cross crate inlining of newtype structs!
#[inline]
pub fn new(value: i32) -> Au {
Au(value).clamp()
}
#[inline]
fn clamp(self) -> Self {
if self.0 > MAX_AU.0 {
MAX_AU
} else if self.0 < MIN_AU.0 {
MIN_AU
} else {
self
}
}
#[inline]
fn clamp_self(&mut self) {
*self = self.clamp()
}
I’m sure this will be fixed in app_units when the time comes, but I just wanted to mention it.
EDIT: Thanks for the fix (I have, for now, manually tested it to successfully compile latest firefox from mercurial repo; the pull for this to work auto seems on its way)