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

ices/79495.sh: fixed with errors #1581

Merged
merged 1 commit into from
May 11, 2023
Merged

ices/79495.sh: fixed with errors #1581

merged 1 commit into from
May 11, 2023

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#79495

#!/bin/bash

cat > out.rs <<'EOF'
#![feature(arbitrary_enum_discriminant, generic_const_exprs, core_intrinsics)]

extern crate core;
use core::intrinsics::discriminant_value;

#[repr(usize)]
enum MyWeirdOption<T> {
    None = 0,
    Some(T) = std::mem::size_of::<T>(),
    //~^ ERROR constant expression depends on a generic parameter
}

fn main() {
    assert_eq!(discriminant_value(&MyWeirdOption::<u8>::None), 0);
    assert_eq!(discriminant_value(&MyWeirdOption::Some(0u8)), 1);
}

EOF

rustdoc --edition=2021 out.rs
=== stdout ===
=== stderr ===
error: generic parameters may not be used in enum discriminant values
 --> out.rs:9:35
  |
9 |     Some(T) = std::mem::size_of::<T>(),
  |                                   ^ cannot perform const operation using `T`
  |
  = note: type parameters may not be used in enum discriminant values

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> out.rs:1:41
  |
1 | #![feature(arbitrary_enum_discriminant, generic_const_exprs, core_intrinsics)]
  |                                         ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0433]: failed to resolve: could not resolve path `T`
 --> out.rs:9:35
  |
9 |     Some(T) = std::mem::size_of::<T>(),
  |                                   ^ could not resolve path `T`
  |
  = note: this error was originally ignored because you are running `rustdoc`
  = note: try running again with `rustc` or `cargo check` and you may get a more detailed error

error: aborting due to 2 previous errors; 1 warning emitted

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

=== stdout ===
=== stderr ===
error: generic parameters may not be used in enum discriminant values
 --> out.rs:9:35
  |
9 |     Some(T) = std::mem::size_of::<T>(),
  |                                   ^ cannot perform const operation using `T`
  |
  = note: type parameters may not be used in enum discriminant values

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> out.rs:1:41
  |
1 | #![feature(arbitrary_enum_discriminant, generic_const_exprs, core_intrinsics)]
  |                                         ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <rust-lang/rust#76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0433]: failed to resolve: could not resolve path `T`
 --> out.rs:9:35
  |
9 |     Some(T) = std::mem::size_of::<T>(),
  |                                   ^ could not resolve path `T`
  |
  = note: this error was originally ignored because you are running `rustdoc`
  = note: try running again with `rustc` or `cargo check` and you may get a more detailed error

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0433`.
==============
@Alexendoo Alexendoo merged commit c6ea502 into master May 11, 2023
@Alexendoo Alexendoo deleted the autofix/ices/79495.sh branch May 11, 2023 11:56
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