summaryrefslogtreecommitdiff
path: root/src/librustc_mir
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-03-24 17:49:58 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-03-24 17:59:18 +0300
commit2cbc25e6fce9bb594ea78ccfd58ef1b6ea42ea38 (patch)
tree96398c53c365693a2e0a0843b957478e22803139 /src/librustc_mir
parent5bcf9f4f119b8109c6c642dcfeb63fb39c26950a (diff)
downloadrust-2cbc25e6fce9bb594ea78ccfd58ef1b6ea42ea38.tar.gz
Merge `DefPathData::VariantCtor` and `DefPathData::StructCtor`
Diffstat (limited to 'src/librustc_mir')
-rw-r--r--src/librustc_mir/borrow_check/mod.rs4
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/mod.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index c4e371d5afe..5f0892d1d46 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -75,8 +75,8 @@ fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> BorrowC
// Return early if we are not supposed to use MIR borrow checker for this function.
return_early = !tcx.has_attr(def_id, "rustc_mir") && !tcx.use_mir_borrowck();
- if tcx.is_struct_constructor(def_id) {
- // We are not borrow checking the automatically generated struct constructors
+ if tcx.is_constructor(def_id) {
+ // We are not borrow checking the automatically generated struct/variant constructors
// because we want to accept structs such as this (taken from the `linked-hash-map`
// crate):
// ```rust
diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
index 25a3160a498..d3d6b986277 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
@@ -2685,8 +2685,8 @@ impl MirPass for TypeckMir {
return;
}
- if tcx.is_struct_constructor(def_id) {
- // We just assume that the automatically generated struct constructors are
+ if tcx.is_constructor(def_id) {
+ // We just assume that the automatically generated struct/variant constructors are
// correct. See the comment in the `mir_borrowck` implementation for an
// explanation why we need this.
return;