Description
Servo compiles with rustc 71c06a5 2016-12-18, but not with 439c312 2016-12-21. Diff: 71c06a5...439c312
The style
crate fails to build with:
error[E0282]: unable to infer enough type information about `E`
--> /home/simon/projects/servo/components/style/font_face.rs:65:9
|
65 | try!(self.family.to_css(dest));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `E`
|
= note: type annotations or generic parameter binding required
= note: this error originates in a macro outside of the current crate
The to_css
method being called here is:
impl ToCss for FontFamily {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
// ...
}
}
Its return type is std::fmt::Result
which is type Result = std::result::Result<(), std::fmt::Error>;
. This call is in another impl of the same method of the same trait:
impl ToCss for FontFaceRule {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
try!(dest.write_str("@font-face { font-family: "));
try!(self.family.to_css(dest));
try!(dest.write_str(";"));
// ...
}
}
Adding an explicit type annotation works around this error, but only to uncover another very similar one, then another. The third one was in code generated by serde’s derive(Serialize)
, so I gave up that approach.
let r: fmt::Result = self.family.to_css(dest);
try!(r);
So far I haven’t managed to reduce a test case smaller than "most of Servo", sorry.
I’m suspicious of 6ea1fbb (which is part of #38099) because it’s commit message mentions inference. I’m not building a compiler #38099 to confirm.