forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#35317 - TimNN:internal-deprecated, r=eddyb
Ignore deprecation for items deprecated by the same attribute Whenever a node would be reported as deprecated: - check if the parent item is also deprecated - if it is and both were deprecated by the same attribute - skip the deprecation warning fixes rust-lang#35128 closes rust-lang#16490 r? @eddyb
- Loading branch information
Showing
5 changed files
with
205 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![deny(deprecated)] | ||
#![allow(warnings)] | ||
|
||
#[deprecated] | ||
fn issue_35128() { | ||
format_args!("foo"); | ||
} | ||
|
||
#[deprecated] | ||
fn issue_35128_minimal() { | ||
static FOO: &'static str = "foo"; | ||
let _ = FOO; | ||
} | ||
|
||
#[deprecated] | ||
mod silent { | ||
type DeprecatedType = u8; | ||
struct DeprecatedStruct; | ||
fn deprecated_fn() {} | ||
trait DeprecatedTrait {} | ||
static DEPRECATED_STATIC: u8 = 0; | ||
const DEPRECATED_CONST: u8 = 1; | ||
|
||
struct Foo(DeprecatedType); | ||
|
||
impl DeprecatedTrait for Foo {} | ||
|
||
impl Foo { | ||
fn bar<T: DeprecatedTrait>() { | ||
deprecated_fn(); | ||
} | ||
} | ||
|
||
fn foo() -> u8 { | ||
DEPRECATED_STATIC + | ||
DEPRECATED_CONST | ||
} | ||
} | ||
|
||
#[deprecated] | ||
mod loud { | ||
#[deprecated] | ||
type DeprecatedType = u8; | ||
#[deprecated] | ||
struct DeprecatedStruct; | ||
#[deprecated] | ||
fn deprecated_fn() {} | ||
#[deprecated] | ||
trait DeprecatedTrait {} | ||
#[deprecated] | ||
static DEPRECATED_STATIC: u8 = 0; | ||
#[deprecated] | ||
const DEPRECATED_CONST: u8 = 1; | ||
|
||
struct Foo(DeprecatedType); //~ ERROR use of deprecated item | ||
|
||
impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item | ||
|
||
impl Foo { | ||
fn bar<T: DeprecatedTrait>() { //~ ERROR use of deprecated item | ||
deprecated_fn(); //~ ERROR use of deprecated item | ||
} | ||
} | ||
|
||
fn foo() -> u8 { | ||
DEPRECATED_STATIC + //~ ERROR use of deprecated item | ||
DEPRECATED_CONST //~ ERROR use of deprecated item | ||
} | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.