Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/83471-2.rs: fixed with errors #978

Merged
merged 1 commit into from
Sep 26, 2021
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#83471

#![feature(lang_items)]
// #![feature(no_core)]
// #![no_core]

#[lang = "fn"]
trait MyFn<T> {
    const call: i32 = 42;
    //~^ ERROR: `call` trait item in `fn`/`fn_mut` lang item must be a function
}

#[lang = "fn_mut"]
trait MyFnMut<T> {
    fn call(i: i32, j: i32) -> i32 { i + j }
    //~^ ERROR: first argument of `call` in `fn`/`fn_mut` lang item must be a reference
}

fn main() {
    let a = || 42;
    a();

    let mut i = 0;
    let mut b = || { i += 1; };
    b();
}
=== stdout ===
=== stderr ===
error[E0152]: found duplicate lang item `fn`
 --> /home/runner/work/glacier/glacier/ices/83471-2.rs:6:1
  |
6 | / trait MyFn<T> {
7 | |     const call: i32 = 42;
8 | |     //~^ ERROR: `call` trait item in `fn`/`fn_mut` lang item must be a function
9 | | }
  | |_^
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /usr/share/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0e3656b1fda5fd7b.rlib
  = note: second definition in the local crate (`83471_2`)

error[E0152]: found duplicate lang item `fn_mut`
  --> /home/runner/work/glacier/glacier/ices/83471-2.rs:12:1
   |
12 | / trait MyFnMut<T> {
13 | |     fn call(i: i32, j: i32) -> i32 { i + j }
14 | |     //~^ ERROR: first argument of `call` in `fn`/`fn_mut` lang item must be a reference
15 | | }
   | |_^
   |
   = note: the lang item is first defined in crate `core` (which `std` depends on)
   = note: first definition in `core` loaded from /usr/share/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0e3656b1fda5fd7b.rlib
   = note: second definition in the local crate (`83471_2`)

error: `call` trait item in `fn` lang item must be a function
 --> /home/runner/work/glacier/glacier/ices/83471-2.rs:7:5
  |
7 |     const call: i32 = 42;
  |     ^^^^^^^^^^^^^^^^^^^^^

error: first argument of `call` in `fn_mut` lang item must be a reference
  --> /home/runner/work/glacier/glacier/ices/83471-2.rs:13:16
   |
13 |     fn call(i: i32, j: i32) -> i32 { i + j }
   |                ^^^

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0152`.
==============

=== stdout ===
=== stderr ===
error[E0152]: found duplicate lang item `fn`
 --> /home/runner/work/glacier/glacier/ices/83471-2.rs:6:1
  |
6 | / trait MyFn<T> {
7 | |     const call: i32 = 42;
8 | |     //~^ ERROR: `call` trait item in `fn`/`fn_mut` lang item must be a function
9 | | }
  | |_^
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /usr/share/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0e3656b1fda5fd7b.rlib
  = note: second definition in the local crate (`83471_2`)

error[E0152]: found duplicate lang item `fn_mut`
  --> /home/runner/work/glacier/glacier/ices/83471-2.rs:12:1
   |
12 | / trait MyFnMut<T> {
13 | |     fn call(i: i32, j: i32) -> i32 { i + j }
14 | |     //~^ ERROR: first argument of `call` in `fn`/`fn_mut` lang item must be a reference
15 | | }
   | |_^
   |
   = note: the lang item is first defined in crate `core` (which `std` depends on)
   = note: first definition in `core` loaded from /usr/share/rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0e3656b1fda5fd7b.rlib
   = note: second definition in the local crate (`83471_2`)

error: `call` trait item in `fn` lang item must be a function
 --> /home/runner/work/glacier/glacier/ices/83471-2.rs:7:5
  |
7 |     const call: i32 = 42;
  |     ^^^^^^^^^^^^^^^^^^^^^

error: first argument of `call` in `fn_mut` lang item must be a reference
  --> /home/runner/work/glacier/glacier/ices/83471-2.rs:13:16
   |
13 |     fn call(i: i32, j: i32) -> i32 { i + j }
   |                ^^^

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0152`.
==============
@Alexendoo Alexendoo merged commit 7900e5f into master Sep 26, 2021
@Alexendoo Alexendoo deleted the autofix/ices/83471-2.rs branch September 26, 2021 12:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants