-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code:
#![feature(generic_associated_types)]
#![allow(incomplete_features)]
trait Factory {
type Output<'a>;
fn build<'b>(&self, v: &'b u8) -> Self::Output<'b>;
}
#[allow(unused)]
struct Foo<'a, F: Factory> {
f: F::Output<'a>,
}
I got this error:
error[E0392]: parameter `'a` is never used
--> src/lib.rs:10:12
|
10 | struct Foo<'a, F: Factory> {
| ^^ unused parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
I think it doesn't make sense since 'a
is used in the field f
, if I add the PhantomData
like suggested, it works fine.
Meta
rustc --version --verbose
:
rustc 1.51.0-nightly (da305a2b0 2021-01-05)
binary: rustc
commit-hash: da305a2b00530aa34dea4e48389204c26fa35dbb
commit-date: 2021-01-05
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsC-bugCategory: This is a bug.Category: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.