Repository: rust
Issue: Rustc bug when building Elrond Smart Contract
Labels: I-ICE,T-compiler,C-bug,E-needs-mcve

### Edit
Someone found how to fix the bug. Apparently by modifying lines above contract trait in main.rs it creates the bug when compiling. So the DIY solution is to delete ./meta and build the contract again.

### Context
Developing Smart Contract on Elrond with their sdk. Basically following this tutorial https://docs.elrond.com/developers/tutorials/crowdfunding-p2/

When I run erdpy build contract I get this bug. First time I fixed it by deleting and typing the content of the smart contract a second time. But now I get this bug again and the contract is too long.

Checking backtrace I got "error[E0554]: `#![feature]` may not be used on the stable release channel". So I tried with nightly but nothing change.

### Code

```Rust
#![no_std]

elrond_wasm::imports!();
elrond_wasm::derive_imports!();

#[derive(TopEncode, TopDecode, TypeAbi, PartialEq, Clone, Copy)]
pub enum Status {
    FundingPeriod,
    Successful,
    Failed,
}

#[elrond_wasm::contract]
pub trait Crowdfunding {

  #[view(getTarget)]
  #[storage_mapper("target")]
  fn target(&self) -> SingleValueMapper<BigUint>;

  #[view(getDeadline)]
  #[storage_mapper("deadline")]
  fn deadline(&self) -> SingleValueMapper<u64>;

  #[view(getDeposit)]
  #[storage_mapper("deposit")]
  fn deposit(&self, donor: &ManagedAddress) -> SingleValueMapper<BigUint>;

  #[init]
  fn init(&self, target: BigUint, deadline: u64) {
      self.target().set(&target);
      self.deadline().set(&deadline);
  }

  #[view]
  fn status(&self) -> Status {
      if self.blockchain().get_block_nonce() <= self.deadline().get() {
          Status::FundingPeriod
      } else if self.get_current_funds() >= self.target().get() {
          Status::Successful
      } else {
          Status::Failed
      }
  }

  #[view(getCurrentFunds)]
  fn get_current_funds(&self) -> BigUint {
      self.blockchain().get_sc_balance(&TokenIdentifier::egld(), 0)
  }

  #[payable("*")]
  #[endpoint]
  fn fund(&self, #[payment] payment: BigUint) -> SCResult<()> {
      let current_time = self.blockchain().get_block_nonce();
      require!(current_time < self.deadline().get(), "cannot fund after deadline");

      let caller = self.blockchain().get_caller();
      self.deposit(&caller).update(|deposit| *deposit += payment);
      Ok(())
  }
}
```


### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc --version --verbose
rustc 1.60.0-nightly (5e57faa78 2022-01-19)
binary: rustc
commit-hash: 5e57faa78aa7661c6000204591558f6665f11abc
commit-date: 2022-01-19
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
```

### Error output

```
Compiling crowdfunding-meta v0.0.0 (/home/thoune/ThounyBreasty/Courses/Elrond/crowdfunding/meta)
thread 'rustc' panicked at 'no entry found for key', compiler/rustc_metadata/src/rmeta/decoder.rs:1640:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

[...]


```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /home/thoune/.cargo/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-derive-0.26.0/src/lib.rs:4:12
  |
4 | #![feature(proc_macro_quote)]
  |            ^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `elrond-wasm-derive` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
```

</p>
</details>