Skip to content

Commit d98a2b9

Browse files
committed
Rebase fallout
1 parent 2f0e077 commit d98a2b9

File tree

6 files changed

+22
-1197
lines changed

6 files changed

+22
-1197
lines changed

src/librustc_mir/hair/cx/expr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use rustc::middle::const_val::ConstVal;
1818
use rustc::mir::interpret::{GlobalId, Value, PrimVal};
1919
use rustc::ty::{self, AdtKind, VariantDef, Ty};
2020
use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability};
21-
use rustc::mir::interpret::{Value, PrimVal};
2221
use rustc::ty::cast::CastKind as TyCastKind;
2322
use rustc::hir;
2423
use rustc::hir::def_id::LocalDefId;

src/librustc_mir/hair/pattern/mod.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ pub enum PatternError {
4242
StaticInPattern(Span),
4343
FloatBug,
4444
NonConstPath(Span),
45-
AssociatedConstInPattern(Span),
4645
}
4746

4847
#[derive(Copy, Clone, Debug)]
@@ -382,10 +381,24 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
382381
"lower range bound must be less than upper",
383382
),
384383
(RangeEnd::Included, Ordering::Greater) => {
385-
struct_span_err!(self.tcx.sess, lo_expr.span, E0030,
386-
"lower range bound must be less than or equal to upper")
387-
.span_label(lo_expr.span, "lower bound larger than upper bound")
388-
.emit();
384+
let mut err = struct_span_err!(
385+
self.tcx.sess,
386+
lo_expr.span,
387+
E0030,
388+
"lower range bound must be less than or equal to upper"
389+
);
390+
err.span_label(
391+
lo_expr.span,
392+
"lower bound larger than upper bound",
393+
);
394+
if self.tcx.sess.teach(&err.get_code().unwrap()) {
395+
err.note("When matching against a range, the compiler \
396+
verifies that the range is non-empty. Range \
397+
patterns include both end-points, so this is \
398+
equivalent to requiring the start of the range \
399+
to be less than or equal to the end of the range.");
400+
}
401+
err.emit();
389402
},
390403
(RangeEnd::Included, _) => {}
391404
}

0 commit comments

Comments
 (0)