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

ices/101696-2.rs: fixed with no errors #1432

Merged
merged 1 commit into from
Oct 2, 2022
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 2, 2022

Issue: rust-lang/rust#101696

use std::marker::PhantomData;

#[derive(Default)]
struct MyType<'a> {
    field: usize,
    _phantom: PhantomData<&'a ()>,
}

#[derive(Default)]
struct MyTypeVariant<'a> {
    field: usize,
    _phantom: PhantomData<&'a ()>,
}

trait AsVariantTrait {
    type Type;
}

impl<'a> AsVariantTrait for MyType<'a> {
    type Type = MyTypeVariant<'a>;
}

fn foo<T: Default, F: FnOnce(T)>(f: F) {
    let input = T::default();
    f(input);
}

fn main() {
    foo(|a: <MyType as AsVariantTrait>::Type| {
        a.field;
    });
}
=== stdout ===
=== stderr ===
warning: field `field` is never read
 --> /home/runner/work/glacier/glacier/ices/101696-2.rs:5:5
  |
4 | struct MyType<'a> {
  |        ------ field in this struct
5 |     field: usize,
  |     ^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

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

=== stdout ===
=== stderr ===
warning: field `field` is never read
 --> /home/runner/work/glacier/glacier/ices/101696-2.rs:5:5
  |
4 | struct MyType<'a> {
  |        ------ field in this struct
5 |     field: usize,
  |     ^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

==============
@JohnTitor JohnTitor merged commit ec88bd5 into master Oct 2, 2022
@JohnTitor JohnTitor deleted the autofix/ices/101696-2.rs branch October 2, 2022 22:49
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