diff options
| author | Georg Semmler <github@weiznich.de> | 2024-05-10 14:12:30 +0200 |
|---|---|---|
| committer | Georg Semmler <github@weiznich.de> | 2024-05-21 13:14:41 +0200 |
| commit | 2cff3e90bcd162964546ca9936c209aa952c1af4 (patch) | |
| tree | 78e26281013d0cdc5d9c4403729c082938b6adf6 /compiler/rustc_trait_selection/src | |
| parent | e8ada6ab253b510ac88edda131021d9878f2984f (diff) | |
| download | rust-2cff3e90bcd162964546ca9936c209aa952c1af4.tar.gz rust-2cff3e90bcd162964546ca9936c209aa952c1af4.zip | |
Move `#[do_not_recommend]` to the `#[diagnostic]` namespace
This commit moves the `#[do_not_recommend]` attribute to the `#[diagnostic]` namespace. It still requires `#![feature(do_not_recommend)]` to work.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/fulfill.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/fulfill.rs b/compiler/rustc_trait_selection/src/solve/fulfill.rs index 4933080451d..7291eb00e72 100644 --- a/compiler/rustc_trait_selection/src/solve/fulfill.rs +++ b/compiler/rustc_trait_selection/src/solve/fulfill.rs @@ -380,7 +380,10 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { source: CandidateSource::Impl(impl_def_id), result: _, } = candidate.kind() - && goal.infcx().tcx.has_attr(impl_def_id, sym::do_not_recommend) + && goal + .infcx() + .tcx + .has_attrs_with_path(impl_def_id, &[sym::diagnostic, sym::do_not_recommend]) { return ControlFlow::Break(self.obligation.clone()); } diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 20dfb5e6642..494fca0336c 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -1012,7 +1012,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let mut base_cause = obligation.cause.code().clone(); loop { if let ObligationCauseCode::ImplDerived(ref c) = base_cause { - if self.tcx.has_attr(c.impl_or_alias_def_id, sym::do_not_recommend) { + if self.tcx.has_attrs_with_path( + c.impl_or_alias_def_id, + &[sym::diagnostic, sym::do_not_recommend], + ) { let code = (*c.derived.parent_code).clone(); obligation.cause.map_code(|_| code); obligation.predicate = c.derived.parent_trait_pred.upcast(self.tcx); |
