Skip to content

Commit 101e17d

Browse files
committed
Add tests for items deprecated in the future
1 parent ecaf1f5 commit 101e17d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/test/compile-fail/deprecation-lint.rs

+8
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ mod this_crate {
180180
#[deprecated(since = "1.0.0", note = "text")]
181181
pub fn deprecated_text() {}
182182

183+
#[deprecated(since = "99.99.99", note = "text")]
184+
pub fn deprecated_future() {}
185+
#[deprecated(since = "99.99.99", note = "text")]
186+
pub fn deprecated_future_text() {}
187+
183188
pub struct MethodTester;
184189

185190
impl MethodTester {
@@ -266,6 +271,9 @@ mod this_crate {
266271
<Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
267272
<Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
268273

274+
deprecated_future(); // Fine; no error.
275+
deprecated_future_text(); // Fine; no error.
276+
269277
let _ = DeprecatedStruct {
270278
//~^ ERROR use of deprecated item 'this_crate::DeprecatedStruct': text
271279
i: 0 //~ ERROR use of deprecated item 'this_crate::DeprecatedStruct::i': text

src/test/rustdoc/deprecated-future.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(deprecated)]
12+
13+
// @has deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \
14+
// 'This will be deprecated in 99.99.99: effectively never'
15+
#[deprecated(since = "99.99.99", note = "effectively never")]
16+
pub struct S;

0 commit comments

Comments
 (0)