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

ices/93022.rs: fixed with no errors #1308

Merged
merged 1 commit into from
Jun 15, 2022
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#93022

#![recursion_limit = "256000"]

struct Z;
struct S<T>(T);

trait Add<Rhs> {
    type Sum;
}

type SumOf<N, M> = <N as Add<M>>::Sum;

impl<N> Add<N> for Z {
    type Sum = N;
}

impl<N, M> Add<M> for S<N>
where
    N: Add<S<M>>,
{
    type Sum = SumOf<N, S<M>>;
}

type One = S<Z>;
type Two = SumOf<One, One>;
type Three = SumOf<One, Two>;
type Five = SumOf<Two, Three>;
type Ten = SumOf<Five, Five>;
type TwentyFive = SumOf<Five, SumOf<Ten, Ten>>;
type Fifty = SumOf<TwentyFive, TwentyFive>;
type OneHundred = SumOf<Fifty, Fifty>;

type x2 = SumOf<OneHundred, OneHundred>;
type x4 = SumOf<x2, x2>;
type x8 = SumOf<x4, x4>;
type x16 = SumOf<x8, x8>;
type x32 = SumOf<x16, x16>;
type x64 = SumOf<x32, x32>;
type x128 = SumOf<x64, x64>;
//

trait NumericValue {
    const VALUE: usize;
}

impl NumericValue for Z {
    const VALUE: usize = 0;
}

impl<N> NumericValue for S<N>
where
    N: NumericValue,
{
    const VALUE: usize = N::VALUE + 1;
}

const value: usize = <x16 as NumericValue>::VALUE;

fn main() {}
=== stdout ===
=== stderr ===
warning: type `x2` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:32:6
   |
32 | type x2 = SumOf<OneHundred, OneHundred>;
   |      ^^ help: convert the identifier to upper camel case (notice the capitalization): `X2`
   |
   = note: `#[warn(non_camel_case_types)]` on by default

warning: type `x4` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:33:6
   |
33 | type x4 = SumOf<x2, x2>;
   |      ^^ help: convert the identifier to upper camel case (notice the capitalization): `X4`

warning: type `x8` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:34:6
   |
34 | type x8 = SumOf<x4, x4>;
   |      ^^ help: convert the identifier to upper camel case (notice the capitalization): `X8`

warning: type `x16` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:35:6
   |
35 | type x16 = SumOf<x8, x8>;
   |      ^^^ help: convert the identifier to upper camel case (notice the capitalization): `X16`

warning: type `x32` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:36:6
   |
36 | type x32 = SumOf<x16, x16>;
   |      ^^^ help: convert the identifier to upper camel case (notice the capitalization): `X32`

warning: type `x64` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:37:6
   |
37 | type x64 = SumOf<x32, x32>;
   |      ^^^ help: convert the identifier to upper camel case (notice the capitalization): `X64`

warning: type `x128` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:38:6
   |
38 | type x128 = SumOf<x64, x64>;
   |      ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `X128`

warning: type alias is never used: `One`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:23:1
   |
23 | type One = S<Z>;
   | ^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: type alias is never used: `Two`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:24:1
   |
24 | type Two = SumOf<One, One>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Three`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:25:1
   |
25 | type Three = SumOf<One, Two>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Five`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:26:1
   |
26 | type Five = SumOf<Two, Three>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Ten`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:27:1
   |
27 | type Ten = SumOf<Five, Five>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `TwentyFive`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:28:1
   |
28 | type TwentyFive = SumOf<Five, SumOf<Ten, Ten>>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Fifty`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:29:1
   |
29 | type Fifty = SumOf<TwentyFive, TwentyFive>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `OneHundred`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:30:1
   |
30 | type OneHundred = SumOf<Fifty, Fifty>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x2`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:32:1
   |
32 | type x2 = SumOf<OneHundred, OneHundred>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x4`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:33:1
   |
33 | type x4 = SumOf<x2, x2>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x8`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:34:1
   |
34 | type x8 = SumOf<x4, x4>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x16`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:35:1
   |
35 | type x16 = SumOf<x8, x8>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x32`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:36:1
   |
36 | type x32 = SumOf<x16, x16>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x64`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:37:1
   |
37 | type x64 = SumOf<x32, x32>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x128`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:38:1
   |
38 | type x128 = SumOf<x64, x64>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: `value`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:56:1
   |
56 | const value: usize = <x16 as NumericValue>::VALUE;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant `value` should have an upper case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:56:7
   |
56 | const value: usize = <x16 as NumericValue>::VALUE;
   |       ^^^^^ help: convert the identifier to upper case: `VALUE`
   |
   = note: `#[warn(non_upper_case_globals)]` on by default

warning: 24 warnings emitted

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

=== stdout ===
=== stderr ===
warning: type `x2` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:32:6
   |
32 | type x2 = SumOf<OneHundred, OneHundred>;
   |      ^^ help: convert the identifier to upper camel case (notice the capitalization): `X2`
   |
   = note: `#[warn(non_camel_case_types)]` on by default

warning: type `x4` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:33:6
   |
33 | type x4 = SumOf<x2, x2>;
   |      ^^ help: convert the identifier to upper camel case (notice the capitalization): `X4`

warning: type `x8` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:34:6
   |
34 | type x8 = SumOf<x4, x4>;
   |      ^^ help: convert the identifier to upper camel case (notice the capitalization): `X8`

warning: type `x16` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:35:6
   |
35 | type x16 = SumOf<x8, x8>;
   |      ^^^ help: convert the identifier to upper camel case (notice the capitalization): `X16`

warning: type `x32` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:36:6
   |
36 | type x32 = SumOf<x16, x16>;
   |      ^^^ help: convert the identifier to upper camel case (notice the capitalization): `X32`

warning: type `x64` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:37:6
   |
37 | type x64 = SumOf<x32, x32>;
   |      ^^^ help: convert the identifier to upper camel case (notice the capitalization): `X64`

warning: type `x128` should have an upper camel case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:38:6
   |
38 | type x128 = SumOf<x64, x64>;
   |      ^^^^ help: convert the identifier to upper camel case (notice the capitalization): `X128`

warning: type alias is never used: `One`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:23:1
   |
23 | type One = S<Z>;
   | ^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: type alias is never used: `Two`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:24:1
   |
24 | type Two = SumOf<One, One>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Three`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:25:1
   |
25 | type Three = SumOf<One, Two>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Five`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:26:1
   |
26 | type Five = SumOf<Two, Three>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Ten`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:27:1
   |
27 | type Ten = SumOf<Five, Five>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `TwentyFive`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:28:1
   |
28 | type TwentyFive = SumOf<Five, SumOf<Ten, Ten>>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `Fifty`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:29:1
   |
29 | type Fifty = SumOf<TwentyFive, TwentyFive>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `OneHundred`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:30:1
   |
30 | type OneHundred = SumOf<Fifty, Fifty>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x2`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:32:1
   |
32 | type x2 = SumOf<OneHundred, OneHundred>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x4`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:33:1
   |
33 | type x4 = SumOf<x2, x2>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x8`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:34:1
   |
34 | type x8 = SumOf<x4, x4>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x16`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:35:1
   |
35 | type x16 = SumOf<x8, x8>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x32`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:36:1
   |
36 | type x32 = SumOf<x16, x16>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x64`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:37:1
   |
37 | type x64 = SumOf<x32, x32>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `x128`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:38:1
   |
38 | type x128 = SumOf<x64, x64>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: `value`
  --> /home/runner/work/glacier/glacier/ices/93022.rs:56:1
   |
56 | const value: usize = <x16 as NumericValue>::VALUE;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant `value` should have an upper case name
  --> /home/runner/work/glacier/glacier/ices/93022.rs:56:7
   |
56 | const value: usize = <x16 as NumericValue>::VALUE;
   |       ^^^^^ help: convert the identifier to upper case: `VALUE`
   |
   = note: `#[warn(non_upper_case_globals)]` on by default

warning: 24 warnings emitted

==============
@JohnTitor JohnTitor merged commit 10936ca into master Jun 15, 2022
@JohnTitor JohnTitor deleted the autofix/ices/93022.rs branch June 15, 2022 10:46
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