Skip to content
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

ICE: None != Some(()) with method call on unknown type #19297

Closed
huonw opened this issue Nov 25, 2014 · 2 comments · Fixed by #19813
Closed

ICE: None != Some(()) with method call on unknown type #19297

huonw opened this issue Nov 25, 2014 · 2 comments · Fixed by #19813
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@huonw
Copy link
Member

huonw commented Nov 25, 2014

fn main() {
    [].sort_by(| a, b | a.partial_cmp(b))
}
ice5.rs:2:27: 2:41 error: the type of this value must be known in this context
ice5.rs:2     [].sort_by(| a, b | a.partial_cmp(b))
                                    ^~~~~~~~~~~~~~
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `None`, right: `Some(())`)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/typeck/check/method/confirm.rs:152
@huonw huonw added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 25, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue Nov 27, 2014
Just saw this when looking at rust-lang#19297 and couldn't find an issue/PR dealing with this. rust-lang#18773 seems to have missed this file.

Compiler output is generated [here](https://github.com/rust-lang/rust/blob/770378a313a573776b16237a46b75bafa49072c1/src/librustc_trans/driver/mod.rs#L466).

cc @steveklabnik
@barosl
Copy link
Contributor

barosl commented Dec 13, 2014

The ICE seems to be caused by a bug in auto-dereferencing. Taking the following code as an example,

[].split(|x| x.clone()); // This code causes an ICE, but
[].split(|&x| x.clone()); // This code doesn't cause an ICE

This should be fixed by #19813.

barosl added a commit to barosl/rust that referenced this issue Dec 19, 2014
check::autoderef() returns a ty_err when it fails to infer the type.
probe::probe() should respect this failure and fail together to prevent
further corruption.

Call stack: check::check_method_call() -> method::lookup() ->
            probe::probe() + confirm::confirm()

Fixes rust-lang#19692.
Fixes rust-lang#19583.
Fixes rust-lang#19297.
bors added a commit that referenced this issue Dec 24, 2014
…kfelix

`check::autoderef()` returns a `ty_err` when it fails to infer the type. `probe::probe()` should respect this failure and fail together to prevent further corruption.

Fixes #19692.
Fixes #19583.
Fixes #19297.
@swgillespie
Copy link
Contributor

I've got another repro of what looks to be the same issue, if it's helpful. Moving the &mut on line 9 to its correct location in front of fmt::Formatter doesn't ICE.

Code: https://gist.github.com/swgillespie/a1c7bf117f2fadfd2504
Output: https://gist.github.com/swgillespie/bb5e353c6a14eee3b193

bors added a commit that referenced this issue Dec 24, 2014
…kfelix

`check::autoderef()` returns a `ty_err` when it fails to infer the type. `probe::probe()` should respect this failure and fail together to prevent further corruption.

Fixes #19692.
Fixes #19583.
Fixes #19297.
lnicola pushed a commit to lnicola/rust that referenced this issue Mar 10, 2025
Adjust relevance scoring threshold to consistent with existing implem…
lnicola pushed a commit to lnicola/rust that referenced this issue Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants