Skip to content

Commit 589ad6a

Browse files
committed
Auto merge of #90883 - matthiaskrgr:rollup-iu9k5pe, r=matthiaskrgr
Rollup of 3 pull requests Successful merges: - #90771 (Fix trait object error code) - #90840 (relate lifetime in `TypeOutlives` bounds on drop impls) - #90853 (rustdoc: Use an empty Vec instead of Option<Vec>) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b416e38 + c677a8d commit 589ad6a

File tree

7 files changed

+46
-18
lines changed

7 files changed

+46
-18
lines changed

compiler/rustc_typeck/src/check/dropck.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,12 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
240240
ty::PredicateKind::ConstEvaluatable(a),
241241
ty::PredicateKind::ConstEvaluatable(b),
242242
) => tcx.try_unify_abstract_consts((a, b)),
243-
(ty::PredicateKind::TypeOutlives(a), ty::PredicateKind::TypeOutlives(b)) => {
244-
relator.relate(predicate.rebind(a.0), p.rebind(b.0)).is_ok()
243+
(
244+
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_a, lt_a)),
245+
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_b, lt_b)),
246+
) => {
247+
relator.relate(predicate.rebind(ty_a), p.rebind(ty_b)).is_ok()
248+
&& relator.relate(predicate.rebind(lt_a), p.rebind(lt_b)).is_ok()
245249
}
246250
_ => predicate == p,
247251
}

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
952952
let mut err = rustc_errors::struct_span_err!(
953953
self.sess(),
954954
self_ty.span,
955-
E0783,
955+
E0782,
956956
"{}",
957957
msg,
958958
);

src/librustdoc/html/render/cache.rs

-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ crate fn get_index_search_type<'tcx>(
205205

206206
inputs.retain(|a| a.ty.name.is_some());
207207
output.retain(|a| a.ty.name.is_some());
208-
let output = if output.is_empty() { None } else { Some(output) };
209208

210209
Some(IndexItemFunctionType { inputs, output })
211210
}

src/librustdoc/html/render/mod.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ crate struct RenderType {
117117
#[derive(Debug)]
118118
crate struct IndexItemFunctionType {
119119
inputs: Vec<TypeWithKind>,
120-
output: Option<Vec<TypeWithKind>>,
120+
output: Vec<TypeWithKind>,
121121
}
122122

123123
impl Serialize for IndexItemFunctionType {
@@ -126,21 +126,16 @@ impl Serialize for IndexItemFunctionType {
126126
S: Serializer,
127127
{
128128
// If we couldn't figure out a type, just write `null`.
129-
let mut iter = self.inputs.iter();
130-
if match self.output {
131-
Some(ref output) => iter.chain(output.iter()).any(|i| i.ty.name.is_none()),
132-
None => iter.any(|i| i.ty.name.is_none()),
133-
} {
129+
let has_missing = self.inputs.iter().chain(self.output.iter()).any(|i| i.ty.name.is_none());
130+
if has_missing {
134131
serializer.serialize_none()
135132
} else {
136133
let mut seq = serializer.serialize_seq(None)?;
137134
seq.serialize_element(&self.inputs)?;
138-
if let Some(output) = &self.output {
139-
if output.len() > 1 {
140-
seq.serialize_element(&output)?;
141-
} else {
142-
seq.serialize_element(&output[0])?;
143-
}
135+
match self.output.as_slice() {
136+
[] => {}
137+
[one] => seq.serialize_element(one)?,
138+
all => seq.serialize_element(all)?,
144139
}
145140
seq.end()
146141
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
struct Wrapper<'a, T>(&'a T)
2+
where
3+
T: 'a;
4+
5+
impl<'a, T> Drop for Wrapper<'a, T>
6+
where
7+
T: 'static,
8+
//~^ error: `Drop` impl requires `T: 'static` but the struct it is implemented for does not
9+
{
10+
fn drop(&mut self) {}
11+
}
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0367]: `Drop` impl requires `T: 'static` but the struct it is implemented for does not
2+
--> $DIR/relate_lt_in_type_outlives_bound.rs:7:8
3+
|
4+
LL | T: 'static,
5+
| ^^^^^^^
6+
|
7+
note: the implementor must specify the same requirement
8+
--> $DIR/relate_lt_in_type_outlives_bound.rs:1:1
9+
|
10+
LL | / struct Wrapper<'a, T>(&'a T)
11+
LL | | where
12+
LL | | T: 'a;
13+
| |__________^
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0367`.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
error[E0783]: trait objects without an explicit `dyn` are deprecated
1+
error[E0782]: trait objects without an explicit `dyn` are deprecated
22
--> $DIR/dyn-trait-sugg-2021.rs:10:5
33
|
44
LL | Foo::hi(123);
55
| ^^^ help: use `dyn`: `<dyn Foo>`
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0783`.
9+
For more information about this error, try `rustc --explain E0782`.

0 commit comments

Comments
 (0)