Avoid unused Option::map results
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
This commit is contained in:
parent
3360cc3a0e
commit
2325c20925
21 changed files with 111 additions and 64 deletions
|
@ -98,7 +98,7 @@ pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostic.map(|d| {
|
if let Some(d) = diagnostic {
|
||||||
struct_span_err!(d, attr.span, E0633, "malformed `unwind` attribute input")
|
struct_span_err!(d, attr.span, E0633, "malformed `unwind` attribute input")
|
||||||
.span_label(attr.span, "invalid argument")
|
.span_label(attr.span, "invalid argument")
|
||||||
.span_suggestions(
|
.span_suggestions(
|
||||||
|
@ -110,7 +110,7 @@ pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Op
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1172,10 +1172,10 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
// ignore derives so they remain unused
|
// ignore derives so they remain unused
|
||||||
let (attr, after_derive) = self.classify_nonitem(&mut expr);
|
let (attr, after_derive) = self.classify_nonitem(&mut expr);
|
||||||
|
|
||||||
if attr.is_some() {
|
if let Some(ref attr_value) = attr {
|
||||||
// Collect the invoc regardless of whether or not attributes are permitted here
|
// Collect the invoc regardless of whether or not attributes are permitted here
|
||||||
// expansion will eat the attribute so it won't error later.
|
// expansion will eat the attribute so it won't error later.
|
||||||
attr.as_ref().map(|a| self.cfg.maybe_emit_expr_attr_err(a));
|
self.cfg.maybe_emit_expr_attr_err(attr_value);
|
||||||
|
|
||||||
// AstFragmentKind::Expr requires the macro to emit an expression.
|
// AstFragmentKind::Expr requires the macro to emit an expression.
|
||||||
return self
|
return self
|
||||||
|
@ -1322,8 +1322,8 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
// Ignore derives so they remain unused.
|
// Ignore derives so they remain unused.
|
||||||
let (attr, after_derive) = self.classify_nonitem(&mut expr);
|
let (attr, after_derive) = self.classify_nonitem(&mut expr);
|
||||||
|
|
||||||
if attr.is_some() {
|
if let Some(ref attr_value) = attr {
|
||||||
attr.as_ref().map(|a| self.cfg.maybe_emit_expr_attr_err(a));
|
self.cfg.maybe_emit_expr_attr_err(attr_value);
|
||||||
|
|
||||||
return self
|
return self
|
||||||
.collect_attr(
|
.collect_attr(
|
||||||
|
|
|
@ -246,7 +246,7 @@ impl DefPath {
|
||||||
|
|
||||||
let mut opt_delimiter = None;
|
let mut opt_delimiter = None;
|
||||||
for component in &self.data {
|
for component in &self.data {
|
||||||
opt_delimiter.map(|d| s.push(d));
|
s.extend(opt_delimiter);
|
||||||
opt_delimiter = Some('-');
|
opt_delimiter = Some('-');
|
||||||
if component.disambiguator == 0 {
|
if component.disambiguator == 0 {
|
||||||
write!(s, "{}", component.data.as_symbol()).unwrap();
|
write!(s, "{}", component.data.as_symbol()).unwrap();
|
||||||
|
|
|
@ -755,7 +755,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
},
|
},
|
||||||
ObligationCauseCode::IfExpression(box IfExpressionCause { then, outer, semicolon }) => {
|
ObligationCauseCode::IfExpression(box IfExpressionCause { then, outer, semicolon }) => {
|
||||||
err.span_label(then, "expected because of this");
|
err.span_label(then, "expected because of this");
|
||||||
outer.map(|sp| err.span_label(sp, "`if` and `else` have incompatible types"));
|
if let Some(sp) = outer {
|
||||||
|
err.span_label(sp, "`if` and `else` have incompatible types");
|
||||||
|
}
|
||||||
if let Some(sp) = semicolon {
|
if let Some(sp) = semicolon {
|
||||||
err.span_suggestion_short(
|
err.span_suggestion_short(
|
||||||
sp,
|
sp,
|
||||||
|
|
|
@ -101,9 +101,15 @@ fn dump_crates(cstore: &CStore) {
|
||||||
info!(" hash: {}", data.hash());
|
info!(" hash: {}", data.hash());
|
||||||
info!(" reqd: {:?}", data.dep_kind());
|
info!(" reqd: {:?}", data.dep_kind());
|
||||||
let CrateSource { dylib, rlib, rmeta } = data.source();
|
let CrateSource { dylib, rlib, rmeta } = data.source();
|
||||||
dylib.as_ref().map(|dl| info!(" dylib: {}", dl.0.display()));
|
if let Some(dylib) = dylib {
|
||||||
rlib.as_ref().map(|rl| info!(" rlib: {}", rl.0.display()));
|
info!(" dylib: {}", dylib.0.display());
|
||||||
rmeta.as_ref().map(|rl| info!(" rmeta: {}", rl.0.display()));
|
}
|
||||||
|
if let Some(rlib) = rlib {
|
||||||
|
info!(" rlib: {}", rlib.0.display());
|
||||||
|
}
|
||||||
|
if let Some(rmeta) = rmeta {
|
||||||
|
info!(" rmeta: {}", rmeta.0.display());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1388,7 +1388,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert a Shallow borrow of any places that is switched on.
|
// Insert a Shallow borrow of any places that is switched on.
|
||||||
fake_borrows.as_mut().map(|fb| fb.insert(match_place));
|
if let Some(fb) = fake_borrows {
|
||||||
|
fb.insert(match_place);
|
||||||
|
}
|
||||||
|
|
||||||
// perform the test, branching to one of N blocks. For each of
|
// perform the test, branching to one of N blocks. For each of
|
||||||
// those N possible outcomes, create a (initially empty)
|
// those N possible outcomes, create a (initially empty)
|
||||||
|
|
|
@ -1206,8 +1206,8 @@ pub fn emit_unclosed_delims(unclosed_delims: &mut Vec<UnmatchedBrace>, sess: &Pa
|
||||||
*sess.reached_eof.borrow_mut() |=
|
*sess.reached_eof.borrow_mut() |=
|
||||||
unclosed_delims.iter().any(|unmatched_delim| unmatched_delim.found_delim.is_none());
|
unclosed_delims.iter().any(|unmatched_delim| unmatched_delim.found_delim.is_none());
|
||||||
for unmatched in unclosed_delims.drain(..) {
|
for unmatched in unclosed_delims.drain(..) {
|
||||||
make_unclosed_delims_error(unmatched, sess).map(|mut e| {
|
if let Some(mut e) = make_unclosed_delims_error(unmatched, sess) {
|
||||||
e.emit();
|
e.emit();
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,9 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
|
||||||
self.with_context(LabeledBlock, |v| v.visit_block(&b));
|
self.with_context(LabeledBlock, |v| v.visit_block(&b));
|
||||||
}
|
}
|
||||||
hir::ExprKind::Break(label, ref opt_expr) => {
|
hir::ExprKind::Break(label, ref opt_expr) => {
|
||||||
opt_expr.as_ref().map(|e| self.visit_expr(e));
|
if let Some(e) = opt_expr {
|
||||||
|
self.visit_expr(e);
|
||||||
|
}
|
||||||
|
|
||||||
if self.require_label_in_labeled_block(e.span, &label, "break") {
|
if self.require_label_in_labeled_block(e.span, &label, "break") {
|
||||||
// If we emitted an error about an unlabeled break in a labeled
|
// If we emitted an error about an unlabeled break in a labeled
|
||||||
|
|
|
@ -133,7 +133,11 @@ impl<CTX: QueryContext> QueryJob<CTX> {
|
||||||
/// as there are no concurrent jobs which could be waiting on us
|
/// as there are no concurrent jobs which could be waiting on us
|
||||||
pub fn signal_complete(self) {
|
pub fn signal_complete(self) {
|
||||||
#[cfg(parallel_compiler)]
|
#[cfg(parallel_compiler)]
|
||||||
self.latch.map(|latch| latch.set());
|
{
|
||||||
|
if let Some(latch) = self.latch {
|
||||||
|
latch.set();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1996,7 +1996,9 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
||||||
this.visit_expr(cond);
|
this.visit_expr(cond);
|
||||||
this.visit_block(then);
|
this.visit_block(then);
|
||||||
});
|
});
|
||||||
opt_else.as_ref().map(|expr| self.visit_expr(expr));
|
if let Some(expr) = opt_else {
|
||||||
|
self.visit_expr(expr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprKind::Loop(ref block, label) => self.resolve_labeled_block(label, expr.id, &block),
|
ExprKind::Loop(ref block, label) => self.resolve_labeled_block(label, expr.id, &block),
|
||||||
|
|
|
@ -499,7 +499,9 @@ impl<'a> ModuleData<'a> {
|
||||||
F: FnMut(&mut R, Ident, Namespace, &'a NameBinding<'a>),
|
F: FnMut(&mut R, Ident, Namespace, &'a NameBinding<'a>),
|
||||||
{
|
{
|
||||||
for (key, name_resolution) in resolver.as_mut().resolutions(self).borrow().iter() {
|
for (key, name_resolution) in resolver.as_mut().resolutions(self).borrow().iter() {
|
||||||
name_resolution.borrow().binding.map(|binding| f(resolver, key.ident, key.ns, binding));
|
if let Some(binding) = name_resolution.borrow().binding {
|
||||||
|
f(resolver, key.ident, key.ns, binding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -979,20 +979,21 @@ impl Target {
|
||||||
macro_rules! key {
|
macro_rules! key {
|
||||||
($key_name:ident) => ( {
|
($key_name:ident) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
obj.find(&name[..]).map(|o| o.as_string()
|
if let Some(s) = obj.find(&name).and_then(Json::as_string) {
|
||||||
.map(|s| base.options.$key_name = s.to_string()));
|
base.options.$key_name = s.to_string();
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
($key_name:ident, bool) => ( {
|
($key_name:ident, bool) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
obj.find(&name[..])
|
if let Some(s) = obj.find(&name).and_then(Json::as_boolean) {
|
||||||
.map(|o| o.as_boolean()
|
base.options.$key_name = s;
|
||||||
.map(|s| base.options.$key_name = s));
|
}
|
||||||
} );
|
} );
|
||||||
($key_name:ident, Option<u64>) => ( {
|
($key_name:ident, Option<u64>) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
obj.find(&name[..])
|
if let Some(s) = obj.find(&name).and_then(Json::as_u64) {
|
||||||
.map(|o| o.as_u64()
|
base.options.$key_name = Some(s);
|
||||||
.map(|s| base.options.$key_name = Some(s)));
|
}
|
||||||
} );
|
} );
|
||||||
($key_name:ident, MergeFunctions) => ( {
|
($key_name:ident, MergeFunctions) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
|
@ -1034,19 +1035,19 @@ impl Target {
|
||||||
} );
|
} );
|
||||||
($key_name:ident, list) => ( {
|
($key_name:ident, list) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
obj.find(&name[..]).map(|o| o.as_array()
|
if let Some(v) = obj.find(&name).and_then(Json::as_array) {
|
||||||
.map(|v| base.options.$key_name = v.iter()
|
base.options.$key_name = v.iter()
|
||||||
.map(|a| a.as_string().unwrap().to_string()).collect()
|
.map(|a| a.as_string().unwrap().to_string())
|
||||||
)
|
.collect();
|
||||||
);
|
}
|
||||||
} );
|
} );
|
||||||
($key_name:ident, opt_list) => ( {
|
($key_name:ident, opt_list) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
obj.find(&name[..]).map(|o| o.as_array()
|
if let Some(v) = obj.find(&name).and_then(Json::as_array) {
|
||||||
.map(|v| base.options.$key_name = Some(v.iter()
|
base.options.$key_name = Some(v.iter()
|
||||||
.map(|a| a.as_string().unwrap().to_string()).collect())
|
.map(|a| a.as_string().unwrap().to_string())
|
||||||
)
|
.collect());
|
||||||
);
|
}
|
||||||
} );
|
} );
|
||||||
($key_name:ident, optional) => ( {
|
($key_name:ident, optional) => ( {
|
||||||
let name = (stringify!($key_name)).replace("_", "-");
|
let name = (stringify!($key_name)).replace("_", "-");
|
||||||
|
|
|
@ -213,7 +213,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assoc_bindings.first().map(|b| Self::prohibit_assoc_ty_binding(self.tcx(), b.span));
|
if let Some(b) = assoc_bindings.first() {
|
||||||
|
Self::prohibit_assoc_ty_binding(self.tcx(), b.span);
|
||||||
|
}
|
||||||
|
|
||||||
substs
|
substs
|
||||||
}
|
}
|
||||||
|
@ -1095,7 +1097,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
) -> ty::TraitRef<'tcx> {
|
) -> ty::TraitRef<'tcx> {
|
||||||
let (substs, assoc_bindings, _) =
|
let (substs, assoc_bindings, _) =
|
||||||
self.create_substs_for_ast_trait_ref(span, trait_def_id, self_ty, trait_segment);
|
self.create_substs_for_ast_trait_ref(span, trait_def_id, self_ty, trait_segment);
|
||||||
assoc_bindings.first().map(|b| AstConv::prohibit_assoc_ty_binding(self.tcx(), b.span));
|
if let Some(b) = assoc_bindings.first() {
|
||||||
|
AstConv::prohibit_assoc_ty_binding(self.tcx(), b.span);
|
||||||
|
}
|
||||||
ty::TraitRef::new(trait_def_id, substs)
|
ty::TraitRef::new(trait_def_id, substs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// Requires that the two types unify, and prints an error message if
|
// Requires that the two types unify, and prints an error message if
|
||||||
// they don't.
|
// they don't.
|
||||||
pub fn demand_suptype(&self, sp: Span, expected: Ty<'tcx>, actual: Ty<'tcx>) {
|
pub fn demand_suptype(&self, sp: Span, expected: Ty<'tcx>, actual: Ty<'tcx>) {
|
||||||
self.demand_suptype_diag(sp, expected, actual).map(|mut e| e.emit());
|
if let Some(mut e) = self.demand_suptype_diag(sp, expected, actual) {
|
||||||
|
e.emit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn demand_suptype_diag(
|
pub fn demand_suptype_diag(
|
||||||
|
|
|
@ -4492,15 +4492,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
_ => Err(ErrorReported),
|
_ => Err(ErrorReported),
|
||||||
};
|
};
|
||||||
if item_name.name != kw::Invalid {
|
if item_name.name != kw::Invalid {
|
||||||
self.report_method_error(
|
if let Some(mut e) = self.report_method_error(
|
||||||
span,
|
span,
|
||||||
ty,
|
ty,
|
||||||
item_name,
|
item_name,
|
||||||
SelfSource::QPath(qself),
|
SelfSource::QPath(qself),
|
||||||
error,
|
error,
|
||||||
None,
|
None,
|
||||||
)
|
) {
|
||||||
.map(|mut e| e.emit());
|
e.emit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
});
|
});
|
||||||
|
|
|
@ -104,7 +104,9 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
|
||||||
actual: Ty<'tcx>,
|
actual: Ty<'tcx>,
|
||||||
ti: TopInfo<'tcx>,
|
ti: TopInfo<'tcx>,
|
||||||
) {
|
) {
|
||||||
self.demand_eqtype_pat_diag(cause_span, expected, actual, ti).map(|mut err| err.emit());
|
if let Some(mut err) = self.demand_eqtype_pat_diag(cause_span, expected, actual, ti) {
|
||||||
|
err.emit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,12 +451,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// Subtyping doesn't matter here, as the value is some kind of scalar.
|
// Subtyping doesn't matter here, as the value is some kind of scalar.
|
||||||
let demand_eqtype = |x, y| {
|
let demand_eqtype = |x, y| {
|
||||||
if let Some((_, x_ty, x_span)) = x {
|
if let Some((_, x_ty, x_span)) = x {
|
||||||
self.demand_eqtype_pat_diag(x_span, expected, x_ty, ti).map(|mut err| {
|
if let Some(mut err) = self.demand_eqtype_pat_diag(x_span, expected, x_ty, ti) {
|
||||||
if let Some((_, y_ty, y_span)) = y {
|
if let Some((_, y_ty, y_span)) = y {
|
||||||
self.endpoint_has_type(&mut err, y_span, y_ty);
|
self.endpoint_has_type(&mut err, y_span, y_ty);
|
||||||
}
|
}
|
||||||
err.emit();
|
err.emit();
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
demand_eqtype(lhs, rhs);
|
demand_eqtype(lhs, rhs);
|
||||||
|
@ -852,8 +854,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
// Type-check the tuple struct pattern against the expected type.
|
// Type-check the tuple struct pattern against the expected type.
|
||||||
let diag = self.demand_eqtype_pat_diag(pat.span, expected, pat_ty, ti);
|
let diag = self.demand_eqtype_pat_diag(pat.span, expected, pat_ty, ti);
|
||||||
let had_err = diag.is_some();
|
let had_err = if let Some(mut err) = diag {
|
||||||
diag.map(|mut err| err.emit());
|
err.emit();
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
// Type-check subpatterns.
|
// Type-check subpatterns.
|
||||||
if subpats.len() == variant.fields.len()
|
if subpats.len() == variant.fields.len()
|
||||||
|
|
|
@ -165,12 +165,18 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||||
hir::ExprKind::Binary(..) => {
|
hir::ExprKind::Binary(..) => {
|
||||||
if !op.node.is_by_value() {
|
if !op.node.is_by_value() {
|
||||||
let mut adjustments = tables.adjustments_mut();
|
let mut adjustments = tables.adjustments_mut();
|
||||||
adjustments.get_mut(lhs.hir_id).map(|a| a.pop());
|
if let Some(a) = adjustments.get_mut(lhs.hir_id) {
|
||||||
adjustments.get_mut(rhs.hir_id).map(|a| a.pop());
|
a.pop();
|
||||||
|
}
|
||||||
|
if let Some(a) = adjustments.get_mut(rhs.hir_id) {
|
||||||
|
a.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::ExprKind::AssignOp(..) => {
|
hir::ExprKind::AssignOp(..) => {
|
||||||
tables.adjustments_mut().get_mut(lhs.hir_id).map(|a| a.pop());
|
if let Some(a) = tables.adjustments_mut().get_mut(lhs.hir_id) {
|
||||||
|
a.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +221,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||||
tables.type_dependent_defs_mut().remove(e.hir_id);
|
tables.type_dependent_defs_mut().remove(e.hir_id);
|
||||||
tables.node_substs_mut().remove(e.hir_id);
|
tables.node_substs_mut().remove(e.hir_id);
|
||||||
|
|
||||||
tables.adjustments_mut().get_mut(base.hir_id).map(|a| {
|
if let Some(a) = tables.adjustments_mut().get_mut(base.hir_id) {
|
||||||
// Discard the need for a mutable borrow
|
// Discard the need for a mutable borrow
|
||||||
|
|
||||||
// Extra adjustment made when indexing causes a drop
|
// Extra adjustment made when indexing causes a drop
|
||||||
|
@ -229,7 +235,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||||
// So the borrow discard actually happens here
|
// So the borrow discard actually happens here
|
||||||
a.pop();
|
a.pop();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1599,7 +1599,9 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||||
inline::record_extern_fqn(cx, did, TypeKind::Trait);
|
inline::record_extern_fqn(cx, did, TypeKind::Trait);
|
||||||
|
|
||||||
let mut param_names = vec![];
|
let mut param_names = vec![];
|
||||||
reg.clean(cx).map(|b| param_names.push(GenericBound::Outlives(b)));
|
if let Some(b) = reg.clean(cx) {
|
||||||
|
param_names.push(GenericBound::Outlives(b));
|
||||||
|
}
|
||||||
for did in dids {
|
for did in dids {
|
||||||
let empty = cx.tcx.intern_substs(&[]);
|
let empty = cx.tcx.intern_substs(&[]);
|
||||||
let path =
|
let path =
|
||||||
|
@ -1662,10 +1664,9 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
||||||
tr
|
tr
|
||||||
} else if let ty::Predicate::TypeOutlives(pred) = *predicate {
|
} else if let ty::Predicate::TypeOutlives(pred) = *predicate {
|
||||||
// these should turn up at the end
|
// these should turn up at the end
|
||||||
pred.skip_binder()
|
if let Some(r) = pred.skip_binder().1.clean(cx) {
|
||||||
.1
|
regions.push(GenericBound::Outlives(r));
|
||||||
.clean(cx)
|
}
|
||||||
.map(|r| regions.push(GenericBound::Outlives(r)));
|
|
||||||
return None;
|
return None;
|
||||||
} else {
|
} else {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
@ -94,7 +94,7 @@ impl TocBuilder {
|
||||||
loop {
|
loop {
|
||||||
match self.chain.pop() {
|
match self.chain.pop() {
|
||||||
Some(mut next) => {
|
Some(mut next) => {
|
||||||
this.map(|e| next.children.entries.push(e));
|
next.children.entries.extend(this);
|
||||||
if next.level < level {
|
if next.level < level {
|
||||||
// this is the parent we want, so return it to
|
// this is the parent we want, so return it to
|
||||||
// its rightful place.
|
// its rightful place.
|
||||||
|
@ -105,7 +105,7 @@ impl TocBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
this.map(|e| self.top_level.entries.push(e));
|
self.top_level.entries.extend(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ impl<T> Packet<T> {
|
||||||
//
|
//
|
||||||
// This can only be called at channel-creation time
|
// This can only be called at channel-creation time
|
||||||
pub fn inherit_blocker(&self, token: Option<SignalToken>, guard: MutexGuard<'_, ()>) {
|
pub fn inherit_blocker(&self, token: Option<SignalToken>, guard: MutexGuard<'_, ()>) {
|
||||||
token.map(|token| {
|
if let Some(token) = token {
|
||||||
assert_eq!(self.cnt.load(Ordering::SeqCst), 0);
|
assert_eq!(self.cnt.load(Ordering::SeqCst), 0);
|
||||||
assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
|
assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);
|
||||||
self.to_wake.store(unsafe { token.cast_to_usize() }, Ordering::SeqCst);
|
self.to_wake.store(unsafe { token.cast_to_usize() }, Ordering::SeqCst);
|
||||||
|
@ -118,7 +118,7 @@ impl<T> Packet<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
*self.steals.get() = -1;
|
*self.steals.get() = -1;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
// When the shared packet is constructed, we grabbed this lock. The
|
// When the shared packet is constructed, we grabbed this lock. The
|
||||||
// purpose of this lock is to ensure that abort_selection() doesn't
|
// purpose of this lock is to ensure that abort_selection() doesn't
|
||||||
|
|
|
@ -343,8 +343,12 @@ impl<T> Packet<T> {
|
||||||
mem::drop(guard);
|
mem::drop(guard);
|
||||||
|
|
||||||
// only outside of the lock do we wake up the pending threads
|
// only outside of the lock do we wake up the pending threads
|
||||||
pending_sender1.map(|t| t.signal());
|
if let Some(token) = pending_sender1 {
|
||||||
pending_sender2.map(|t| t.signal());
|
token.signal();
|
||||||
|
}
|
||||||
|
if let Some(token) = pending_sender2 {
|
||||||
|
token.signal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepares this shared packet for a channel clone, essentially just bumping
|
// Prepares this shared packet for a channel clone, essentially just bumping
|
||||||
|
@ -410,7 +414,9 @@ impl<T> Packet<T> {
|
||||||
while let Some(token) = queue.dequeue() {
|
while let Some(token) = queue.dequeue() {
|
||||||
token.signal();
|
token.signal();
|
||||||
}
|
}
|
||||||
waiter.map(|t| t.signal());
|
if let Some(token) = waiter {
|
||||||
|
token.signal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue