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

ices/89066.sh: fixed with errors #1054

Merged
merged 1 commit into from
Dec 14, 2021
Merged

ices/89066.sh: fixed with errors #1054

merged 1 commit into from
Dec 14, 2021

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#89066

#!/usr/bin/env bash

rustc - -Zsave-analysis << 'EOF'
#![feature(generic_arg_infer)]

struct All<'a, T, const N: usize> {
  v: &'a T,
}

struct BadInfer<_>;
//~^ ERROR expected identifier
//~| ERROR parameter `_` is never used

fn all_fn<'a, T, const N: usize>() {}

fn bad_infer_fn<_>() {}
//~^ ERROR expected identifier


fn main() {
  let a: All<_, _, _>;
  all_fn();
  let v: [u8; _];
  //~^ ERROR in expressions
  let v: [u8; 10] = [0; _];
  //~^ ERROR in expressions
}
EOF
=== stdout ===
=== stderr ===
error: expected identifier, found reserved identifier `_`
 --> <anon>:7:17
  |
7 | struct BadInfer<_>;
  |                 ^ expected identifier, found reserved identifier

error: expected identifier, found reserved identifier `_`
  --> <anon>:13:17
   |
13 | fn bad_infer_fn<_>() {}
   |                 ^ expected identifier, found reserved identifier

error: in expressions, `_` can only be used on the left-hand side of an assignment
  --> <anon>:20:15
   |
20 |   let v: [u8; _];
   |               ^ `_` not allowed here

error: in expressions, `_` can only be used on the left-hand side of an assignment
  --> <anon>:22:25
   |
22 |   let v: [u8; 10] = [0; _];
   |                         ^ `_` not allowed here

error[E0392]: parameter `_` is never used
 --> <anon>:7:17
  |
7 | struct BadInfer<_>;
  |                 ^ unused parameter
  |
  = help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData`
  = help: if you intended `_` to be a const parameter, use `const _: usize` instead

error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
  --> <anon>:18:10
   |
18 |   let a: All<_, _, _>;
   |          ^^^       - help: remove this generic argument
   |          |
   |          expected 2 generic arguments
   |
note: struct defined here, with 2 generic parameters: `T`, `N`
  --> <anon>:3:8
   |
3  | struct All<'a, T, const N: usize> {
   |        ^^^     -        -

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0107, E0392.
For more information about an error, try `rustc --explain E0107`.
==============

=== stdout ===
=== stderr ===
error: expected identifier, found reserved identifier `_`
 --> <anon>:7:17
  |
7 | struct BadInfer<_>;
  |                 ^ expected identifier, found reserved identifier

error: expected identifier, found reserved identifier `_`
  --> <anon>:13:17
   |
13 | fn bad_infer_fn<_>() {}
   |                 ^ expected identifier, found reserved identifier

error: in expressions, `_` can only be used on the left-hand side of an assignment
  --> <anon>:20:15
   |
20 |   let v: [u8; _];
   |               ^ `_` not allowed here

error: in expressions, `_` can only be used on the left-hand side of an assignment
  --> <anon>:22:25
   |
22 |   let v: [u8; 10] = [0; _];
   |                         ^ `_` not allowed here

error[E0392]: parameter `_` is never used
 --> <anon>:7:17
  |
7 | struct BadInfer<_>;
  |                 ^ unused parameter
  |
  = help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData`
  = help: if you intended `_` to be a const parameter, use `const _: usize` instead

error[E0107]: this struct takes 2 generic arguments but 3 generic arguments were supplied
  --> <anon>:18:10
   |
18 |   let a: All<_, _, _>;
   |          ^^^       - help: remove this generic argument
   |          |
   |          expected 2 generic arguments
   |
note: struct defined here, with 2 generic parameters: `T`, `N`
  --> <anon>:3:8
   |
3  | struct All<'a, T, const N: usize> {
   |        ^^^     -        -

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0107, E0392.
For more information about an error, try `rustc --explain E0107`.
==============
@Alexendoo Alexendoo merged commit 9e501ea into master Dec 14, 2021
@Alexendoo Alexendoo deleted the autofix/ices/89066.sh branch December 14, 2021 17: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.

2 participants