Closed
Description
When using mismatching versions of the image and the glium_graphics crate (i.e. glium_graphics depends on an older version of image than we do), the following code causes an ICE. The ICE goes away when using a matching version of image.
While reducing the example, the len and index changed, but the difference of two stayed the same.
An example project can be found here: https://github.com/Moredread/rust-ice
I tried this code:
extern crate image;
extern crate glium_graphics;
use glium_graphics::{Glium2d, GliumGraphics, GliumWindow, GlyphCache, Texture, TextureSettings};
use image::{RgbImage, ConvertBuffer};
fn run() {
let mut imgbuf = RgbImage::new(100, 100);
let texture = Texture::from_image(&mut glium_window,
&imgbuf.convert(),
&TextureSettings::new());
}
This causes an ICE:
Compiling somethinggoingwrong v0.1.0 (file:///home/vagrant/rust-ice)
src/main.rs:10:44: 10:56 error: unresolved name `glium_window` [E0425]
src/main.rs:10 let texture = Texture::from_image(&mut glium_window,
^~~~~~~~~~~~
src/main.rs:10:44: 10:56 help: run `rustc --explain E0425` to see a detailed explanation
error: main function not found
src/main.rs:11:39: 11:56 error: mismatched types:
expected `&image::buffer::ImageBuffer<image::color::Rgba<u8>, collections::vec::Vec<u8>>`,
found `&image::buffer::ImageBuffer<_, collections::vec::Vec<_>>`
(expected struct `image::buffer::ImageBuffer`,
found a different struct `image::buffer::ImageBuffer`) [E0308]
src/main.rs:11 &imgbuf.convert(),
^~~~~~~~~~~~~~~~~
src/main.rs:11:39: 11:56 help: run `rustc --explain E0308` to see a detailed explanation
src/main.rs:11:39: 11:56 note: Perhaps two different versions of crate `image` are being used?
src/main.rs:11 &imgbuf.convert(),
^~~~~~~~~~~~~~~~~
error: internal compiler error: unexpected panic
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
thread 'rustc' panicked at 'index out of bounds: the len is 38 but the index is 40', ../src/libcollections/vec.rs:1178
Meta
rustc --version --verbose
:
rustc 1.8.0 (db2939409 2016-04-11)
binary: rustc
commit-hash: db2939409db26ab4904372c82492cd3488e4c44e
commit-date: 2016-04-11
host: x86_64-unknown-linux-gnu
release: 1.8.0
Backtrace:
stack backtrace:
1: 0x7fa99d576330 - sys::backtrace::tracing::imp::write::h3675b4f0ca767761Xcv
2: 0x7fa99d57f68b - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.44519
3: 0x7fa99d57f1e3 - panicking::default_handler::h18faf4fbd296d909lSz
4: 0x7fa99d5439ac - sys_common::unwind::begin_unwind_inner::hfb5d07d6e405c6bbg1t
5: 0x7fa99d544448 - sys_common::unwind::begin_unwind_fmt::h8b491a76ae84af35m0t
6: 0x7fa99d573d91 - rust_begin_unwind
7: 0x7fa99d5c67af - panicking::panic_fmt::h98b8cbb286f5298alcM
8: 0x7fa99d5c6992 - panicking::panic_bounds_check::hdc4cd1d8a44957d1rbM
9: 0x7fa99a89f59f - middle::infer::InferCtxt<'a, 'tcx>::shallow_resolve::h52e879fe14a58134plE
10: 0x7fa99a96fb2b - middle::traits::fulfill::process_predicate::h5da25caa94a4806cjBU
11: 0x7fa99a96e857 - obligation_forest::ObligationForest<O, T>::process_obligations::h1104985789425175896
12: 0x7fa99a969edf - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::h36a34bf1ee9d49d2otU
13: 0x7fa99cb02f01 - check::FnCtxt<'a, 'tcx>::select_obligations_where_possible::hbeb814e1d6536f19JAq
14: 0x7fa99cb299ac - check::check_argument_types::hd87e5db73000b681J0q
15: 0x7fa99cbc133f - check::callee::confirm_builtin_call::h7ffe0a70871d3f9fdbm
16: 0x7fa99cb3b1dd - check::callee::check_call::hf63606df5d983743m2l
17: 0x7fa99cb608f9 - check::check_expr_with_unifier::h5931808240608847095
18: 0x7fa99cb2f33b - check::check_expr_with_unifier::h8776005440523486996
19: 0x7fa99cb29dd8 - check::check_argument_types::hd87e5db73000b681J0q
20: 0x7fa99cbc133f - check::callee::confirm_builtin_call::h7ffe0a70871d3f9fdbm
21: 0x7fa99cb3b1dd - check::callee::check_call::hf63606df5d983743m2l
22: 0x7fa99cb52459 - check::check_expr_with_unifier::h1043101995598655204
23: 0x7fa99cb7851a - check::check_decl_initializer::h870f9bccbaeb3571AQs
24: 0x7fa99cb785c1 - check::check_decl_local::h75884e802bb28f42MRs
25: 0x7fa99cb788a4 - check::check_stmt::h9c1495c8bbfab5b3wTs
26: 0x7fa99cb09333 - check::check_block_with_expected::hc4a627a63732f3b0jXs
27: 0x7fa99cb002b9 - check::check_fn::h6fb1443d16d6d1a1hOo
28: 0x7fa99cafd9cf - check::check_bare_fn::h846d602fffbab51bLDo
29: 0x7fa99caf8876 - check::check_item_body::h1bc79a321f78eb96h3o
30: 0x7fa99caef32b - check::check_item_bodies::h5671f35c802ef7c1yBo
31: 0x7fa99cae6bb3 - check_crate::h7bb847abc9f256eeeCC
32: 0x7fa99daa2667 - driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::closure.28550
33: 0x7fa99daa0c04 - middle::ty::context::ctxt<'tcx>::create_and_enter::h16192426302205697189
34: 0x7fa99da9d6ef - driver::phase_3_run_analysis_passes::h10920926650053012691
35: 0x7fa99da70a15 - driver::compile_input::h7ae6a86e23de0774Hca
36: 0x7fa99da5fb47 - run_compiler::hb0408bcf47642fe6mPc
37: 0x7fa99da5d2c1 - sys_common::unwind::try::try_fn::h7614151098073783683
38: 0x7fa99d573d1b - __rust_try
39: 0x7fa99d56c1fd - sys_common::unwind::inner_try::hadd81c754a64f07ciYt
40: 0x7fa99da5db10 - boxed::F.FnBox<A>::call_box::h18261575856772421581
41: 0x7fa99d57dc59 - sys::thread::Thread::new::thread_start::h9bc812305b5e01feFPy
42: 0x7fa996847473 - start_thread
43: 0x7fa99d1f5acc - clone
44: 0x0 - <unknown>
Metadata
Metadata
Assignees
Labels
No labels