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

ices/76510.rs: fixed with errors #612

Merged
merged 1 commit into from
Jan 13, 2021
Merged

ices/76510.rs: fixed with errors #612

merged 1 commit into from
Jan 13, 2021

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#76510

struct Dummy;

impl Dummy {
    const fn func(&mut self) -> usize {
        42
    }
}

const _: &[usize] = &[0; {
    const DUMMY: &Dummy = &Dummy;
    DUMMY.func()
}];
=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `76510`
  --> /home/runner/work/glacier/glacier/ices/76510.rs:1:1
   |
1  | / struct Dummy;
2  | |
3  | | impl Dummy {
4  | |     const fn func(&mut self) -> usize {
...  |
11 | |     DUMMY.func()
12 | | }];
   | |___^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/76510.rs`

error[E0596]: cannot borrow data in a `&` reference as mutable
  --> /home/runner/work/glacier/glacier/ices/76510.rs:11:5
   |
11 |     DUMMY.func()
   |     ^^^^^ cannot borrow as mutable

error[E0658]: mutable references are not allowed in constant functions
 --> /home/runner/work/glacier/glacier/ices/76510.rs:4:19
  |
4 |     const fn func(&mut self) -> usize {
  |                   ^^^^^^^^^
  |
  = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
  = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0596, E0601, E0658.
For more information about an error, try `rustc --explain E0596`.
==============

=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `76510`
  --> /home/runner/work/glacier/glacier/ices/76510.rs:1:1
   |
1  | / struct Dummy;
2  | |
3  | | impl Dummy {
4  | |     const fn func(&mut self) -> usize {
...  |
11 | |     DUMMY.func()
12 | | }];
   | |___^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/76510.rs`

error[E0596]: cannot borrow data in a `&` reference as mutable
  --> /home/runner/work/glacier/glacier/ices/76510.rs:11:5
   |
11 |     DUMMY.func()
   |     ^^^^^ cannot borrow as mutable

error[E0658]: mutable references are not allowed in constant functions
 --> /home/runner/work/glacier/glacier/ices/76510.rs:4:19
  |
4 |     const fn func(&mut self) -> usize {
  |                   ^^^^^^^^^
  |
  = note: see issue #57349 <rust-lang/rust#57349> for more information
  = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0596, E0601, E0658.
For more information about an error, try `rustc --explain E0596`.
==============
@Alexendoo Alexendoo merged commit 7128247 into master Jan 13, 2021
@Alexendoo Alexendoo deleted the autofix/ices/76510.rs branch January 13, 2021 14:30
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