about summary refs log tree commit diff
path: root/src/librustc_metadata/encoder.rs
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2018-08-26 16:36:50 +0300
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2018-08-26 18:24:51 +0300
commit993e7e2622da632705661007d5a3bce812cc6d3d (patch)
treeaa4a3dfa5154c2dba716b6289c12d28f7e80bd1f /src/librustc_metadata/encoder.rs
parentcaed80ba4ba8d9f4d3fa8aa9af6c4092d779cd9d (diff)
downloadrust-993e7e2622da632705661007d5a3bce812cc6d3d.tar.gz
rust-993e7e2622da632705661007d5a3bce812cc6d3d.zip
fix `is_non_exhaustive` confusion between structs and enums
Structs and enums can both be non-exhaustive, with a very different
meaning. This PR splits `is_non_exhaustive` to 2 separate functions - 1
for structs, and another for enums, and fixes the places that got the
usage confused.

Fixes #53549.
Diffstat (limited to 'src/librustc_metadata/encoder.rs')
-rw-r--r--src/librustc_metadata/encoder.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 8219ec3df24..27f4577c442 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -740,7 +740,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
 
         // If the structure is marked as non_exhaustive then lower the visibility
         // to within the crate.
-        if adt_def.is_non_exhaustive() && ctor_vis == ty::Visibility::Public {
+        if adt_def.is_univariant_non_exhaustive() && ctor_vis == ty::Visibility::Public {
             ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX));
         }