Skip to content

Commit

Permalink
Avoid ICEs
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Apr 15, 2019
1 parent 8395dbd commit ac9c8c1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/librustc/traits/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// contains unbound type parameters. It could be a slight
// optimization to stop iterating early.
if let Err(errors) = fulfill_cx.select_all_or_error(self) {
span_bug!(span, "Encountered errors `{:?}` resolving bounds after type-checking",
errors);
debug!("Encountered errors `{:?}` resolving bounds after type-checking", errors);
self.report_fulfillment_errors(&errors, None, false);
}

let result = self.resolve_type_vars_if_possible(result);
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_mir/hair/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,9 @@ fn check_legality_of_move_bindings(
E0009,
"cannot bind by-move and by-ref in the same pattern",
);
err.span_label(by_ref_span.unwrap(), "both by-ref and by-move used");
if let Some(by_ref_span) = by_ref_span {
err.span_label(by_ref_span, "both by-ref and by-move used");
}
for span in span_vec.iter(){
err.span_label(*span, "by-move pattern here");
}
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/consts/match_ice.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//~ ERROR can't compare `S` with `S`
// https://github.com/rust-lang/rust/issues/53708

struct S;
Expand Down
12 changes: 9 additions & 3 deletions src/test/ui/consts/match_ice.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
error[E0004]: non-exhaustive patterns: `&S` not covered
--> $DIR/match_ice.rs:7:11
--> $DIR/match_ice.rs:8:11
|
LL | match C {
| ^ pattern `&S` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms

error: aborting due to previous error
error[E0277]: can't compare `S` with `S`

This comment has been minimized.

Copy link
@oli-obk

oli-obk Apr 16, 2019

Contributor

Any idea why there's no span associated with this?

This comment has been minimized.

Copy link
@estebank

estebank Apr 16, 2019

Author Contributor

None whatsoever.

This comment has been minimized.

Copy link
@estebank

estebank Apr 16, 2019

Author Contributor

@oli-obk interestingly, there's already a bug about this: #53708

|
= help: the trait `std::cmp::PartialEq` is not implemented for `S`
= note: required because of the requirements on the impl of `std::cmp::PartialEq` for `&S`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0004`.
Some errors occurred: E0004, E0277.
For more information about an error, try `rustc --explain E0004`.

0 comments on commit ac9c8c1

Please sign in to comment.