Weird compiler behavior when implementing trait


Why does compiler allow me to define function fn print<P: Tr> (...); in some trait and then implement that trait as follows: fn print<P: Tr + 'static> (...) {}?

I thought Tr + 'static where Tr is some other trait is stronger requirement for a type than just Tr. So why does it happen?


Playground URL:

use std::fmt::Display;

trait Printer {
    fn print<P: Display>(&self, printable: P);

struct TestObj;

impl Printer for TestObj {
    fn print<P: Display + 'static>(&self, printable: P) {}

fn main() {}


this can cause a use after free in safe code, seems to be a bug