Skip to content

marker_trait_attr: overlapping impls can cause compilation failures #84917

Closed
@lcnr

Description

@lcnr
#![feature(marker_trait_attr)]

#[marker]
pub trait F {}
impl<T> F for T where T: Copy {}
impl<T> F for T where T: 'static {}

results in

error[E0310]: the parameter type `T` may not live long enough
 --> src/lib.rs:5:9
  |
5 | impl<T> F for T where T: Copy {}
  |      -  ^ ...so that the type `T` will meet its required lifetime bounds
  |      |
  |      help: consider adding an explicit lifetime bound...: `T: 'static`

This should not happen

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-marker_trait_attr`#![feature(marker_trait_attr)]`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions