-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type inference regression #38535
Comments
Also fails in 92d4600, so #38099 is not to blame. New diff: 71c06a5...92d4600 I don’t have another guess, and doing a full bisect would take a very long time… |
I can't find the cause in that range, at least nothing changed in the compiler AFAICT. |
Expanding the diff --git a/components/style/font_face.rs b/components/style/font_face.rs
index 70f904c17a..a3d0ca3882 100644
--- a/components/style/font_face.rs
+++ b/components/style/font_face.rs
@@ -62,7 +62,10 @@ impl ToCss for FontFaceRule {
// Serialization of FontFaceRule is not specced.
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));
+ match self.family.to_css(dest) {
+ Err(err) => return Err(err),
+ Ok(_) => {}
+ };
try!(dest.write_str(";"));
if self.sources.len() > 0 { (Even simplifying it, this is not using error[E0282]: unable to infer enough type information about `T`
--> /home/simon/projects/servo2/components/style/font_face.rs:66:13
|
66 | Err(err) => return Err(err),
| ^^^^^^^^ cannot infer type for `T`
|
= note: type annotations or generic parameter binding required
error: aborting due to previous error |
@SimonSapin Alright, that matches what I've seen from @nox. |
Swapping the order of the two error[E0282]: unable to infer enough type information about `T`
--> /home/simon/projects/servo2/components/style/font_face.rs:66:13
|
66 | Ok(_) => {}
| ^^^^^ cannot infer type for `T`
|
= note: type annotations or generic parameter binding required
error: aborting due to previous error Changing the error[E0282]: unable to infer enough type information about `E`
--> /home/simon/projects/servo2/components/style/font_face.rs:66:13
|
66 | Ok(()) => {}
| ^^^^^^ cannot infer type for `E`
|
= note: type annotations or generic parameter binding required
error: aborting due to previous error Hacking |
New range, based on @eddyb-guided manual bisect: 58d58c2 good, 551cb06 bad. Diff: 58d58c2...551cb06, which leaves only #38171 in-between. CC @jseyfried, @nrc. Also found more clues. More context for the code where the error happens: use computed_values::font_family::FontFamily;
pub struct FontFaceRule {
pub family: FontFamily,
// ...
}
impl ToCss for FontFaceRule {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
// ...
try!(self.family.to_css(dest));
// ..
}
}
macro_rules! reexport_computed_values {
( $( $name: ident )+ ) => {
pub mod computed_values {
$(
pub use properties::longhands::$name::computed_value as $name;
)+
}
}
}
// Invoke reexport_computed_values! with a list of idents generated by Python code
longhand_properties_idents!(reexport_computed_values); If I add a similar pub mod computed_values_no_macro {
pub use properties::longhands::font_family::computed_value as font_family;
} or if I change the original code to use the real path without going through a … only to uncover another one: error: internal compiler error: cat_expr Errd
--> /home/simon/projects/servo/target/debug/build/style-9107aeac634bb1f9/out/properties.rs:75381:40
|
75381 | align_items::center => align_self::center,
| ^^^^^^^^^^^^^^^^^^
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/simon/projects/rust/src/librustc_errors/lib.rs:382
stack backtrace:
1: 0x7f2b65e50e53 - std::sys::imp::backtrace::tracing::imp::write::h34c2fe4536cff926
2: 0x7f2b65e5f63d - std::panicking::default_hook::{{closure}}::he19e50a2201d99c4
3: 0x7f2b65e5f1db - std::panicking::default_hook::h954c9f5a176f6e88
4: 0x7f2b65e5fac8 - std::panicking::rust_panic_with_hook::h12277e75a2b70114
5: 0x7f2b5f5f46b7 - std::panicking::begin_panic::hc146ae5a0122e959
6: 0x7f2b5f609d9a - rustc_errors::Handler::abort_if_errors::h714fd9b9b0557ee7
7: 0x7f2b645c6f1f - rustc_passes::consts::check_crate::h2923cde18866be7c
8: 0x7f2b661f4e49 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h1fd32502995d307a
9: 0x7f2b661f163e - rustc_driver::driver::phase_3_run_analysis_passes::hfd6790d5cb183751
10: 0x7f2b661d6091 - rustc_driver::driver::compile_input::h0e69e9ade6aaa4c7
11: 0x7f2b6621f441 - rustc_driver::run_compiler::h72646ffc571b7660
12: 0x7f2b6613454b - std::panicking::try::do_call::hbf38fb785c7d412c
13: 0x7f2b65e68b66 - __rust_maybe_catch_panic
14: 0x7f2b66155aa1 - <F as alloc::boxed::FnBox<A>>::call_box::h55b6e5fdb729b74d
15: 0x7f2b65e5e4d0 - std::sys::imp::thread::Thread::new::thread_start::h0578282da79025df
16: 0x7f2b5ed9e453 - start_thread
17: 0x7f2b65b257de - __GI___clone
18: 0x0 - <unknown> |
Found another ICE, I don’t know if it’s related: #38556. |
Found a smaller test case for the inference issue: fn main() {}
pub mod a {
pub struct FontFamily;
impl FontFamily {
pub fn to_css(&self) -> ::std::fmt::Result {
Ok(())
}
}
}
macro_rules! reexport {
() => {
mod b {
pub use a;
}
}
}
reexport!();
pub mod c {
use b::a::FontFamily;
struct FontFace {
family: FontFamily
}
impl FontFace {
pub fn to_css(&self) -> ::std::fmt::Result {
try!(self.family.to_css());
Ok(())
}
}
} |
@SimonSapin That "other ICE" is actually a direct observation of the bug, whereas this inference issue is some weird side-effect of the way we handle errors that don't stop compilation. |
never mind, apparently it fails locally |
triage: P-high Seems bad. Assigning to @jseyfried based on bisection. |
Does this affect beta (3f9823d)? |
@nikomatsakis At the moment the latest successful nightly build is 3 days old. I don’t know how often playpen’s nigthly is updated. #38499 merged 2 days ago. (This is the rollup PR that merged #38171, which introduced this issue if I did my manual bisecting correctly.) @arielb1 As far as I can tell no, 551cb06 is not reachable from 3f9823d and so beta is not affected. |
Fixed in #38566. |
Update to rustc 1.16.0-nightly (4ecc85beb 2016-12-28) <s>**This is not ready to land** since there is no corresponding Nightly build of Rust yet.</s> Update: we got a Nightly build on 2016-12-29: http://rusty-dash.com/nightlies I made these changes to check that rust-lang/rust#38566 fixes rust-lang/rust#38535 (which it does, yay!) so I might as well publish them, we’ll need them soon enough. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14689) <!-- Reviewable:end -->
…12-28) (from servo:rustup); r=Manishearth <s>**This is not ready to land** since there is no corresponding Nightly build of Rust yet.</s> Update: we got a Nightly build on 2016-12-29: http://rusty-dash.com/nightlies I made these changes to check that rust-lang/rust#38566 fixes rust-lang/rust#38535 (which it does, yay!) so I might as well publish them, we’ll need them soon enough. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 9bdd0f401a89398fb2ecd4f6b54691a7c93b2e53
…12-28) (from servo:rustup); r=Manishearth <s>**This is not ready to land** since there is no corresponding Nightly build of Rust yet.</s> Update: we got a Nightly build on 2016-12-29: http://rusty-dash.com/nightlies I made these changes to check that rust-lang/rust#38566 fixes rust-lang/rust#38535 (which it does, yay!) so I might as well publish them, we’ll need them soon enough. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 9bdd0f401a89398fb2ecd4f6b54691a7c93b2e53 UltraBlame original commit: 17e25ccaa7dfe2f7c7d88878a1fb5ce5f1888914
…12-28) (from servo:rustup); r=Manishearth <s>**This is not ready to land** since there is no corresponding Nightly build of Rust yet.</s> Update: we got a Nightly build on 2016-12-29: http://rusty-dash.com/nightlies I made these changes to check that rust-lang/rust#38566 fixes rust-lang/rust#38535 (which it does, yay!) so I might as well publish them, we’ll need them soon enough. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 9bdd0f401a89398fb2ecd4f6b54691a7c93b2e53 UltraBlame original commit: 17e25ccaa7dfe2f7c7d88878a1fb5ce5f1888914
…12-28) (from servo:rustup); r=Manishearth <s>**This is not ready to land** since there is no corresponding Nightly build of Rust yet.</s> Update: we got a Nightly build on 2016-12-29: http://rusty-dash.com/nightlies I made these changes to check that rust-lang/rust#38566 fixes rust-lang/rust#38535 (which it does, yay!) so I might as well publish them, we’ll need them soon enough. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 9bdd0f401a89398fb2ecd4f6b54691a7c93b2e53 UltraBlame original commit: 17e25ccaa7dfe2f7c7d88878a1fb5ce5f1888914
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:The
to_css
method being called here is:Its return type is
std::fmt::Result
which istype Result = std::result::Result<(), std::fmt::Error>;
. This call is in another impl of the same method of the same trait: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.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.
The text was updated successfully, but these errors were encountered: