Closed
Description
Goal : Build imagetool
example using only rustc.exe
without Cargo.toml
(we specify the external dependency image
as rustc
option).
Here is the compiler output :
> "%USERPROFILE%\.cargo\bin\rustc.exe" --version
rustc 1.66.1 (90743e729 2023-01-10)
> "%USERPROFILE%\.cargo\bin\rustc.exe" -g --crate-name "imagetool" --crate-type bin --edition 2021 --out-dir "R:\mastering-rust\Chapter02\imgtool\target" --target "x86_64-pc-windows-msvc" -L crate --extern "image=%USERPROFILE%\.cargo\registry\cache\mygithub.libinneed.workers.dev-1ecc6299db9ec823\image-0.24.5.crate" "R:\mastering-rust\Chapter02\imgtool\src\main.rs"
thread 'rustc' panicked at 'identifier: "metadata_crate_location_unknown_type", attr: None, args: FluentArgs([("path", String("%USERPROFILE%\\.cargo\\registry\\cache\\mygithub.libinneed.workers.dev-1ecc6299db9ec823\\image-0.24.5.crate"))]), errors: [ResolverError(Reference(Variable { id: "crate_name" }))]', compiler\rustc_errors\src\translation.rs:105:17
stack backtrace:
0: 0x7ff935df9a62 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc97dbc4fe64c9e1d
1: 0x7ff935e356db - core::fmt::write::ha369a394538739aa
2: 0x7ff935dec18a - <std::io::IoSlice as core::fmt::Debug>::fmt::h479b71bd3dadc1d1
3: 0x7ff935df97ab - std::sys::common::alloc::realloc_fallback::h233ebec439b629e2
4: 0x7ff935dfd109 - std::panicking::default_hook::h0ab9e14ad869b271
5: 0x7ff935dfcd8a - std::panicking::default_hook::h0ab9e14ad869b271
6: 0x7ff8cb0c1d6e - rustc_driver[e9de03b45d14c171]::describe_lints
7: 0x7ff935dfda60 - std::panicking::rust_panic_with_hook::he7a40468954ae645
8: 0x7ff935dfd7bd - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h44bc3105923add49
9: 0x7ff935dfa76f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc97dbc4fe64c9e1d
10: 0x7ff935dfd480 - rust_begin_unwind
11: 0x7ff935e6b5f5 - core::panicking::panic_fmt::h1862038ee9bad685
12: 0x7ff8c97b9f06 - rustc_errors[20be445f3eba0fb3]::emitter::is_case_difference
13: 0x7ff8c97b1284 - <rustc_errors[20be445f3eba0fb3]::emitter::EmitterWriter>::ui_testing
14: 0x7ff8c97abbdc - <rustc_errors[20be445f3eba0fb3]::emitter::EmitterWriter as rustc_errors[20be445f3eba0fb3]::emitter::Emitter>::emit_diagnostic
15: 0x7ff8c97a4271 - <rustc_errors[20be445f3eba0fb3]::HandlerInner>::emit_diagnostic
16: 0x7ff8c97a36d2 - <rustc_errors[20be445f3eba0fb3]::Handler>::emit_diagnostic
17: 0x7ff8cd4935eb - <rustc_errors[20be445f3eba0fb3]::ErrorGuaranteed as rustc_errors[20be445f3eba0fb3]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
18: 0x7ff8ccf9e10a - <rustc_metadata[dac8933e4ad73025]::errors::CannotFindCrate as rustc_errors[20be445f3eba0fb3]::diagnostic_builder::IntoDiagnostic>::into_diagnostic
19: 0x7ff8ccfb7e0b - <rustc_metadata[dac8933e4ad73025]::locator::MetadataError as core[a1be09f172195029]::fmt::Display>::fmt
20: 0x7ff8c954c1af - <rustc_metadata[dac8933e4ad73025]::creader::CrateLoader>::into_cstore
21: 0x7ff8c954e1c5 - <rustc_metadata[dac8933e4ad73025]::creader::CrateLoader>::process_path_extern
22: 0x7ff8ca5c669e - <rustc_resolve[7c01eaad461df3a4]::Resolver>::expect_module
23: 0x7ff8ca62397c - <<rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor>::find_lifetime_for_self::SelfVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
24: 0x7ff8ca62acae - <<rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor>::find_lifetime_for_self::SelfVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
25: 0x7ff8ca628a7e - <<rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor>::find_lifetime_for_self::SelfVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
26: 0x7ff8ca628b5d - <<rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor>::find_lifetime_for_self::SelfVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
27: 0x7ff8ca5f9264 - <rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_local
28: 0x7ff8ca5f8a1a - <rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_block
29: 0x7ff8ca601970 - <rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_fn
30: 0x7ff8ca651cf6 - <rustc_resolve[7c01eaad461df3a4]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
31: 0x7ff8ca611446 - <<rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor>::find_lifetime_for_self::SelfVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
32: 0x7ff8ca5f83dc - <rustc_resolve[7c01eaad461df3a4]::late::LateResolutionVisitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_item
33: 0x7ff8c919f092 - <rustc_builtin_macros[cca7005986e3d0e7]::deriving::generic::find_type_parameters::Visitor as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_ty
34: 0x7ff8c91b2447 - <rustc_resolve[7c01eaad461df3a4]::def_collector::DefCollector as rustc_ast[6de64748d468de7f]::visit::Visitor>::visit_param
35: 0x7ff8c91a81d1 - <rustc_resolve[7c01eaad461df3a4]::Resolver>::resolve_crate
36: 0x7ff8c8917b22 - <rustc_interface[10a7111f9310fd6d]::passes::LintStoreExpandImpl as rustc_expand[c56eb5aee4619b21]::base::LintStoreExpand>::pre_expansion_lint
37: 0x7ff8c890940e - <rustc_interface[10a7111f9310fd6d]::queries::Queries>::expansion
38: 0x7ff8c88dc477 - <rustc_middle[18c13081b174ae21]::ty::SymbolName as core[a1be09f172195029]::fmt::Display>::fmt
39: 0x7ff8c88db6dd - rustc_driver[e9de03b45d14c171]::args::arg_expand_all
40: 0x7ff8c88cc809 - <unknown>
41: 0x7ff8c88c3990 - <unknown>
42: 0x7ff935e0eabc - std::sys::windows::thread::Thread::new::haf1327b4da6a4ac1
43: 0x7ff9988026bd - BaseThreadInitThunk
44: 0x7ff9991adfb8 - RtlUserThreadStart
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.66.1 (90743e729 2023-01-10) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin
query stack during panic:
end of query stack
PS. Rust source file src\main.rs
is :
use std::env;
use std::path::Path;
use std::process;
fn main() {
let arg = env::args().skip(1).next();
if arg.is_none() {
println!("Error: Missing argument specifying the image file");
process::exit(1);
}
let image_path = arg.unwrap();
let path = Path::new(&image_path);
let img = image::open(path).unwrap();
let rotated = img.rotate90();
// do not modify the input file
let out_path = Path::new("target").join(path.file_name().unwrap());
rotated.save(out_path).unwrap();
}