about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/session/config.rs2
-rw-r--r--src/librustc_mir/build/matches/mod.rs2
-rw-r--r--src/test/run-pass/generator/yield-subtype.rs1
3 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 0d91074e946..c47a351e9d3 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1251,6 +1251,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "choose which RELRO level to use"),
     nll: bool = (false, parse_bool, [UNTRACKED],
                  "run the non-lexical lifetimes MIR pass"),
+    disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED],
+        "disable user provided type assertion in NLL"),
     trans_time_graph: bool = (false, parse_bool, [UNTRACKED],
         "generate a graphical HTML report of time spent in trans and LLVM"),
     thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],
diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs
index b9a6616fd07..7eb52a3cdee 100644
--- a/src/librustc_mir/build/matches/mod.rs
+++ b/src/librustc_mir/build/matches/mod.rs
@@ -147,6 +147,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
 
     pub fn user_assert_ty(&mut self, block: BasicBlock, hir_id: hir::HirId,
                           var: NodeId, span: Span) {
+        if self.hir.tcx().sess.opts.debugging_opts.disable_nll_user_type_assert { return; }
+
         let local_id = self.var_indices[&var];
         let source_info = self.source_info(span);
 
diff --git a/src/test/run-pass/generator/yield-subtype.rs b/src/test/run-pass/generator/yield-subtype.rs
index 7e8a0d1e2b9..c4134169044 100644
--- a/src/test/run-pass/generator/yield-subtype.rs
+++ b/src/test/run-pass/generator/yield-subtype.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // revisions:lexical nll
+//[nll]compile-flags: -Z disable-nll-user-type-assert
 #![cfg_attr(nll, feature(nll))]
 
 #![feature(generators)]