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

ices/90318.rs: fixed with errors #1045

Merged
merged 1 commit into from
Dec 6, 2021
Merged

ices/90318.rs: fixed with errors #1045

merged 1 commit into from
Dec 6, 2021

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 6, 2021

Issue: rust-lang/rust#90318

#![feature(const_type_id)]
#![feature(generic_const_exprs)]
#![feature(core_intrinsics)]
use core::intrinsics::type_id;

struct If<const B: bool>;
pub trait True {}
impl True for If<true> {}

fn consume<T: 'static>(_val: T)
where
    If<{ type_id::<T>() != type_id::<()>() }>: True,
{
}

fn test<T: 'static>()
where
    If<{ type_id::<T>() != type_id::<()>() }>: True,
{
}

fn main() {
    let a = ();
    consume(0i32);
    consume(a);
    // uncomenting these lines won't result in ICE
    // test::<i32>();
    // test::<()>();
}
=== stdout ===
=== stderr ===
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/90318.rs:2:12
  |
2 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/90318.rs:25:5
   |
25 |     consume(a);
   |     ^^^^^^^ expected `false`, found `true`
   |
   = note: expected type `false`
              found type `true`

error: aborting due to previous error; 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/90318.rs:2:12
  |
2 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #76560 <rust-lang/rust#76560> for more information

error[E0308]: mismatched types
  --> /home/runner/work/glacier/glacier/ices/90318.rs:25:5
   |
25 |     consume(a);
   |     ^^^^^^^ expected `false`, found `true`
   |
   = note: expected type `false`
              found type `true`

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0308`.
==============
@Alexendoo Alexendoo merged commit ac8fefe into master Dec 6, 2021
@Alexendoo Alexendoo deleted the autofix/ices/90318.rs branch December 6, 2021 13:42
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.

None yet

2 participants