Skip to content

Commit 5b11b28

Browse files
committed
Auto merge of #28846 - Ms2ger:categorization, r=nikomatsakis
2 parents 7caf54b + 9e135f7 commit 5b11b28

File tree

12 files changed

+203
-193
lines changed

12 files changed

+203
-193
lines changed

src/librustc/middle/check_const.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use middle::def_id::DefId;
3232
use middle::expr_use_visitor as euv;
3333
use middle::infer;
3434
use middle::mem_categorization as mc;
35+
use middle::mem_categorization::Categorization;
3536
use middle::traits;
3637
use middle::ty::{self, Ty};
3738
use util::nodemap::NodeMap;
@@ -855,7 +856,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'tcx> {
855856
let mut cur = &cmt;
856857
loop {
857858
match cur.cat {
858-
mc::cat_static_item => {
859+
Categorization::StaticItem => {
859860
if self.mode != Mode::Var {
860861
// statics cannot be consumed by value at any time, that would imply
861862
// that they're an initializer (what a const is for) or kept in sync
@@ -866,13 +867,13 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'tcx> {
866867
}
867868
break;
868869
}
869-
mc::cat_deref(ref cmt, _, _) |
870-
mc::cat_downcast(ref cmt, _) |
871-
mc::cat_interior(ref cmt, _) => cur = cmt,
870+
Categorization::Deref(ref cmt, _, _) |
871+
Categorization::Downcast(ref cmt, _) |
872+
Categorization::Interior(ref cmt, _) => cur = cmt,
872873

873-
mc::cat_rvalue(..) |
874-
mc::cat_upvar(..) |
875-
mc::cat_local(..) => break
874+
Categorization::Rvalue(..) |
875+
Categorization::Upvar(..) |
876+
Categorization::Local(..) => break
876877
}
877878
}
878879
}
@@ -899,7 +900,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'tcx> {
899900
let mut is_interior = false;
900901
loop {
901902
match cur.cat {
902-
mc::cat_rvalue(..) => {
903+
Categorization::Rvalue(..) => {
903904
if loan_cause == euv::MatchDiscriminant {
904905
// Ignore the dummy immutable borrow created by EUV.
905906
break;
@@ -920,7 +921,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'tcx> {
920921
self.record_borrow(borrow_id, mutbl);
921922
break;
922923
}
923-
mc::cat_static_item => {
924+
Categorization::StaticItem => {
924925
if is_interior && self.mode != Mode::Var {
925926
// Borrowed statics can specifically *only* have their address taken,
926927
// not any number of other borrows such as borrowing fields, reading
@@ -931,15 +932,15 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'tcx> {
931932
}
932933
break;
933934
}
934-
mc::cat_deref(ref cmt, _, _) |
935-
mc::cat_downcast(ref cmt, _) |
936-
mc::cat_interior(ref cmt, _) => {
935+
Categorization::Deref(ref cmt, _, _) |
936+
Categorization::Downcast(ref cmt, _) |
937+
Categorization::Interior(ref cmt, _) => {
937938
is_interior = true;
938939
cur = cmt;
939940
}
940941

941-
mc::cat_upvar(..) |
942-
mc::cat_local(..) => break
942+
Categorization::Upvar(..) |
943+
Categorization::Local(..) => break
943944
}
944945
}
945946
}

0 commit comments

Comments
 (0)