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

ices/72113.rs: fixed with errors #623

Merged
merged 1 commit into from
Jan 27, 2021
Merged

ices/72113.rs: fixed with errors #623

merged 1 commit into from
Jan 27, 2021

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#72113

#![feature(const_raw_ptr_deref)]

const OTHER_UNIT: &'static u8 = unsafe { &*(&&() as *const _ as *const u8) };

fn main() {}
=== stdout ===
=== stderr ===
warning: constant is never used: `OTHER_UNIT`
 --> /home/runner/work/glacier/glacier/ices/72113.rs:3:1
  |
3 | const OTHER_UNIT: &'static u8 = unsafe { &*(&&() as *const _ as *const u8) };
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error[E0080]: it is undefined behavior to use this value
 --> /home/runner/work/glacier/glacier/ices/72113.rs:3:1
  |
3 | const OTHER_UNIT: &'static u8 = unsafe { &*(&&() as *const _ as *const u8) };
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered read of part of a pointer at .<deref>
  |
  = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.

error: aborting due to previous error; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: constant is never used: `OTHER_UNIT`
 --> /home/runner/work/glacier/glacier/ices/72113.rs:3:1
  |
3 | const OTHER_UNIT: &'static u8 = unsafe { &*(&&() as *const _ as *const u8) };
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

error[E0080]: it is undefined behavior to use this value
 --> /home/runner/work/glacier/glacier/ices/72113.rs:3:1
  |
3 | const OTHER_UNIT: &'static u8 = unsafe { &*(&&() as *const _ as *const u8) };
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered read of part of a pointer at .<deref>
  |
  = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0080`.
==============
@JohnTitor JohnTitor merged commit 76460fa into master Jan 27, 2021
@JohnTitor JohnTitor deleted the autofix/ices/72113.rs branch January 27, 2021 19:51
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants