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

ices/84957.rs: fixed with no errors #991

Merged
merged 1 commit into from
Oct 15, 2021
Merged

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#84957

trait SerialPort {}

struct Example {
    member0: &'static [u8],
    member2: fn(&Box<dyn SerialPort>),
}
fn function1(_: &Box<dyn SerialPort>) {}

const EXAMPLE_MAP: &[Example] = &[
    Example {
        member0: "0".as_bytes(),
        member2: function1,
    },
    Example {
        member0: "0".as_bytes(),
        member2: function1,
    },
];

fn main() {
    let port = todo!();

    for example_member in EXAMPLE_MAP {
        (example_member.member2)(&port);
    }
}
=== stdout ===
=== stderr ===
warning: unreachable expression
  --> /home/runner/work/glacier/glacier/ices/84957.rs:23:5
   |
21 |       let port = todo!();
   |                  ------- any code following this expression is unreachable
22 | 
23 | /     for example_member in EXAMPLE_MAP {
24 | |         (example_member.member2)(&port);
25 | |     }
   | |_____^ unreachable expression
   |
   = note: `#[warn(unreachable_code)]` on by default

warning: unused variable: `port`
  --> /home/runner/work/glacier/glacier/ices/84957.rs:21:9
   |
21 |     let port = todo!();
   |         ^^^^ help: if this is intentional, prefix it with an underscore: `_port`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: field is never read: `member0`
 --> /home/runner/work/glacier/glacier/ices/84957.rs:4:5
  |
4 |     member0: &'static [u8],
  |     ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 3 warnings emitted

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

=== stdout ===
=== stderr ===
warning: unreachable expression
  --> /home/runner/work/glacier/glacier/ices/84957.rs:23:5
   |
21 |       let port = todo!();
   |                  ------- any code following this expression is unreachable
22 | 
23 | /     for example_member in EXAMPLE_MAP {
24 | |         (example_member.member2)(&port);
25 | |     }
   | |_____^ unreachable expression
   |
   = note: `#[warn(unreachable_code)]` on by default

warning: unused variable: `port`
  --> /home/runner/work/glacier/glacier/ices/84957.rs:21:9
   |
21 |     let port = todo!();
   |         ^^^^ help: if this is intentional, prefix it with an underscore: `_port`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: field is never read: `member0`
 --> /home/runner/work/glacier/glacier/ices/84957.rs:4:5
  |
4 |     member0: &'static [u8],
  |     ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 3 warnings emitted

==============
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment on the issue.

@JohnTitor JohnTitor merged commit 79e0d7e into master Oct 15, 2021
@JohnTitor JohnTitor deleted the autofix/ices/84957.rs branch October 15, 2021 16:25
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