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

ices/69296.rs: fixed with errors #589

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#69296

unsafe fn f<T: ?Sized>(ptr: *mut T, new: *mut u8) -> *mut T {
    use std::mem;

    let mut parts: [*mut u8; mem::size_of::<*mut T>() / mem::size_of::<*mut u8>()] =
        mem::transmute(ptr);
    parts[0] = new;
    mem::transmute(parts)
}

fn main() {}
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/69296.rs:4:50
  |
4 |     let mut parts: [*mut u8; mem::size_of::<*mut T>() / mem::size_of::<*mut u8>()] =
  |                                                  ^ cannot perform const operation using `T`
  |
  = 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: aborting due to previous error

==============

=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/69296.rs:4:50
  |
4 |     let mut parts: [*mut u8; mem::size_of::<*mut T>() / mem::size_of::<*mut u8>()] =
  |                                                  ^ cannot perform const operation using `T`
  |
  = 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: aborting due to previous error

==============
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It's duplicate)

@Alexendoo Alexendoo deleted the autofix/ices/69296.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