Skip to content

Commit 03b01c5

Browse files
committed
Auto merge of #109253 - matthiaskrgr:rollup-2xmv5zk, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #108958 (Remove box expressions from HIR) - #109044 (Prevent stable `libtest` from supporting `-Zunstable-options`) - #109155 (Fix riscv64 fuchsia LLVM target name) - #109156 (Fix linker detection for clang with prefix) - #109181 (inherit_overflow: adapt pattern to also work with v0 mangling) - #109198 (Install projection from RPITIT to default trait method opaque correctly) - #109215 (Use sort_by_key instead of sort_by) - #109229 (Fix invalid markdown link references) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents c50c62d + 0584bde commit 03b01c5

File tree

83 files changed

+451
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+451
-192
lines changed

compiler/rustc_ast/src/util/parser.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ pub enum ExprPrecedence {
259259
Assign,
260260
AssignOp,
261261

262-
Box,
263262
AddrOf,
264263
Let,
265264
Unary,
@@ -319,8 +318,7 @@ impl ExprPrecedence {
319318
ExprPrecedence::AssignOp => AssocOp::Assign.precedence() as i8,
320319

321320
// Unary, prefix
322-
ExprPrecedence::Box
323-
| ExprPrecedence::AddrOf
321+
ExprPrecedence::AddrOf
324322
// Here `let pats = expr` has `let pats =` as a "unary" prefix of `expr`.
325323
// However, this is not exactly right. When `let _ = a` is the LHS of a binop we
326324
// need parens sometimes. E.g. we can print `(let _ = a) && b` as `let _ = a && b`

compiler/rustc_borrowck/src/region_infer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn sccs_info<'cx, 'tcx>(
255255
let var_to_origin = infcx.reg_var_to_origin.borrow();
256256

257257
let mut var_to_origin_sorted = var_to_origin.clone().into_iter().collect::<Vec<_>>();
258-
var_to_origin_sorted.sort_by(|a, b| a.0.cmp(&b.0));
258+
var_to_origin_sorted.sort_by_key(|vto| vto.0);
259259
let mut debug_str = "region variables to origins:\n".to_string();
260260
for (reg_var, origin) in var_to_origin_sorted.into_iter() {
261261
debug_str.push_str(&format!("{:?}: {:?}\n", reg_var, origin));
@@ -2216,7 +2216,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
22162216
// is in the same SCC or something. In that case, find what
22172217
// appears to be the most interesting point to report to the
22182218
// user via an even more ad-hoc guess.
2219-
categorized_path.sort_by(|p0, p1| p0.category.cmp(&p1.category));
2219+
categorized_path.sort_by_key(|p| p.category);
22202220
debug!("sorted_path={:#?}", categorized_path);
22212221

22222222
(categorized_path.remove(0), extra_info)

compiler/rustc_codegen_ssa/src/back/link.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1199,15 +1199,17 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
11991199
.and_then(|(lhs, rhs)| rhs.chars().all(char::is_numeric).then_some(lhs))
12001200
.unwrap_or(stem);
12011201

1202-
// GCC can have an optional target prefix.
1202+
// GCC/Clang can have an optional target prefix.
12031203
let flavor = if stem == "emcc" {
12041204
LinkerFlavor::EmCc
12051205
} else if stem == "gcc"
12061206
|| stem.ends_with("-gcc")
12071207
|| stem == "g++"
12081208
|| stem.ends_with("-g++")
12091209
|| stem == "clang"
1210+
|| stem.ends_with("-clang")
12101211
|| stem == "clang++"
1212+
|| stem.ends_with("-clang++")
12111213
{
12121214
LinkerFlavor::from_cli(LinkerFlavorCli::Gcc, &sess.target)
12131215
} else if stem == "wasm-ld" || stem.ends_with("-wasm-ld") {

compiler/rustc_hir/src/hir.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,6 @@ pub struct Expr<'hir> {
16731673
impl Expr<'_> {
16741674
pub fn precedence(&self) -> ExprPrecedence {
16751675
match self.kind {
1676-
ExprKind::Box(_) => ExprPrecedence::Box,
16771676
ExprKind::ConstBlock(_) => ExprPrecedence::ConstBlock,
16781677
ExprKind::Array(_) => ExprPrecedence::Array,
16791678
ExprKind::Call(..) => ExprPrecedence::Call,
@@ -1763,7 +1762,6 @@ impl Expr<'_> {
17631762
| ExprKind::Lit(_)
17641763
| ExprKind::ConstBlock(..)
17651764
| ExprKind::Unary(..)
1766-
| ExprKind::Box(..)
17671765
| ExprKind::AddrOf(..)
17681766
| ExprKind::Binary(..)
17691767
| ExprKind::Yield(..)
@@ -1851,7 +1849,6 @@ impl Expr<'_> {
18511849
| ExprKind::InlineAsm(..)
18521850
| ExprKind::AssignOp(..)
18531851
| ExprKind::ConstBlock(..)
1854-
| ExprKind::Box(..)
18551852
| ExprKind::Binary(..)
18561853
| ExprKind::Yield(..)
18571854
| ExprKind::DropTemps(..)
@@ -1862,8 +1859,7 @@ impl Expr<'_> {
18621859
/// To a first-order approximation, is this a pattern?
18631860
pub fn is_approximately_pattern(&self) -> bool {
18641861
match &self.kind {
1865-
ExprKind::Box(_)
1866-
| ExprKind::Array(_)
1862+
ExprKind::Array(_)
18671863
| ExprKind::Call(..)
18681864
| ExprKind::Tup(_)
18691865
| ExprKind::Lit(_)
@@ -1910,8 +1906,6 @@ pub fn is_range_literal(expr: &Expr<'_>) -> bool {
19101906

19111907
#[derive(Debug, HashStable_Generic)]
19121908
pub enum ExprKind<'hir> {
1913-
/// A `box x` expression.
1914-
Box(&'hir Expr<'hir>),
19151909
/// Allow anonymous constants from an inline `const` block
19161910
ConstBlock(AnonConst),
19171911
/// An array (e.g., `[a, b, c, d]`).

compiler/rustc_hir/src/intravisit.rs

-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,6 @@ pub fn walk_anon_const<'v, V: Visitor<'v>>(visitor: &mut V, constant: &'v AnonCo
682682
pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>) {
683683
visitor.visit_id(expression.hir_id);
684684
match expression.kind {
685-
ExprKind::Box(ref subexpression) => visitor.visit_expr(subexpression),
686685
ExprKind::Array(subexpressions) => {
687686
walk_list!(visitor, visit_expr, subexpressions);
688687
}

compiler/rustc_hir_analysis/src/check/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
557557
check_opaque(tcx, id);
558558
}
559559
DefKind::ImplTraitPlaceholder => {
560-
let parent = tcx.impl_trait_in_trait_parent(id.owner_id.to_def_id());
560+
let parent = tcx.impl_trait_in_trait_parent_fn(id.owner_id.to_def_id());
561561
// Only check the validity of this opaque type if the function has a default body
562562
if let hir::Node::TraitItem(hir::TraitItem {
563563
kind: hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)),

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::autoderef::Autoderef;
22
use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};
33

4-
use hir::def::DefKind;
54
use rustc_ast as ast;
65
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
76
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed};
@@ -1548,16 +1547,27 @@ fn check_return_position_impl_trait_in_trait_bounds<'tcx>(
15481547
if let Some(assoc_item) = tcx.opt_associated_item(fn_def_id.to_def_id())
15491548
&& assoc_item.container == ty::AssocItemContainer::TraitContainer
15501549
{
1550+
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty): Even with the new lowering
1551+
// strategy, we can't just call `check_associated_item` on the new RPITITs,
1552+
// because tests like `tests/ui/async-await/in-trait/implied-bounds.rs` will fail.
1553+
// That's because we need to check that the bounds of the RPITIT hold using
1554+
// the special substs that we create during opaque type lowering, otherwise we're
1555+
// getting a bunch of early bound and free regions mixed up... Haven't looked too
1556+
// deep into this, though.
15511557
for arg in fn_output.walk() {
15521558
if let ty::GenericArgKind::Type(ty) = arg.unpack()
1553-
&& let ty::Alias(ty::Opaque, proj) = ty.kind()
1554-
&& tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder
1555-
&& tcx.impl_trait_in_trait_parent(proj.def_id) == fn_def_id.to_def_id()
1559+
// RPITITs are always eagerly normalized into opaques, so always look for an
1560+
// opaque here.
1561+
&& let ty::Alias(ty::Opaque, opaque_ty) = ty.kind()
1562+
&& let Some(opaque_def_id) = opaque_ty.def_id.as_local()
1563+
&& let opaque = tcx.hir().expect_item(opaque_def_id).expect_opaque_ty()
1564+
&& let hir::OpaqueTyOrigin::FnReturn(source) | hir::OpaqueTyOrigin::AsyncFn(source) = opaque.origin
1565+
&& source == fn_def_id
15561566
{
1557-
let span = tcx.def_span(proj.def_id);
1558-
let bounds = wfcx.tcx().explicit_item_bounds(proj.def_id);
1567+
let span = tcx.def_span(opaque_ty.def_id);
1568+
let bounds = wfcx.tcx().explicit_item_bounds(opaque_ty.def_id);
15591569
let wf_obligations = bounds.iter().flat_map(|&(bound, bound_span)| {
1560-
let bound = ty::EarlyBinder(bound).subst(tcx, proj.substs);
1570+
let bound = ty::EarlyBinder(bound).subst(tcx, opaque_ty.substs);
15611571
let normalized_bound = wfcx.normalize(span, None, bound);
15621572
traits::wf::predicate_obligations(
15631573
wfcx.infcx,

compiler/rustc_hir_analysis/src/collect/item_bounds.rs

+22-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::astconv::AstConv;
33
use rustc_hir as hir;
44
use rustc_infer::traits::util;
55
use rustc_middle::ty::subst::InternalSubsts;
6-
use rustc_middle::ty::{self, ImplTraitInTraitData, Ty, TyCtxt};
6+
use rustc_middle::ty::{self, Ty, TyCtxt};
77
use rustc_span::def_id::DefId;
88
use rustc_span::Span;
99

@@ -76,18 +76,26 @@ pub(super) fn explicit_item_bounds(
7676
tcx: TyCtxt<'_>,
7777
def_id: DefId,
7878
) -> &'_ [(ty::Predicate<'_>, Span)] {
79-
// If the def_id is about an RPITIT, delegate explicit_item_bounds to the opaque_def_id that
80-
// generated the synthesized associate type.
81-
let rpitit_info = if let Some(ImplTraitInTraitData::Trait { opaque_def_id, .. }) =
82-
tcx.opt_rpitit_info(def_id)
83-
{
84-
Some(opaque_def_id)
85-
} else {
86-
None
87-
};
79+
match tcx.opt_rpitit_info(def_id) {
80+
// RPITIT's bounds are the same as opaque type bounds, but with
81+
// a projection self type.
82+
Some(ty::ImplTraitInTraitData::Trait { opaque_def_id, .. }) => {
83+
let item = tcx.hir().get_by_def_id(opaque_def_id.expect_local()).expect_item();
84+
let opaque_ty = item.expect_opaque_ty();
85+
return opaque_type_bounds(
86+
tcx,
87+
opaque_def_id,
88+
opaque_ty.bounds,
89+
tcx.mk_projection(def_id, ty::InternalSubsts::identity_for_item(tcx, def_id)),
90+
item.span,
91+
);
92+
}
93+
// These should have been fed!
94+
Some(ty::ImplTraitInTraitData::Impl { .. }) => unreachable!(),
95+
None => {}
96+
}
8897

89-
let bounds_def_id = rpitit_info.unwrap_or(def_id);
90-
let hir_id = tcx.hir().local_def_id_to_hir_id(bounds_def_id.expect_local());
98+
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
9199
match tcx.hir().get(hir_id) {
92100
hir::Node::TraitItem(hir::TraitItem {
93101
kind: hir::TraitItemKind::Type(bounds, _),
@@ -100,12 +108,12 @@ pub(super) fn explicit_item_bounds(
100108
..
101109
}) => {
102110
let substs = InternalSubsts::identity_for_item(tcx, def_id);
103-
let item_ty = if *in_trait || rpitit_info.is_some() {
111+
let item_ty = if *in_trait && !tcx.lower_impl_trait_in_trait_to_assoc_ty() {
104112
tcx.mk_projection(def_id, substs)
105113
} else {
106114
tcx.mk_opaque(def_id, substs)
107115
};
108-
opaque_type_bounds(tcx, bounds_def_id, bounds, item_ty, *span)
116+
opaque_type_bounds(tcx, def_id, bounds, item_ty, *span)
109117
}
110118
_ => bug!("item_bounds called on {:?}", def_id),
111119
}

compiler/rustc_hir_analysis/src/variance/mod.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,14 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
112112
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
113113
match t.kind() {
114114
ty::Alias(_, ty::AliasTy { def_id, substs, .. })
115-
if matches!(
116-
self.tcx.def_kind(*def_id),
117-
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder
118-
) =>
115+
if matches!(self.tcx.def_kind(*def_id), DefKind::OpaqueTy) =>
116+
{
117+
self.visit_opaque(*def_id, substs)
118+
}
119+
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) check whether this is necessary
120+
// at all for RPITITs.
121+
ty::Alias(_, ty::AliasTy { def_id, substs, .. })
122+
if self.tcx.is_impl_trait_in_trait(*def_id) =>
119123
{
120124
self.visit_opaque(*def_id, substs)
121125
}

compiler/rustc_hir_pretty/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1366,10 +1366,6 @@ impl<'a> State<'a> {
13661366
self.ibox(INDENT_UNIT);
13671367
self.ann.pre(self, AnnNode::Expr(expr));
13681368
match expr.kind {
1369-
hir::ExprKind::Box(expr) => {
1370-
self.word_space("Box::new");
1371-
self.print_call_post(std::slice::from_ref(expr));
1372-
}
13731369
hir::ExprKind::Array(exprs) => {
13741370
self.print_expr_vec(exprs);
13751371
}

compiler/rustc_hir_typeck/src/closure.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use super::{check_fn, Expectation, FnCtxt, GeneratorTypes};
44

5-
use hir::def::DefKind;
65
use rustc_errors::ErrorGuaranteed;
76
use rustc_hir as hir;
87
use rustc_hir::lang_items::LangItem;
@@ -715,14 +714,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
715714
.subst_iter_copied(self.tcx, substs)
716715
.find_map(|(p, s)| get_future_output(p, s))?,
717716
ty::Error(_) => return None,
718-
ty::Alias(ty::Projection, proj)
719-
if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder =>
720-
{
721-
self.tcx
722-
.bound_explicit_item_bounds(proj.def_id)
723-
.subst_iter_copied(self.tcx, proj.substs)
724-
.find_map(|(p, s)| get_future_output(p, s))?
725-
}
717+
ty::Alias(ty::Projection, proj) if self.tcx.is_impl_trait_in_trait(proj.def_id) => self
718+
.tcx
719+
.bound_explicit_item_bounds(proj.def_id)
720+
.subst_iter_copied(self.tcx, proj.substs)
721+
.find_map(|(p, s)| get_future_output(p, s))?,
726722
_ => span_bug!(
727723
self.tcx.def_span(expr_def_id),
728724
"async fn generator return type not an inference variable: {ret_ty}"

compiler/rustc_hir_typeck/src/expr.rs

-11
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
284284

285285
let tcx = self.tcx;
286286
match expr.kind {
287-
ExprKind::Box(subexpr) => self.check_expr_box(subexpr, expected),
288287
ExprKind::Lit(ref lit) => self.check_lit(&lit, expected),
289288
ExprKind::Binary(op, lhs, rhs) => self.check_binop(expr, op, lhs, rhs, expected),
290289
ExprKind::Assign(lhs, rhs, span) => {
@@ -359,16 +358,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
359358
}
360359
}
361360

362-
fn check_expr_box(&self, expr: &'tcx hir::Expr<'tcx>, expected: Expectation<'tcx>) -> Ty<'tcx> {
363-
let expected_inner = expected.to_option(self).map_or(NoExpectation, |ty| match ty.kind() {
364-
ty::Adt(def, _) if def.is_box() => Expectation::rvalue_hint(self, ty.boxed_ty()),
365-
_ => NoExpectation,
366-
});
367-
let referent_ty = self.check_expr_with_expectation(expr, expected_inner);
368-
self.require_type_is_sized(referent_ty, expr.span, traits::SizedBoxType);
369-
self.tcx.mk_box(referent_ty)
370-
}
371-
372361
fn check_expr_unary(
373362
&self,
374363
unop: hir::UnOp,

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

-4
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,6 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
356356
self.walk_captures(closure);
357357
}
358358

359-
hir::ExprKind::Box(ref base) => {
360-
self.consume_expr(base);
361-
}
362-
363359
hir::ExprKind::Yield(value, _) => {
364360
self.consume_expr(value);
365361
}

compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs

-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ impl<'a, 'tcx> DropRangeVisitor<'a, 'tcx> {
190190
//
191191
// Some of these may be interesting in the future
192192
ExprKind::Path(..)
193-
| ExprKind::Box(..)
194193
| ExprKind::ConstBlock(..)
195194
| ExprKind::Array(..)
196195
| ExprKind::Call(..)
@@ -478,7 +477,6 @@ impl<'a, 'tcx> Visitor<'tcx> for DropRangeVisitor<'a, 'tcx> {
478477
| ExprKind::AssignOp(..)
479478
| ExprKind::Binary(..)
480479
| ExprKind::Block(..)
481-
| ExprKind::Box(..)
482480
| ExprKind::Cast(..)
483481
| ExprKind::Closure { .. }
484482
| ExprKind::ConstBlock(..)

compiler/rustc_hir_typeck/src/mem_categorization.rs

-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
382382
| hir::ExprKind::Struct(..)
383383
| hir::ExprKind::Repeat(..)
384384
| hir::ExprKind::InlineAsm(..)
385-
| hir::ExprKind::Box(..)
386385
| hir::ExprKind::Err(_) => Ok(self.cat_rvalue(expr.hir_id, expr.span, expr_ty)),
387386
}
388387
}

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,12 @@ impl<'tcx> InferCtxt<'tcx> {
359359
pub fn get_impl_future_output_ty(&self, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
360360
let (def_id, substs) = match *ty.kind() {
361361
ty::Alias(_, ty::AliasTy { def_id, substs, .. })
362-
if matches!(
363-
self.tcx.def_kind(def_id),
364-
DefKind::OpaqueTy | DefKind::ImplTraitPlaceholder
365-
) =>
362+
if matches!(self.tcx.def_kind(def_id), DefKind::OpaqueTy) =>
363+
{
364+
(def_id, substs)
365+
}
366+
ty::Alias(_, ty::AliasTy { def_id, substs, .. })
367+
if self.tcx.is_impl_trait_in_trait(def_id) =>
366368
{
367369
(def_id, substs)
368370
}
@@ -1757,8 +1759,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
17571759
)
17581760
}
17591761
(true, ty::Alias(ty::Projection, proj))
1760-
if self.tcx.def_kind(proj.def_id)
1761-
== DefKind::ImplTraitPlaceholder =>
1762+
if self.tcx.is_impl_trait_in_trait(proj.def_id) =>
17621763
{
17631764
let sm = self.tcx.sess.source_map();
17641765
let pos = sm.lookup_char_pos(self.tcx.def_span(proj.def_id).lo());

compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::TypeErrCtxt;
22
use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
33
use rustc_errors::{pluralize, Diagnostic, MultiSpan};
4-
use rustc_hir::{self as hir, def::DefKind};
4+
use rustc_hir as hir;
55
use rustc_middle::traits::ObligationCauseCode;
66
use rustc_middle::ty::error::ExpectedFound;
77
use rustc_middle::ty::print::Printer;
@@ -75,7 +75,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
7575
diag.note("an associated type was expected, but a different one was found");
7676
}
7777
(ty::Param(p), ty::Alias(ty::Projection, proj)) | (ty::Alias(ty::Projection, proj), ty::Param(p))
78-
if tcx.def_kind(proj.def_id) != DefKind::ImplTraitPlaceholder =>
78+
if !tcx.is_impl_trait_in_trait(proj.def_id) =>
7979
{
8080
let p_def_id = tcx
8181
.generics_of(body_owner_def_id)
@@ -222,7 +222,7 @@ impl<T> Trait<T> for X {
222222
diag.span_label(p_span, "this type parameter");
223223
}
224224
}
225-
(ty::Alias(ty::Projection, proj_ty), _) if tcx.def_kind(proj_ty.def_id) != DefKind::ImplTraitPlaceholder => {
225+
(ty::Alias(ty::Projection, proj_ty), _) if !tcx.is_impl_trait_in_trait(proj_ty.def_id) => {
226226
self.expected_projection(
227227
diag,
228228
proj_ty,
@@ -231,7 +231,7 @@ impl<T> Trait<T> for X {
231231
cause.code(),
232232
);
233233
}
234-
(_, ty::Alias(ty::Projection, proj_ty)) if tcx.def_kind(proj_ty.def_id) != DefKind::ImplTraitPlaceholder => {
234+
(_, ty::Alias(ty::Projection, proj_ty)) if !tcx.is_impl_trait_in_trait(proj_ty.def_id) => {
235235
let msg = format!(
236236
"consider constraining the associated type `{}` to `{}`",
237237
values.found, values.expected,

0 commit comments

Comments
 (0)