Skip to content

Commit 224b651

Browse files
authored
Rollup merge of #111861 - compiler-errors:rtn-in-super, r=jackh726
Don't ICE on return-type notation when promoting trait preds to associated type bounds Fixes #111846
2 parents edbd5c5 + e54bc1c commit 224b651

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ pub(super) fn explicit_predicates_of<'tcx>(
427427
// supertrait).
428428
if let ty::Alias(ty::Projection, projection) = ty.kind() {
429429
projection.substs == trait_identity_substs
430+
// FIXME(return_type_notation): This check should be more robust
431+
&& !tcx.is_impl_trait_in_trait(projection.def_id)
430432
&& tcx.associated_item(projection.def_id).container_id(tcx)
431433
== def_id.to_def_id()
432434
} else {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// check-pass
2+
3+
#![feature(return_position_impl_trait_in_trait, return_type_notation)]
4+
//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use
5+
6+
trait IntFactory {
7+
fn stream(&self) -> impl Iterator<Item = i32>;
8+
}
9+
trait SendIntFactory: IntFactory<stream(): Send> + Send {}
10+
11+
fn main() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/supertrait-bound.rs:3:49
3+
|
4+
LL | #![feature(return_position_impl_trait_in_trait, return_type_notation)]
5+
| ^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+

0 commit comments

Comments
 (0)