rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.5k stars 12.74k forks source link

Failed compilation in Rust tutorial program (https://www.youtube.com/watch?v=WnWGO-tLtLA) #85129

Closed abhinavofficial closed 3 years ago

abhinavofficial commented 3 years ago

Code

let mut args = std::env::args().skip(1);
let key = args.next().unwrap();
println!("The key is: {}", key)

Meta

rustc --version --verbose:

rustc 1.52.0 (88f19c6da 2021-05-03)
binary: rustc
commit-hash: 88f19c6dab716c6281af7602e30f413e809c5974
commit-date: 2021-05-03
host: x86_64-unknown-linux-gnu
release: 1.52.0
LLVM version: 12.0.0

Error output

   Compiling kvstore v0.1.0 (/d/Work/Projects/kvstore)
    Building [                             ] 0/1: kvstore(bin)                                  thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[b0ed]::ops::function::Fn): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::ops::FnMut<Args>>)), /home/kuabhina/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:21: 67:32 (#0)), (Binder(TraitPredicate(<Args as std::marker::Sized>)), /home/kuabhina/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:14: 67:18 (#0)), (Binder(TraitPredicate(<Self as std::ops::Fn<Args>>)), /home/kuabhina/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:1: 67:32 (#0))] }', /rustc/88f19c6dab716c6281af7602e30f413e809c5974/compiler/rustc_query_system/src/query/plumbing.rs:593:5
    Building [                             ] 0/1: kvstore(bin)                                  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  error: internal compiler error: unexpected panic
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  note: the compiler unexpectedly panicked. this is a bug.
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  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
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  note: rustc 1.52.0 (88f19c6da 2021-05-03) running on x86_64-unknown-linux-gnu
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  note: some of the compiler flags provided by cargo are hidden
    Building [                             ] 0/1: kvstore(bin)                                  
    Building [                             ] 0/1: kvstore(bin)                                  query stack during panic:
    Building [                             ] 0/1: kvstore(bin)                                  #0 [predicates_of] computing predicates of `std::ops::Fn`
    Building [                             ] 0/1: kvstore(bin)                                  #1 [vtable_methods] finding all methods for trait std::ops::Fn
    Building [                             ] 0/1: kvstore(bin)                                  end of query stack
    Building [                             ] 0/1: kvstore(bin)                                  error: could not compile `kvstore`

To learn more, run the command again with --verbose.
Backtrace

``` Compiling kvstore v0.1.0 (/d/Work/Projects/kvstore) Building [ ] 0/1: kvstore(bin) thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[b0ed]::ops::function::Fn): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(>)), /home/kuabhina/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:21: 67:32 (#0)), (Binder(TraitPredicate()), /home/kuabhina/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:14: 67:18 (#0)), (Binder(TraitPredicate(>)), /home/kuabhina/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:67:1: 67:32 (#0))] }', /rustc/88f19c6dab716c6281af7602e30f413e809c5974/compiler/rustc_query_system/src/query/plumbing.rs:593:5 Building [ ] 0/1: kvstore(bin) stack backtrace: Building [ ] 0/1: kvstore(bin) 0: rust_begin_unwind Building [ ] 0/1: kvstore(bin) at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/panicking.rs:493:5 Building [ ] 0/1: kvstore(bin) 1: std::panicking::begin_panic_fmt Building [ ] 0/1: kvstore(bin) at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/panicking.rs:435:5 Building [ ] 0/1: kvstore(bin) 2: rustc_query_system::query::plumbing::incremental_verify_ich Building [ ] 0/1: kvstore(bin) 3: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory Building [ ] 0/1: kvstore(bin) 4: rustc_query_system::query::plumbing::get_query_impl Building [ ] 0/1: kvstore(bin) 5: ::predicates_of Building [ ] 0/1: kvstore(bin) 6: rustc_middle::ty::generics::GenericPredicates::instantiate_identity_into Building [ ] 0/1: kvstore(bin) 7: rustc_middle::ty::generics::GenericPredicates::instantiate_identity Building [ ] 0/1: kvstore(bin) 8: rustc_trait_selection::traits::object_safety::generics_require_sized_self Building [ ] 0/1: kvstore(bin) 9: core::ops::function::impls:: for &mut F>::call_once Building [ ] 0/1: kvstore(bin) 10: as core::iter::traits::iterator::Iterator>::next Building [ ] 0/1: kvstore(bin) 11: as core::iter::traits::collect::Extend<::Item>>::extend Building [ ] 0/1: kvstore(bin) 12: rustc_arena::cold_path Building [ ] 0/1: kvstore(bin) 13: rustc_middle::arena::Arena::alloc_from_iter Building [ ] 0/1: kvstore(bin) 14: rustc_trait_selection::traits::vtable_methods Building [ ] 0/1: kvstore(bin) 15: rustc_query_impl:: for rustc_query_impl::queries::vtable_methods>::compute Building [ ] 0/1: kvstore(bin) 16: rustc_middle::dep_graph::::with_deps Building [ ] 0/1: kvstore(bin) 17: rustc_query_system::dep_graph::graph::DepGraph::with_ignore Building [ ] 0/1: kvstore(bin) 18: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory Building [ ] 0/1: kvstore(bin) 19: rustc_data_structures::stack::ensure_sufficient_stack Building [ ] 0/1: kvstore(bin) 20: rustc_query_system::query::plumbing::get_query_impl Building [ ] 0/1: kvstore(bin) 21: ::vtable_methods Building [ ] 0/1: kvstore(bin) 22: ::visit_rvalue Building [ ] 0/1: kvstore(bin) 23: rustc_mir::monomorphize::collector::collect_neighbours Building [ ] 0/1: kvstore(bin) 24: rustc_mir::monomorphize::collector::collect_items_rec Building [ ] 0/1: kvstore(bin) 25: rustc_mir::monomorphize::collector::collect_crate_mono_items Building [ ] 0/1: kvstore(bin) 26: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items Building [ ] 0/1: kvstore(bin) 27: rustc_query_impl:: for rustc_query_impl::queries::collect_and_partition_mono_items>::compute Building [ ] 0/1: kvstore(bin) 28: rustc_middle::dep_graph::::with_deps Building [ ] 0/1: kvstore(bin) 29: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl Building [ ] 0/1: kvstore(bin) 30: rustc_data_structures::stack::ensure_sufficient_stack Building [ ] 0/1: kvstore(bin) 31: rustc_query_system::query::plumbing::force_query_with_job Building [ ] 0/1: kvstore(bin) 32: rustc_query_system::query::plumbing::get_query_impl Building [ ] 0/1: kvstore(bin) 33: ::collect_and_partition_mono_items Building [ ] 0/1: kvstore(bin) 34: ::codegen_crate Building [ ] 0/1: kvstore(bin) 35: rustc_interface::passes::QueryContext::enter Building [ ] 0/1: kvstore(bin) 36: rustc_interface::queries::Queries::ongoing_codegen Building [ ] 0/1: kvstore(bin) 37: rustc_interface::queries::::enter Building [ ] 0/1: kvstore(bin) 38: rustc_span::with_source_map Building [ ] 0/1: kvstore(bin) 39: rustc_interface::interface::create_compiler_and_run Building [ ] 0/1: kvstore(bin) 40: scoped_tls::ScopedKey::set Building [ ] 0/1: kvstore(bin) note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) error: internal compiler error: unexpected panic Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) note: the compiler unexpectedly panicked. this is a bug. Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) 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 Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) note: rustc 1.52.0 (88f19c6da 2021-05-03) running on x86_64-unknown-linux-gnu Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) note: some of the compiler flags provided by cargo are hidden Building [ ] 0/1: kvstore(bin) Building [ ] 0/1: kvstore(bin) query stack during panic: Building [ ] 0/1: kvstore(bin) #0 [predicates_of] computing predicates of `std::ops::Fn` Building [ ] 0/1: kvstore(bin) #1 [vtable_methods] finding all methods for trait std::ops::Fn Building [ ] 0/1: kvstore(bin) #2 [collect_and_partition_mono_items] collect_and_partition_mono_items Building [ ] 0/1: kvstore(bin) end of query stack Building [ ] 0/1: kvstore(bin) error: could not compile `kvstore` ```

abhinavofficial commented 3 years ago

I was just following the tutorial. The same code works on youtube video - indicating something broken recently.

hellow554 commented 3 years ago

run cargo clean and try it again. This is a known issue and should be fixed soon. Thanks for the report!

abhinavofficial commented 3 years ago

Thanks, Marcel. The issue got resolved after running cargo clean