Auto merge of #114202 - fee1-dead-contrib:rm-constness-2, r=oli-obk · rust-lang/rust@20747af (original) (raw)

`@@ -62,11 +62,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

`

62

62

`match bound_pred.skip_binder() {

`

63

63

` ty::ClauseKind::Trait(trait_pred) => {

`

64

64

`assert_eq!(trait_pred.polarity, ty::ImplPolarity::Positive);

`

65

``

`-

trait_bounds.push((

`

66

``

`-

bound_pred.rebind(trait_pred.trait_ref),

`

67

``

`-

span,

`

68

``

`-

trait_pred.constness,

`

69

``

`-

));

`

``

65

`+

trait_bounds.push((bound_pred.rebind(trait_pred.trait_ref), span));

`

70

66

`}

`

71

67

` ty::ClauseKind::Projection(proj) => {

`

72

68

` projection_bounds.push((bound_pred.rebind(proj), span));

`

`@@ -86,7 +82,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

`

86

82

`// Expand trait aliases recursively and check that only one regular (non-auto) trait

`

87

83

`// is used and no 'maybe' bounds are used.

`

88

84

`let expanded_traits =

`

89

``

`-

traits::expand_trait_aliases(tcx, trait_bounds.iter().map(|&(a, b, _)| (a, b)));

`

``

85

`+

traits::expand_trait_aliases(tcx, trait_bounds.iter().map(|&(a, b)| (a, b)));

`

90

86

``

91

87

`let (mut auto_traits, regular_traits): (Vec<_>, Vec<_>) = expanded_traits

`

92

88

`.filter(|i| i.trait_ref().self_ty().skip_binder() == dummy_self)

`

`@@ -126,7 +122,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

`

126

122

`if regular_traits.is_empty() && auto_traits.is_empty() {

`

127

123

`let trait_alias_span = trait_bounds

`

128

124

`.iter()

`

129

``

`-

.map(|&(trait_ref, _, _)| trait_ref.def_id())

`

``

125

`+

.map(|&(trait_ref, _)| trait_ref.def_id())

`

130

126

`.find(|&trait_ref| tcx.is_trait_alias(trait_ref))

`

131

127

`.map(|trait_ref| tcx.def_span(trait_ref));

`

132

128

`let reported =

`

`@@ -157,10 +153,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

`

157

153

``

158

154

`let regular_traits_refs_spans = trait_bounds

`

159

155

`.into_iter()

`

160

``

`-

.filter(|(trait_ref, _, _)| !tcx.trait_is_auto(trait_ref.def_id()));

`

``

156

`+

.filter(|(trait_ref, _)| !tcx.trait_is_auto(trait_ref.def_id()));

`

161

157

``

162

``

`-

for (base_trait_ref, span, constness) in regular_traits_refs_spans {

`

163

``

`-

assert_eq!(constness, ty::BoundConstness::NotConst);

`

``

158

`+

for (base_trait_ref, span) in regular_traits_refs_spans {

`

164

159

`let base_pred: ty::Predicate<'tcx> = base_trait_ref.to_predicate(tcx);

`

165

160

`for pred in traits::elaborate(tcx, [base_pred]) {

`

166

161

`` debug!("conv_object_ty_poly_trait_ref: observing object predicate {:?}", pred);

``