Open
Description
Given the following two crates:
#![crate_name = "foo"]
pub struct Foo;
pub struct Bar;
pub trait IntoBar {
fn into_bar(self) -> Bar;
}
#[deprecated(note = "Just pass `Bar` instead")]
impl IntoBar for Foo {
fn into_bar(self) -> Bar {
Bar
}
}
extern crate foo;
use foo::*;
fn main() {
let _ = Foo.into_bar();
}
I would expect the second crate to see a deprecation warning on the use of Foo.into_bar()
. Instead, both crates compile successfully with no errors. I think that allowing deprecations on impls is a useful option to provide to authors (one that I was looking to do, and found this while seeing if it would work). However, if we do not wish to provide that ability to library authors, placing the #[deprecated]
attribute on an impl should result in a compiler error.