Rollup merge of #124717 - compiler-errors:do-not-recomment-next-solver, r=lcnr
Implement `do_not_recommend` in the new solver Put the test into `diagnostic_namespace` test folder even though it's not in the diagnostic namespace, because it should be soon. r? lcnr cc `@weiznich`
This commit is contained in:
commit
79071ee3a9
5 changed files with 68 additions and 1 deletions
|
@ -11,6 +11,7 @@ use rustc_infer::traits::{
|
|||
};
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use super::eval_ctxt::GenerateProofTree;
|
||||
use super::inspect::{ProofTreeInferCtxtExt, ProofTreeVisitor};
|
||||
|
@ -322,6 +323,14 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> {
|
|||
return ControlFlow::Break(self.obligation.clone());
|
||||
};
|
||||
|
||||
// Don't walk into impls that have `do_not_recommend`.
|
||||
if let ProbeKind::TraitCandidate { source: CandidateSource::Impl(impl_def_id), result: _ } =
|
||||
candidate.kind()
|
||||
&& goal.infcx().tcx.has_attr(impl_def_id, sym::do_not_recommend)
|
||||
{
|
||||
return ControlFlow::Break(self.obligation.clone());
|
||||
}
|
||||
|
||||
// FIXME: Could we extract a trait ref from a projection here too?
|
||||
// FIXME: Also, what about considering >1 layer up the stack? May be necessary
|
||||
// for normalizes-to.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue