Don't perform selection if IATs are not enabled
This commit is contained in:
parent
6162f6f123
commit
838f85d6f7
10 changed files with 99 additions and 46 deletions
|
@ -1893,6 +1893,15 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
) -> Result<Option<(Ty<'tcx>, DefId)>, ErrorGuaranteed> {
|
||||
let tcx = self.tcx();
|
||||
|
||||
// Don't attempt to look up inherent associated types when the feature is not enabled.
|
||||
// Theoretically it'd be fine to do so since we feature-gate their definition site.
|
||||
// However, due to current limitations of the implementation (caused by us performing
|
||||
// selection in AstConv), IATs can lead to cycle errors (#108491, #110106) which mask the
|
||||
// feature-gate error, needlessly confusing users that use IATs by accident (#113265).
|
||||
if !tcx.features().inherent_associated_types {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let candidates: Vec<_> = tcx
|
||||
.inherent_impls(adt_did)
|
||||
.iter()
|
||||
|
@ -1903,11 +1912,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
return Ok(None);
|
||||
}
|
||||
|
||||
if !tcx.features().inherent_associated_types {
|
||||
tcx.sess
|
||||
.delay_span_bug(span, "found inherent assoc type without the feature being gated");
|
||||
}
|
||||
|
||||
//
|
||||
// Select applicable inherent associated type candidates modulo regions.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue