@@ -11,7 +11,7 @@ use rustc_hir::intravisit::{self, Visitor};
11
11
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
12
12
use rustc_middle:: ty:: { GenericPredicates , ImplTraitInTraitData , ToPredicate } ;
13
13
use rustc_span:: symbol:: Ident ;
14
- use rustc_span:: { sym , Span , DUMMY_SP } ;
14
+ use rustc_span:: { Span , DUMMY_SP } ;
15
15
16
16
/// Returns a list of all type predicates (explicit and implicit) for the definition with
17
17
/// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus
@@ -38,38 +38,12 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
38
38
// an obligation and instead be skipped. Otherwise we'd use
39
39
// `tcx.def_span(def_id);`
40
40
let span = rustc_span:: DUMMY_SP ;
41
- let non_const_bound = if tcx. features ( ) . effects && tcx. has_attr ( def_id, sym:: const_trait) {
42
- // when `Self` is a const trait, also add `Self: Trait<.., true>` as implied bound,
43
- // because only implementing `Self: Trait<.., false>` is currently not possible.
44
- Some ( (
45
- ty:: TraitRef :: new (
46
- tcx,
47
- def_id,
48
- ty:: GenericArgs :: for_item ( tcx, def_id, |param, _| {
49
- if param. is_host_effect ( ) {
50
- tcx. consts . true_ . into ( )
51
- } else {
52
- tcx. mk_param_from_def ( param)
53
- }
54
- } ) ,
55
- )
56
- . to_predicate ( tcx) ,
41
+
42
+ result. predicates =
43
+ tcx. arena . alloc_from_iter ( result. predicates . iter ( ) . copied ( ) . chain ( std:: iter:: once ( (
44
+ ty:: TraitRef :: identity ( tcx, def_id) . to_predicate ( tcx) ,
57
45
span,
58
- ) )
59
- } else {
60
- None
61
- } ;
62
- result. predicates = tcx. arena . alloc_from_iter (
63
- result
64
- . predicates
65
- . iter ( )
66
- . copied ( )
67
- . chain ( std:: iter:: once ( (
68
- ty:: TraitRef :: identity ( tcx, def_id) . to_predicate ( tcx) ,
69
- span,
70
- ) ) )
71
- . chain ( non_const_bound) ,
72
- ) ;
46
+ ) ) ) ) ;
73
47
}
74
48
debug ! ( "predicates_of(def_id={:?}) = {:?}" , def_id, result) ;
75
49
result
0 commit comments