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

ices/82956.sh: fixed with no errors #870

Merged
merged 1 commit into from
Jul 17, 2021
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#82956

#!/bin/bash

rustc --crate-type=lib --crate-name=ordes - <<'EOF'
#![feature(const_generics, const_evaluatable_checked, array_map)]

use std::array::IntoIter;

pub struct ConstCheck<const CHECK: bool>;

pub trait True {}
impl True for ConstCheck<true> {}

pub trait OrdesDec {
    type Newlen;
    type Output;

    fn pop(self) -> (Self::Newlen, Self::Output);
}

impl<T, const N: usize> OrdesDec for [T; N]
where
    ConstCheck<{N > 1}>: True,
    [T; N - 1]: Sized,
{
    type Newlen = [T; N - 1];
    type Output = T;

    fn pop(self) -> (Self::Newlen, Self::Output) {
        let mut iter = IntoIter::new(self);
        let end = iter.next_back().unwrap();
        let new = [(); N - 1].map(move |()| iter.next().unwrap());
        (new, end)
    }
}
EOF

rustc -L. - <<'EOF'
extern crate ordes;
use ordes::OrdesDec;

fn main() {
    let foo = [0u8, 1, 2, 3, 4];
    let (foo, pop) = foo.pop();
}
EOF
=== stdout ===
=== stderr ===
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <anon>:1:12
  |
1 | #![feature(const_generics, const_evaluatable_checked, array_map)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

warning: the feature `const_evaluatable_checked` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <anon>:1:28
  |
1 | #![feature(const_generics, const_evaluatable_checked, array_map)]
  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

warning: the feature `array_map` has been stable since 1.55.0 and no longer requires an attribute to enable
 --> <anon>:1:55
  |
1 | #![feature(const_generics, const_evaluatable_checked, array_map)]
  |                                                       ^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

warning: 3 warnings emitted

warning: unused variable: `foo`
 --> <anon>:6:10
  |
6 |     let (foo, pop) = foo.pop();
  |          ^^^ help: if this is intentional, prefix it with an underscore: `_foo`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `pop`
 --> <anon>:6:15
  |
6 |     let (foo, pop) = foo.pop();
  |               ^^^ help: if this is intentional, prefix it with an underscore: `_pop`

warning: 2 warnings emitted

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

=== stdout ===
=== stderr ===
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <anon>:1:12
  |
1 | #![feature(const_generics, const_evaluatable_checked, array_map)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #44580 <rust-lang/rust#44580> for more information

warning: the feature `const_evaluatable_checked` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <anon>:1:28
  |
1 | #![feature(const_generics, const_evaluatable_checked, array_map)]
  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <rust-lang/rust#76560> for more information

warning: the feature `array_map` has been stable since 1.55.0 and no longer requires an attribute to enable
 --> <anon>:1:55
  |
1 | #![feature(const_generics, const_evaluatable_checked, array_map)]
  |                                                       ^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

warning: 3 warnings emitted

warning: unused variable: `foo`
 --> <anon>:6:10
  |
6 |     let (foo, pop) = foo.pop();
  |          ^^^ help: if this is intentional, prefix it with an underscore: `_foo`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `pop`
 --> <anon>:6:15
  |
6 |     let (foo, pop) = foo.pop();
  |               ^^^ help: if this is intentional, prefix it with an underscore: `_pop`

warning: 2 warnings emitted

==============
@Alexendoo Alexendoo merged commit 94c4db7 into master Jul 17, 2021
@Alexendoo Alexendoo deleted the autofix/ices/82956.sh branch July 17, 2021 12: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