mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 22:53:28 +00:00
Revert "Make nested RPITIT inherit the parent opaque's generics." and adjust test
This reverts commit e2d41f4c97
.
This commit is contained in:
parent
d4203eda5f
commit
0a2b55d4c8
@ -4,6 +4,7 @@ use hir::{
|
|||||||
GenericParamKind, HirId, Node,
|
GenericParamKind, HirId, Node,
|
||||||
};
|
};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
@ -142,7 +143,20 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
|
|||||||
Some(tcx.typeck_root_def_id(def_id))
|
Some(tcx.typeck_root_def_id(def_id))
|
||||||
}
|
}
|
||||||
Node::Item(item) => match item.kind {
|
Node::Item(item) => match item.kind {
|
||||||
ItemKind::OpaqueTy(hir::OpaqueTy { .. }) => {
|
ItemKind::OpaqueTy(hir::OpaqueTy {
|
||||||
|
origin:
|
||||||
|
hir::OpaqueTyOrigin::FnReturn(fn_def_id) | hir::OpaqueTyOrigin::AsyncFn(fn_def_id),
|
||||||
|
in_trait,
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
if in_trait {
|
||||||
|
assert!(matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn))
|
||||||
|
} else {
|
||||||
|
assert!(matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn | DefKind::Fn))
|
||||||
|
}
|
||||||
|
Some(fn_def_id.to_def_id())
|
||||||
|
}
|
||||||
|
ItemKind::OpaqueTy(hir::OpaqueTy { origin: hir::OpaqueTyOrigin::TyAlias, .. }) => {
|
||||||
let parent_id = tcx.hir().get_parent_item(hir_id);
|
let parent_id = tcx.hir().get_parent_item(hir_id);
|
||||||
assert_ne!(parent_id, hir::CRATE_OWNER_ID);
|
assert_ne!(parent_id, hir::CRATE_OWNER_ID);
|
||||||
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent_id);
|
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent_id);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// known-bug: #105197
|
||||||
|
// failure-status:101
|
||||||
|
// dont-check-compiler-stderr
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
Loading…
Reference in New Issue
Block a user