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

ices/67945-1.rs: fixed with errors #586

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#67945

// original reproducer by DutchGhost
use std::marker::PhantomData;

use std::mem::{self, MaybeUninit};

struct Bug<S> {
    A: [(); {
        let x: S = MaybeUninit::uninit();
        let b = &*(&x as *const _ as *const S);
        0
    }],
}
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:8:16
  |
8 |         let x: S = MaybeUninit::uninit();
  |                ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:9:45
  |
9 |         let b = &*(&x as *const _ as *const S);
  |                                             ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: unused import: `std::marker::PhantomData`
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:2:5
  |
2 | use std::marker::PhantomData;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `self`
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:4:16
  |
4 | use std::mem::{self, MaybeUninit};
  |                ^^^^

error[E0601]: `main` function not found in crate `67945_1`
  --> /home/runner/work/glacier/glacier/ices/67945-1.rs:2:1
   |
2  | / use std::marker::PhantomData;
3  | |
4  | | use std::mem::{self, MaybeUninit};
5  | |
...  |
11 | |     }],
12 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/67945-1.rs`

error[E0392]: parameter `S` is never used
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:6:12
  |
6 | struct Bug<S> {
  |            ^ unused parameter
  |
  = help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 4 previous errors; 2 warnings emitted

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

=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:8:16
  |
8 |         let x: S = MaybeUninit::uninit();
  |                ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:9:45
  |
9 |         let b = &*(&x as *const _ as *const S);
  |                                             ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: unused import: `std::marker::PhantomData`
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:2:5
  |
2 | use std::marker::PhantomData;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `self`
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:4:16
  |
4 | use std::mem::{self, MaybeUninit};
  |                ^^^^

error[E0601]: `main` function not found in crate `67945_1`
  --> /home/runner/work/glacier/glacier/ices/67945-1.rs:2:1
   |
2  | / use std::marker::PhantomData;
3  | |
4  | | use std::mem::{self, MaybeUninit};
5  | |
...  |
11 | |     }],
12 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/67945-1.rs`

error[E0392]: parameter `S` is never used
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:6:12
  |
6 | struct Bug<S> {
  |            ^ unused parameter
  |
  = help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 4 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0392, E0601.
For more information about an error, try `rustc --explain E0392`.
==============
@Alexendoo Alexendoo deleted the autofix/ices/67945-1.rs branch January 2, 2021 14:07
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