]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #97283 - jackh726:rollup-ga84p7n, r=jackh726
authorbors <bors@rust-lang.org>
Sun, 22 May 2022 16:47:17 +0000 (16:47 +0000)
committerbors <bors@rust-lang.org>
Sun, 22 May 2022 16:47:17 +0000 (16:47 +0000)
Rollup of 5 pull requests

Successful merges:

 - #97043 (Move some tests to more reasonable directories)
 - #97206 (Do leak check after function pointer coercion)
 - #97275 (small change)
 - #97277 (Avoid accidentally enabling unstable features in compilers (take 2))
 - #97280 (Quote replace target in bootstrap configure)

Failed merges:

 - #97214 (Finish bumping stage0)

r? `@ghost`
`@rustbot` modify labels: rollup

71 files changed:
compiler/rustc_infer/src/infer/error_reporting/mod.rs
compiler/rustc_middle/src/ty/error.rs
compiler/rustc_mir_build/src/build/matches/mod.rs
compiler/rustc_mir_build/src/thir/cx/block.rs
compiler/rustc_mir_build/src/thir/cx/mod.rs
compiler/rustc_typeck/src/check/_match.rs
compiler/rustc_typeck/src/check/coercion.rs
compiler/rustc_typeck/src/check/demand.rs
library/std/src/process.rs
src/bootstrap/bootstrap.py
src/bootstrap/builder.rs
src/bootstrap/configure.py
src/bootstrap/doc.rs
src/test/ui/associated-types/issue-20825-2.rs [new file with mode: 0644]
src/test/ui/associated-types/issue-20825.rs [new file with mode: 0644]
src/test/ui/associated-types/issue-20825.stderr [new file with mode: 0644]
src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr
src/test/ui/hrtb/hrtb-exists-forall-fn.nll.stderr
src/test/ui/hygiene/issue-32922.rs [new file with mode: 0644]
src/test/ui/impl-trait/issue-46959.rs [new file with mode: 0644]
src/test/ui/issues/auxiliary/issue-36708.rs [deleted file]
src/test/ui/issues/issue-13304.rs [deleted file]
src/test/ui/issues/issue-20825-2.rs [deleted file]
src/test/ui/issues/issue-20825.rs [deleted file]
src/test/ui/issues/issue-20825.stderr [deleted file]
src/test/ui/issues/issue-26459.rs [deleted file]
src/test/ui/issues/issue-26459.stderr [deleted file]
src/test/ui/issues/issue-27021.rs [deleted file]
src/test/ui/issues/issue-27320.rs [deleted file]
src/test/ui/issues/issue-32922.rs [deleted file]
src/test/ui/issues/issue-33185.rs [deleted file]
src/test/ui/issues/issue-36708.rs [deleted file]
src/test/ui/issues/issue-36708.stderr [deleted file]
src/test/ui/issues/issue-40231-1.rs [deleted file]
src/test/ui/issues/issue-40231-2.rs [deleted file]
src/test/ui/issues/issue-46959.rs [deleted file]
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr [deleted file]
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.rs
src/test/ui/lub-glb/old-lub-glb-hr-noteq1.stderr [deleted file]
src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr [new file with mode: 0644]
src/test/ui/lub-glb/old-lub-glb-hr-noteq2.rs
src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr [deleted file]
src/test/ui/macros/issue-33185.rs [new file with mode: 0644]
src/test/ui/match/issue-27021.rs [new file with mode: 0644]
src/test/ui/pattern/issue-27320.rs [new file with mode: 0644]
src/test/ui/process/issue-13304.rs [new file with mode: 0644]
src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.base.stderr
src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr
src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs
src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.base.stderr
src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr
src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs
src/test/ui/regions/regions-fn-subtyping-return-static-fail.base.stderr
src/test/ui/regions/regions-fn-subtyping-return-static-fail.nll.stderr
src/test/ui/regions/regions-lifetime-bounds-on-fns.base.stderr
src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr
src/test/ui/regions/regions-lifetime-bounds-on-fns.rs
src/test/ui/save-analysis/issue-26459.rs [new file with mode: 0644]
src/test/ui/save-analysis/issue-26459.stderr [new file with mode: 0644]
src/test/ui/typeck/auxiliary/issue-36708.rs [new file with mode: 0644]
src/test/ui/typeck/issue-36708.rs [new file with mode: 0644]
src/test/ui/typeck/issue-36708.stderr [new file with mode: 0644]
src/test/ui/unsized/issue-40231-1.rs [new file with mode: 0644]
src/test/ui/unsized/issue-40231-2.rs [new file with mode: 0644]
src/tools/tidy/src/ui_tests.rs

index 02caae7a90a91d5185e367273793cdd63fdc9a1e..11c893a7cb6d93eee868cadd7de422348582d692 100644 (file)
@@ -1442,6 +1442,10 @@ fn lifetime_display(lifetime: Region<'_>) -> String {
     /// the message in `secondary_span` as the primary label, and apply the message that would
     /// otherwise be used for the primary label on the `secondary_span` `Span`. This applies on
     /// E0271, like `src/test/ui/issues/issue-39970.stderr`.
+    #[tracing::instrument(
+        level = "debug",
+        skip(self, diag, secondary_span, swap_secondary_and_primary, force_label)
+    )]
     pub fn note_type_err(
         &self,
         diag: &mut Diagnostic,
@@ -1453,7 +1457,6 @@ pub fn note_type_err(
         force_label: bool,
     ) {
         let span = cause.span(self.tcx);
-        debug!("note_type_err cause={:?} values={:?}, terr={:?}", cause, values, terr);
 
         // For some types of errors, expected-found does not make
         // sense, so just ignore the values we were given.
@@ -1621,9 +1624,9 @@ enum Mismatch<'a> {
             }
         };
 
-        // Ignore msg for object safe coercion
-        // since E0038 message will be printed
         match terr {
+            // Ignore msg for object safe coercion
+            // since E0038 message will be printed
             TypeError::ObjectUnsafeCoercion(_) => {}
             _ => {
                 let mut label_or_note = |span: Span, msg: &str| {
@@ -1774,6 +1777,8 @@ enum Mismatch<'a> {
         // It reads better to have the error origin as the final
         // thing.
         self.note_error_origin(diag, cause, exp_found, terr);
+
+        debug!(?diag);
     }
 
     fn suggest_tuple_pattern(
index a0fe632f11a07f21b3cf37f5649226c318d399bf..a6c14ea0de343c636fb8a5e3fab3e7af8818e4a4 100644 (file)
@@ -135,11 +135,10 @@ fn report_maybe_different(
             ArgCount => write!(f, "incorrect number of function parameters"),
             FieldMisMatch(adt, field) => write!(f, "field type mismatch: {}.{}", adt, field),
             RegionsDoesNotOutlive(..) => write!(f, "lifetime mismatch"),
-            RegionsInsufficientlyPolymorphic(br, _) => write!(
-                f,
-                "expected bound lifetime parameter{}, found concrete lifetime",
-                br_string(br)
-            ),
+            // Actually naming the region here is a bit confusing because context is lacking
+            RegionsInsufficientlyPolymorphic(..) => {
+                write!(f, "one type is more general than the other")
+            }
             RegionsOverlyPolymorphic(br, _) => write!(
                 f,
                 "expected concrete lifetime, found bound lifetime parameter{}",
index 56acf65d9c5aaedd1bfdb083e4df3081aab39def..9df86c6ada134b9efdc310ceea3f07949cffba6c 100644 (file)
@@ -151,6 +151,7 @@ pub(crate) fn then_else_break(
     ///
     /// * From each pre-binding block to the next pre-binding block.
     /// * From each otherwise block to the next pre-binding block.
+    #[tracing::instrument(level = "debug", skip(self, arms))]
     pub(crate) fn match_expr(
         &mut self,
         destination: Place<'tcx>,
index d0b18ce67c6d8286d658182b9948c7fec7a2681c..59750d5d0b88ecacb62654868ded5bc5b406db40 100644 (file)
@@ -75,6 +75,7 @@ fn mirror_stmts(
                         };
 
                         let mut pattern = self.pattern_from_hir(local.pat);
+                        debug!(?pattern);
 
                         if let Some(ty) = &local.ty {
                             if let Some(&user_ty) =
index 13b4e90ca09ce05a530840433566157898b80905..bd17df60cd78896abc4b8f4520642e464f95c240 100644 (file)
@@ -98,6 +98,7 @@ pub(crate) fn const_eval_literal(
         }
     }
 
+    #[tracing::instrument(level = "debug", skip(self))]
     pub(crate) fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Pat<'tcx> {
         let p = match self.tcx.hir().get(p.hir_id) {
             Node::Pat(p) | Node::Binding(p) => p,
index 9aff854c8030591125c44406a76868a7e0771619..3632e14385fe95cdd3e854ab7447e51bdd129e1d 100644 (file)
@@ -56,6 +56,7 @@ pub fn check_match(
         let mut all_arms_diverge = Diverges::WarnedAlways;
 
         let expected = orig_expected.adjust_for_branches(self);
+        debug!(?expected);
 
         let mut coercion = {
             let coerce_first = match expected {
@@ -127,6 +128,12 @@ pub fn check_match(
                 Some(&arm.body),
                 arm_ty,
                 Some(&mut |err: &mut Diagnostic| {
+                    let Some(ret) = self.ret_type_span else {
+                        return;
+                    };
+                    let Expectation::IsLast(stmt) = orig_expected else {
+                        return
+                    };
                     let can_coerce_to_return_ty = match self.ret_coercion.as_ref() {
                         Some(ret_coercion) if self.in_tail_expr => {
                             let ret_ty = ret_coercion.borrow().expected_ty();
@@ -138,38 +145,38 @@ pub fn check_match(
                         }
                         _ => false,
                     };
-                    if let (Expectation::IsLast(stmt), Some(ret), true) =
-                        (orig_expected, self.ret_type_span, can_coerce_to_return_ty)
-                    {
-                        let semi_span = expr.span.shrink_to_hi().with_hi(stmt.hi());
-                        let mut ret_span: MultiSpan = semi_span.into();
-                        ret_span.push_span_label(
-                            expr.span,
-                            "this could be implicitly returned but it is a statement, not a \
-                                tail expression"
-                                .to_owned(),
-                        );
-                        ret_span.push_span_label(
-                            ret,
-                            "the `match` arms can conform to this return type".to_owned(),
-                        );
-                        ret_span.push_span_label(
-                            semi_span,
-                            "the `match` is a statement because of this semicolon, consider \
-                                removing it"
-                                .to_owned(),
-                        );
-                        err.span_note(
-                            ret_span,
-                            "you might have meant to return the `match` expression",
-                        );
-                        err.tool_only_span_suggestion(
-                            semi_span,
-                            "remove this semicolon",
-                            String::new(),
-                            Applicability::MaybeIncorrect,
-                        );
+                    if !can_coerce_to_return_ty {
+                        return;
                     }
+
+                    let semi_span = expr.span.shrink_to_hi().with_hi(stmt.hi());
+                    let mut ret_span: MultiSpan = semi_span.into();
+                    ret_span.push_span_label(
+                        expr.span,
+                        "this could be implicitly returned but it is a statement, not a \
+                            tail expression"
+                            .to_owned(),
+                    );
+                    ret_span.push_span_label(
+                        ret,
+                        "the `match` arms can conform to this return type".to_owned(),
+                    );
+                    ret_span.push_span_label(
+                        semi_span,
+                        "the `match` is a statement because of this semicolon, consider \
+                            removing it"
+                            .to_owned(),
+                    );
+                    err.span_note(
+                        ret_span,
+                        "you might have meant to return the `match` expression",
+                    );
+                    err.tool_only_span_suggestion(
+                        semi_span,
+                        "remove this semicolon",
+                        String::new(),
+                        Applicability::MaybeIncorrect,
+                    );
                 }),
                 false,
             );
@@ -199,7 +206,9 @@ pub fn check_match(
         // We won't diverge unless the scrutinee or all arms diverge.
         self.diverges.set(scrut_diverges | all_arms_diverge);
 
-        coercion.complete(self)
+        let match_ty = coercion.complete(self);
+        debug!(?match_ty);
+        match_ty
     }
 
     fn get_appropriate_arm_semicolon_removal_span(
index a17b13d49fd7f2cd42f1f678967e99d76b0bf423..6d540bf7e4f4b225872bb2819dff9be7c87b6191 100644 (file)
@@ -737,14 +737,27 @@ fn coerce_from_safe_fn<F, G>(
         F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
         G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
     {
-        if let ty::FnPtr(fn_ty_b) = b.kind()
-            && let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) =
-                (fn_ty_a.unsafety(), fn_ty_b.unsafety())
-        {
-            let unsafe_a = self.tcx.safe_to_unsafe_fn_ty(fn_ty_a);
-            return self.unify_and(unsafe_a, b, to_unsafe);
-        }
-        self.unify_and(a, b, normal)
+        self.commit_unconditionally(|snapshot| {
+            let result = if let ty::FnPtr(fn_ty_b) = b.kind()
+                && let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) =
+                    (fn_ty_a.unsafety(), fn_ty_b.unsafety())
+            {
+                let unsafe_a = self.tcx.safe_to_unsafe_fn_ty(fn_ty_a);
+                self.unify_and(unsafe_a, b, to_unsafe)
+            } else {
+                self.unify_and(a, b, normal)
+            };
+
+            // FIXME(#73154): This is a hack. Currently LUB can generate
+            // unsolvable constraints. Additionally, it returns `a`
+            // unconditionally, even when the "LUB" is `b`. In the future, we
+            // want the coerced type to be the actual supertype of these two,
+            // but for now, we want to just error to ensure we don't lock
+            // ourselves into a specific behavior with NLL.
+            self.leak_check(false, snapshot)?;
+
+            result
+        })
     }
 
     fn coerce_from_fn_pointer(
@@ -1133,8 +1146,8 @@ fn try_find_coercion_lub<E>(
                     let (adjustments, target) = self.register_infer_ok_obligations(ok);
                     self.apply_adjustments(new, adjustments);
                     debug!(
-                        "coercion::try_find_coercion_lub: was able to coerce from previous type {:?} to new type {:?}",
-                        prev_ty, new_ty,
+                        "coercion::try_find_coercion_lub: was able to coerce from new type {:?} to previous type {:?} ({:?})",
+                        new_ty, prev_ty, target
                     );
                     return Ok(target);
                 }
@@ -1190,15 +1203,15 @@ fn try_find_coercion_lub<E>(
                 }
             }
             Ok(ok) => {
-                debug!(
-                    "coercion::try_find_coercion_lub: was able to coerce previous type {:?} to new type {:?}",
-                    prev_ty, new_ty,
-                );
                 let (adjustments, target) = self.register_infer_ok_obligations(ok);
                 for expr in exprs {
                     let expr = expr.as_coercion_site();
                     self.apply_adjustments(expr, adjustments.clone());
                 }
+                debug!(
+                    "coercion::try_find_coercion_lub: was able to coerce previous type {:?} to new type {:?} ({:?})",
+                    prev_ty, new_ty, target
+                );
                 Ok(target)
             }
         }
@@ -1430,6 +1443,7 @@ pub(crate) fn coerce_inner<'a>(
                 })
         };
 
+        debug!(?result);
         match result {
             Ok(v) => {
                 self.final_ty = Some(v);
@@ -1520,7 +1534,10 @@ pub(crate) fn coerce_inner<'a>(
                     augment_error(&mut err);
                 }
 
-                if let Some(expr) = expression {
+                let is_insufficiently_polymorphic =
+                    matches!(coercion_error, TypeError::RegionsInsufficientlyPolymorphic(..));
+
+                if !is_insufficiently_polymorphic && let Some(expr) = expression {
                     fcx.emit_coerce_suggestions(
                         &mut err,
                         expr,
index ceb57386e300f177059de32a0ad9f0d149f0d9eb..d0d2841209a6ea370573e3de043f10ab0927f342 100644 (file)
@@ -129,6 +129,7 @@ pub fn demand_coerce(
     ///
     /// N.B., this code relies on `self.diverges` to be accurate. In particular, assignments to `!`
     /// will be permitted if the diverges flag is currently "always".
+    #[tracing::instrument(level = "debug", skip(self, expr, expected_ty_expr, allow_two_phase))]
     pub fn demand_coerce_diag(
         &self,
         expr: &hir::Expr<'tcx>,
@@ -150,7 +151,22 @@ pub fn demand_coerce_diag(
         let expr_ty = self.resolve_vars_with_obligations(checked_ty);
         let mut err = self.report_mismatched_types(&cause, expected, expr_ty, e.clone());
 
-        self.emit_coerce_suggestions(&mut err, expr, expr_ty, expected, expected_ty_expr, Some(e));
+        let is_insufficiently_polymorphic =
+            matches!(e, TypeError::RegionsInsufficientlyPolymorphic(..));
+
+        // FIXME(#73154): For now, we do leak check when coercing function
+        // pointers in typeck, instead of only during borrowck. This can lead
+        // to these `RegionsInsufficientlyPolymorphic` errors that aren't helpful.
+        if !is_insufficiently_polymorphic {
+            self.emit_coerce_suggestions(
+                &mut err,
+                expr,
+                expr_ty,
+                expected,
+                expected_ty_expr,
+                Some(e),
+            );
+        }
 
         (expected, Some(err))
     }
index 28e802d07e1970bc03b211793f3f0cb10a13749f..1def9fe0972025c901be03aa7ed6f75e3acf0d8c 100644 (file)
@@ -2108,7 +2108,7 @@ pub fn id() -> u32 {
 
 /// A trait for implementing arbitrary return types in the `main` function.
 ///
-/// The C-main function only supports to return integers as return type.
+/// The C-main function only supports returning integers.
 /// So, every type implementing the `Termination` trait has to be converted
 /// to an integer.
 ///
index d36344ece4ea3d113bca3e8eb64012fd3fed1977..6d46ea26e6a0b3e046632c8a2fe22b81a08b6752 100644 (file)
@@ -1192,7 +1192,6 @@ def bootstrap(help_triggered):
     env = os.environ.copy()
     env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
     env["BOOTSTRAP_PYTHON"] = sys.executable
-    env["RUSTC_BOOTSTRAP"] = '1'
     if build.rustc_commit is not None:
         env["BOOTSTRAP_DOWNLOAD_RUSTC"] = '1'
     run(args, env=env, verbose=build.verbose, is_bootstrap=True)
index 894d74fb269a1bab7cc3f1244c9aa9b4504963d1..761bd66b5057bb931ee1b0ac9d131a8da2855cb8 100644 (file)
@@ -1226,6 +1226,14 @@ pub fn cargo(
         // this), as well as #63012 which is the tracking issue for this
         // feature on the rustc side.
         cargo.arg("-Zbinary-dep-depinfo");
+        match mode {
+            Mode::ToolBootstrap => {
+                // Restrict the allowed features to those passed by rustbuild, so we don't depend on nightly accidentally.
+                // HACK: because anyhow does feature detection in build.rs, we need to allow the backtrace feature too.
+                rustflags.arg("-Zallow-features=binary-dep-depinfo,backtrace");
+            }
+            Mode::Std | Mode::Rustc | Mode::ToolStd | Mode::Codegen | Mode::ToolRustc => {}
+        }
 
         cargo.arg("-j").arg(self.jobs().to_string());
         // Remove make-related flags to ensure Cargo can correctly set things up
index 87a130a09827dfbf2c988b8aa53a41983337e369..2fc036082cba6991617941887a4991e7e90a4f66 100755 (executable)
@@ -407,7 +407,7 @@ if 'target' in config:
         configured_targets.append(target)
 for target in configured_targets:
     targets[target] = sections['target'][:]
-    targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
+    targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target))
 
 
 def is_number(value):
index fcef784d2d1fa3547379fac1cd135784f4ecc060..be6655ddb61d0883bbe5396f99b89a5b424d8d30 100644 (file)
@@ -881,6 +881,10 @@ fn run(self, builder: &Builder<'_>) {
         if self.validate {
             cmd.arg("--validate");
         }
+        if !builder.unstable_features() {
+            // We need to validate nightly features, even on the stable channel.
+            cmd.env("RUSTC_BOOTSTRAP", "1");
+        }
         // If the lib directories are in an unusual location (changed in
         // config.toml), then this needs to explicitly update the dylib search
         // path.
diff --git a/src/test/ui/associated-types/issue-20825-2.rs b/src/test/ui/associated-types/issue-20825-2.rs
new file mode 100644 (file)
index 0000000..b79a297
--- /dev/null
@@ -0,0 +1,10 @@
+// check-pass
+pub trait Subscriber {
+    type Input;
+}
+
+pub trait Processor: Subscriber<Input = <Self as Processor>::Input> {
+    type Input;
+}
+
+fn main() {}
diff --git a/src/test/ui/associated-types/issue-20825.rs b/src/test/ui/associated-types/issue-20825.rs
new file mode 100644 (file)
index 0000000..516c304
--- /dev/null
@@ -0,0 +1,10 @@
+pub trait Subscriber {
+    type Input;
+}
+
+pub trait Processor: Subscriber<Input = Self::Input> {
+    //~^ ERROR cycle detected
+    type Input;
+}
+
+fn main() {}
diff --git a/src/test/ui/associated-types/issue-20825.stderr b/src/test/ui/associated-types/issue-20825.stderr
new file mode 100644 (file)
index 0000000..be2bbd4
--- /dev/null
@@ -0,0 +1,16 @@
+error[E0391]: cycle detected when computing the super traits of `Processor` with associated type name `Input`
+  --> $DIR/issue-20825.rs:5:1
+   |
+LL | pub trait Processor: Subscriber<Input = Self::Input> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: ...which immediately requires computing the super traits of `Processor` with associated type name `Input` again
+note: cycle used when computing the super traits of `Processor`
+  --> $DIR/issue-20825.rs:5:1
+   |
+LL | pub trait Processor: Subscriber<Input = Self::Input> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
index 1836249efdb2aa563cb5d78bbdf1bd9ba8c88521..73b0a3173644772a32c111083e5a00e6250112c2 100644 (file)
@@ -1,37 +1,12 @@
 error[E0308]: mismatched types
-  --> $DIR/placeholder-pattern-fail.rs:9:12
+  --> $DIR/placeholder-pattern-fail.rs:9:47
    |
 LL |     let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |                                               ^^^ one type is more general than the other
    |
    = note: expected fn pointer `for<'a, 'b> fn(Inv<'a>, Inv<'b>)`
               found fn pointer `for<'a> fn(Inv<'a>, Inv<'a>)`
 
-error[E0308]: mismatched types
-  --> $DIR/placeholder-pattern-fail.rs:9:12
-   |
-LL |     let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-   |
-   = note: expected fn pointer `for<'a, 'b> fn(Inv<'a>, Inv<'b>)`
-              found fn pointer `for<'a> fn(Inv<'a>, Inv<'a>)`
-
-error: lifetime may not live long enough
-  --> $DIR/placeholder-pattern-fail.rs:14:13
-   |
-LL | fn simple1<'c>(x: (&'c i32,)) {
-   |            -- lifetime `'c` defined here
-LL |     let _x: (&'static i32,) = x;
-   |             ^^^^^^^^^^^^^^^ type annotation requires that `'c` must outlive `'static`
-
-error: lifetime may not live long enough
-  --> $DIR/placeholder-pattern-fail.rs:19:12
-   |
-LL | fn simple2<'c>(x: (&'c i32,)) {
-   |            -- lifetime `'c` defined here
-LL |     let _: (&'static i32,) = x;
-   |            ^^^^^^^^^^^^^^^ type annotation requires that `'c` must outlive `'static`
-
-error: aborting due to 4 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0308`.
index 1ee3c67496397e032e68446477414f586f20005d..9914783d9767d5d99ecd0790eae8597cc1714265 100644 (file)
@@ -1,8 +1,8 @@
 error[E0308]: mismatched types
-  --> $DIR/hrtb-exists-forall-fn.rs:17:12
+  --> $DIR/hrtb-exists-forall-fn.rs:17:34
    |
 LL |     let _: for<'b> fn(&'b u32) = foo();
-   |            ^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |                                  ^^^^^ one type is more general than the other
    |
    = note: expected fn pointer `for<'b> fn(&'b u32)`
               found fn pointer `fn(&u32)`
diff --git a/src/test/ui/hygiene/issue-32922.rs b/src/test/ui/hygiene/issue-32922.rs
new file mode 100644 (file)
index 0000000..54ec44a
--- /dev/null
@@ -0,0 +1,29 @@
+// check-pass
+
+macro_rules! foo { () => {
+    let x = 1;
+    macro_rules! bar { () => {x} }
+    let _ = bar!();
+}}
+
+macro_rules! m { // test issue #31856
+    ($n:ident) => (
+        let a = 1;
+        let $n = a;
+    )
+}
+
+macro_rules! baz {
+    ($i:ident) => {
+        let mut $i = 2;
+        $i = $i + 1;
+    }
+}
+
+fn main() {
+    foo! {};
+    bar! {};
+
+    let mut a = true;
+    baz!(a);
+}
diff --git a/src/test/ui/impl-trait/issue-46959.rs b/src/test/ui/impl-trait/issue-46959.rs
new file mode 100644 (file)
index 0000000..3611a95
--- /dev/null
@@ -0,0 +1,9 @@
+// check-pass
+#![deny(non_camel_case_types)]
+
+#[allow(dead_code)]
+fn qqq(lol: impl Iterator<Item=u32>) -> impl Iterator<Item=u64> {
+        lol.map(|x|x as u64)
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/auxiliary/issue-36708.rs b/src/test/ui/issues/auxiliary/issue-36708.rs
deleted file mode 100644 (file)
index bd8580f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#![crate_type = "lib"]
-
-pub trait Foo {
-    fn foo();
-}
diff --git a/src/test/ui/issues/issue-13304.rs b/src/test/ui/issues/issue-13304.rs
deleted file mode 100644 (file)
index b10f6d5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// run-pass
-#![allow(unused_mut)]
-// ignore-emscripten no processes
-// ignore-sgx no processes
-
-use std::env;
-use std::io::prelude::*;
-use std::io;
-use std::process::{Command, Stdio};
-use std::str;
-
-fn main() {
-    let args: Vec<String> = env::args().collect();
-    if args.len() > 1 && args[1] == "child" {
-        child();
-    } else {
-        parent();
-    }
-}
-
-fn parent() {
-    let args: Vec<String> = env::args().collect();
-    let mut p = Command::new(&args[0]).arg("child")
-                        .stdout(Stdio::piped())
-                        .stdin(Stdio::piped())
-                        .spawn().unwrap();
-    p.stdin.as_mut().unwrap().write_all(b"test1\ntest2\ntest3").unwrap();
-    let out = p.wait_with_output().unwrap();
-    assert!(out.status.success());
-    let s = str::from_utf8(&out.stdout).unwrap();
-    assert_eq!(s, "test1\ntest2\ntest3\n");
-}
-
-fn child() {
-    let mut stdin = io::stdin();
-    for line in stdin.lock().lines() {
-        println!("{}", line.unwrap());
-    }
-}
diff --git a/src/test/ui/issues/issue-20825-2.rs b/src/test/ui/issues/issue-20825-2.rs
deleted file mode 100644 (file)
index b79a297..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// check-pass
-pub trait Subscriber {
-    type Input;
-}
-
-pub trait Processor: Subscriber<Input = <Self as Processor>::Input> {
-    type Input;
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-20825.rs b/src/test/ui/issues/issue-20825.rs
deleted file mode 100644 (file)
index 516c304..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-pub trait Subscriber {
-    type Input;
-}
-
-pub trait Processor: Subscriber<Input = Self::Input> {
-    //~^ ERROR cycle detected
-    type Input;
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-20825.stderr b/src/test/ui/issues/issue-20825.stderr
deleted file mode 100644 (file)
index be2bbd4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0391]: cycle detected when computing the super traits of `Processor` with associated type name `Input`
-  --> $DIR/issue-20825.rs:5:1
-   |
-LL | pub trait Processor: Subscriber<Input = Self::Input> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: ...which immediately requires computing the super traits of `Processor` with associated type name `Input` again
-note: cycle used when computing the super traits of `Processor`
-  --> $DIR/issue-20825.rs:5:1
-   |
-LL | pub trait Processor: Subscriber<Input = Self::Input> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/ui/issues/issue-26459.rs b/src/test/ui/issues/issue-26459.rs
deleted file mode 100644 (file)
index 2ba05a0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// compile-flags: -Zsave-analysis
-
-fn main() {
-    match 'a' {
-        char{ch} => true
-        //~^ ERROR expected struct, variant or union type, found builtin type `char`
-    };
-}
diff --git a/src/test/ui/issues/issue-26459.stderr b/src/test/ui/issues/issue-26459.stderr
deleted file mode 100644 (file)
index 9f59499..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0574]: expected struct, variant or union type, found builtin type `char`
-  --> $DIR/issue-26459.rs:5:9
-   |
-LL |         char{ch} => true
-   |         ^^^^ not a struct, variant or union type
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0574`.
diff --git a/src/test/ui/issues/issue-27021.rs b/src/test/ui/issues/issue-27021.rs
deleted file mode 100644 (file)
index ef3b114..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// run-pass
-
-// This test is bogus (i.e., should be check-fail) during the period
-// where #54986 is implemented and #54987 is *not* implemented. For
-// now: just ignore it
-//
-// ignore-test
-
-// These are variants of issue-26996.rs. In all cases we are writing
-// into a record field that has been moved out of, and ensuring that
-// such a write won't overwrite the state of the thing it was moved
-// into.
-//
-// That's a fine thing to test when this code is accepted by the
-// compiler, and this code is being transcribed accordingly into
-// the ui test issue-21232-partial-init-and-use.rs
-
-fn main() {
-    let mut c = (1, (1, "".to_owned()));
-    match c {
-        c2 => { (c.1).0 = 2; assert_eq!((c2.1).0, 1); }
-    }
-
-    let mut c = (1, (1, (1, "".to_owned())));
-    match c.1 {
-        c2 => { ((c.1).1).0 = 3; assert_eq!((c2.1).0, 1); }
-    }
-}
diff --git a/src/test/ui/issues/issue-27320.rs b/src/test/ui/issues/issue-27320.rs
deleted file mode 100644 (file)
index d1aa56b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// run-pass
-#![allow(unused_variables)]
-#![allow(dead_code)]
-
-macro_rules! piece(
-    ($piece:pat) => ($piece);
-);
-
-enum Piece {A, B}
-
-fn main() {
-    match Piece::A {
-        piece!(pt@ Piece::A) | piece!(pt@ Piece::B) => {}
-    }
-}
diff --git a/src/test/ui/issues/issue-32922.rs b/src/test/ui/issues/issue-32922.rs
deleted file mode 100644 (file)
index 54ec44a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// check-pass
-
-macro_rules! foo { () => {
-    let x = 1;
-    macro_rules! bar { () => {x} }
-    let _ = bar!();
-}}
-
-macro_rules! m { // test issue #31856
-    ($n:ident) => (
-        let a = 1;
-        let $n = a;
-    )
-}
-
-macro_rules! baz {
-    ($i:ident) => {
-        let mut $i = 2;
-        $i = $i + 1;
-    }
-}
-
-fn main() {
-    foo! {};
-    bar! {};
-
-    let mut a = true;
-    baz!(a);
-}
diff --git a/src/test/ui/issues/issue-33185.rs b/src/test/ui/issues/issue-33185.rs
deleted file mode 100644 (file)
index 0d66691..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// run-pass
-#![allow(dead_code)]
-
-#[macro_export]
-macro_rules! state {
-    ( $( $name:ident : $field:ty )* ) => (
-        #[derive(Default)]
-        struct State {
-            $($name : $field),*
-        }
-    )
-}
-
-state! { x: i64 }
-
-pub fn main() {
-}
diff --git a/src/test/ui/issues/issue-36708.rs b/src/test/ui/issues/issue-36708.rs
deleted file mode 100644 (file)
index c9d9f2a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// aux-build:issue-36708.rs
-
-extern crate issue_36708 as lib;
-
-struct Bar;
-
-impl lib::Foo for Bar {
-    fn foo<T>() {}
-    //~^ ERROR E0049
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-36708.stderr b/src/test/ui/issues/issue-36708.stderr
deleted file mode 100644 (file)
index 140f19f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters
-  --> $DIR/issue-36708.rs:8:12
-   |
-LL |     fn foo<T>() {}
-   |            ^ found 1 type parameter, expected 0
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0049`.
diff --git a/src/test/ui/issues/issue-40231-1.rs b/src/test/ui/issues/issue-40231-1.rs
deleted file mode 100644 (file)
index 999399e..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// check-pass
-
-#![allow(dead_code)]
-
-trait Structure<E>: Sized where E: Encoding {
-    type RefTarget: ?Sized;
-    type FfiPtr;
-    unsafe fn borrow_from_ffi_ptr<'a>(ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget>;
-}
-
-enum Slice {}
-
-impl<E> Structure<E> for Slice where E: Encoding {
-    type RefTarget = [E::Unit];
-    type FfiPtr = (*const E::FfiUnit, usize);
-    unsafe fn borrow_from_ffi_ptr<'a>(_ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget> {
-        panic!()
-    }
-}
-
-trait Encoding {
-    type Unit: Unit;
-    type FfiUnit;
-}
-
-trait Unit {}
-
-enum Utf16 {}
-
-impl Encoding for Utf16 {
-    type Unit = Utf16Unit;
-    type FfiUnit = u16;
-}
-
-struct Utf16Unit(pub u16);
-
-impl Unit for Utf16Unit {}
-
-type SUtf16Str = SeStr<Slice, Utf16>;
-
-struct SeStr<S, E> where S: Structure<E>, E: Encoding {
-    _data: S::RefTarget,
-}
-
-impl<S, E> SeStr<S, E> where S: Structure<E>, E: Encoding {
-    pub unsafe fn from_ptr<'a>(_ptr: S::FfiPtr) -> Option<&'a Self> {
-        panic!()
-    }
-}
-
-fn main() {
-    const TEXT_U16: &'static [u16] = &[];
-    let _ = unsafe { SUtf16Str::from_ptr((TEXT_U16.as_ptr(), TEXT_U16.len())).unwrap() };
-}
diff --git a/src/test/ui/issues/issue-40231-2.rs b/src/test/ui/issues/issue-40231-2.rs
deleted file mode 100644 (file)
index 780433b..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// check-pass
-
-#![allow(dead_code)]
-
-trait Structure<E>: Sized where E: Encoding {
-    type RefTarget: ?Sized;
-    type FfiPtr;
-    unsafe fn borrow_from_ffi_ptr<'a>(ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget>;
-}
-
-enum Slice {}
-
-impl<E> Structure<E> for Slice where E: Encoding {
-    type RefTarget = [E::Unit];
-    type FfiPtr = (*const E::FfiUnit, usize);
-    unsafe fn borrow_from_ffi_ptr<'a>(_ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget> {
-        panic!()
-    }
-}
-
-trait Encoding {
-    type Unit: Unit;
-    type FfiUnit;
-}
-
-trait Unit {}
-
-enum Utf16 {}
-
-impl Encoding for Utf16 {
-    type Unit = Utf16Unit;
-    type FfiUnit = u16;
-}
-
-struct Utf16Unit(pub u16);
-
-impl Unit for Utf16Unit {}
-
-struct SUtf16Str {
-    _data: <Slice as Structure<Utf16>>::RefTarget,
-}
-
-impl SUtf16Str {
-    pub unsafe fn from_ptr<'a>(ptr: <Slice as Structure<Utf16>>::FfiPtr)
-    -> Option<&'a Self> {
-        std::mem::transmute::<Option<&[<Utf16 as Encoding>::Unit]>, _>(
-            <Slice as Structure<Utf16>>::borrow_from_ffi_ptr(ptr))
-    }
-}
-
-fn main() {
-    const TEXT_U16: &'static [u16] = &[];
-    let _ = unsafe { SUtf16Str::from_ptr((TEXT_U16.as_ptr(), TEXT_U16.len())).unwrap() };
-}
diff --git a/src/test/ui/issues/issue-46959.rs b/src/test/ui/issues/issue-46959.rs
deleted file mode 100644 (file)
index 3611a95..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// check-pass
-#![deny(non_camel_case_types)]
-
-#[allow(dead_code)]
-fn qqq(lol: impl Iterator<Item=u32>) -> impl Iterator<Item=u64> {
-        lol.map(|x|x as u64)
-}
-
-fn main() {}
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.baseleak.stderr
new file mode 100644 (file)
index 0000000..4448f93
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/old-lub-glb-hr-noteq1.rs:17:14
+   |
+LL |       let z = match 22 {
+   |  _____________-
+LL | |         0 => x,
+   | |              - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+LL | |         _ => y,
+   | |              ^ one type is more general than the other
+LL | |
+...  |
+LL | |
+LL | |     };
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+              found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.basenoleak.stderr
new file mode 100644 (file)
index 0000000..4448f93
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/old-lub-glb-hr-noteq1.rs:17:14
+   |
+LL |       let z = match 22 {
+   |  _____________-
+LL | |         0 => x,
+   | |              - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+LL | |         _ => y,
+   | |              ^ one type is more general than the other
+LL | |
+...  |
+LL | |
+LL | |     };
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+              found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nll.stderr
deleted file mode 100644 (file)
index 5ac3929..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/old-lub-glb-hr-noteq1.rs:11:14
-   |
-LL |         _ => y,
-   |              ^ one type is more general than the other
-   |
-   = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
-              found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllleak.stderr
new file mode 100644 (file)
index 0000000..4448f93
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/old-lub-glb-hr-noteq1.rs:17:14
+   |
+LL |       let z = match 22 {
+   |  _____________-
+LL | |         0 => x,
+   | |              - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+LL | |         _ => y,
+   | |              ^ one type is more general than the other
+LL | |
+...  |
+LL | |
+LL | |     };
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+              found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.nllnoleak.stderr
new file mode 100644 (file)
index 0000000..0d61311
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/old-lub-glb-hr-noteq1.rs:17:14
+   |
+LL |         _ => y,
+   |              ^ one type is more general than the other
+   |
+   = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+              found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index 918542d471b58c08b4640afe24156595106d309a..2cf123cce7ffd001e6d1bb4f5b5192b30b57fe31 100644 (file)
@@ -2,13 +2,23 @@
 // general than the other. Test the case where the more general type (`x`) is the first
 // match arm specifically.
 
+// revisions: baseleak basenoleak nllleak nllnoleak
+// ignore-compare-mode-nll
+//[nllleak] compile-flags: -Zborrowck=mir
+//[nllnoleak] compile-flags: -Zborrowck=mir -Zno-leak-check
+//[basenoleak] compile-flags:-Zno-leak-check
+
 fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8) -> &'a u8) {
     // The two types above are not equivalent. With the older LUB/GLB
     // algorithm, this may have worked (I don't remember), but now it
     // doesn't because we require equality.
     let z = match 22 {
         0 => x,
-        _ => y, //~ ERROR `match` arms have incompatible types
+        _ => y,
+        //[baseleak]~^ ERROR `match` arms have incompatible types
+        //[nllleak]~^^ ERROR `match` arms have incompatible types
+        //[basenoleak]~^^^ ERROR `match` arms have incompatible types
+        //[nllnoleak]~^^^^ ERROR mismatched types
     };
 }
 
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq1.stderr
deleted file mode 100644 (file)
index 305e952..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0308]: `match` arms have incompatible types
-  --> $DIR/old-lub-glb-hr-noteq1.rs:11:14
-   |
-LL |       let z = match 22 {
-   |  _____________-
-LL | |         0 => x,
-   | |              - this is found to be of type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
-LL | |         _ => y,
-   | |              ^ one type is more general than the other
-LL | |     };
-   | |_____- `match` arms have incompatible types
-   |
-   = note: expected fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
-              found fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.baseleak.stderr
new file mode 100644 (file)
index 0000000..1c9ce11
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/old-lub-glb-hr-noteq2.rs:28:14
+   |
+LL |       let z = match 22 {
+   |  _____________-
+LL | |         0 => y,
+   | |              - this is found to be of type `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+LL | |         _ => x,
+   | |              ^ one type is more general than the other
+LL | |
+LL | |
+LL | |
+LL | |     };
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+              found fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.basenoleak.stderr
new file mode 100644 (file)
index 0000000..1c9ce11
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/old-lub-glb-hr-noteq2.rs:28:14
+   |
+LL |       let z = match 22 {
+   |  _____________-
+LL | |         0 => y,
+   | |              - this is found to be of type `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+LL | |         _ => x,
+   | |              ^ one type is more general than the other
+LL | |
+LL | |
+LL | |
+LL | |     };
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+              found fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.nllleak.stderr
new file mode 100644 (file)
index 0000000..1c9ce11
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/old-lub-glb-hr-noteq2.rs:28:14
+   |
+LL |       let z = match 22 {
+   |  _____________-
+LL | |         0 => y,
+   | |              - this is found to be of type `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+LL | |         _ => x,
+   | |              ^ one type is more general than the other
+LL | |
+LL | |
+LL | |
+LL | |     };
+   | |_____- `match` arms have incompatible types
+   |
+   = note: expected fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
+              found fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
index 2aabc0dab1edb1daff842c15f4204566fe4fe8fc..d49b85ce05ef7e3ee90fc24a7aa045406f471726 100644 (file)
@@ -2,15 +2,22 @@
 // one is more general than the other. Test the case where the more general type
 // (`x`) is the second match arm specifically.
 //
-// FIXME(#73154) Skip for compare-mode because the pure NLL checker accepts this
-// test. (Note that it still errors in old-lub-glb-hr-noteq1.rs). What happens
+// FIXME(#73154) Pure NLL checker without leak check accepts this test.
+// (Note that it still errors in old-lub-glb-hr-noteq1.rs). What happens
 // is that, due to the ordering of the match arms, we pick the correct "more
 // general" fn type, and we ignore the errors from the non-NLL type checker that
 // requires equality. The NLL type checker only requires a subtyping
-// relationship, and that holds.
-//
+// relationship, and that holds. To unblock landing NLL - and ensure that we can
+// choose to make this always in error in the future - we perform the leak check
+// after coercing a function pointer.
+
+// revisions: baseleak basenoleak nllleak nllnoleak
 // ignore-compare-mode-nll
-// ignore-compare-mode-polonius
+//[nllleak] compile-flags: -Zborrowck=mir
+//[nllnoleak] compile-flags: -Zborrowck=mir -Zno-leak-check
+//[basenoleak] compile-flags:-Zno-leak-check
+
+//[nllnoleak] check-pass
 
 fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8) -> &'a u8) {
     // The two types above are not equivalent. With the older LUB/GLB
@@ -18,7 +25,10 @@ fn foo(x: for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8, y: for<'a> fn(&'a u8, &'a u8
     // doesn't because we require equality.
     let z = match 22 {
         0 => y,
-        _ => x, //~ ERROR `match` arms have incompatible types
+        _ => x,
+        //[baseleak]~^ ERROR `match` arms have incompatible types
+        //[nllleak]~^^ ERROR `match` arms have incompatible types
+        //[basenoleak]~^^^ ERROR `match` arms have incompatible types
     };
 }
 
diff --git a/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr b/src/test/ui/lub-glb/old-lub-glb-hr-noteq2.stderr
deleted file mode 100644 (file)
index eacbbb8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0308]: `match` arms have incompatible types
-  --> $DIR/old-lub-glb-hr-noteq2.rs:21:14
-   |
-LL |       let z = match 22 {
-   |  _____________-
-LL | |         0 => y,
-   | |              - this is found to be of type `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
-LL | |         _ => x,
-   | |              ^ one type is more general than the other
-LL | |     };
-   | |_____- `match` arms have incompatible types
-   |
-   = note: expected fn pointer `for<'a> fn(&'a u8, &'a u8) -> &'a u8`
-              found fn pointer `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/macros/issue-33185.rs b/src/test/ui/macros/issue-33185.rs
new file mode 100644 (file)
index 0000000..0d66691
--- /dev/null
@@ -0,0 +1,17 @@
+// run-pass
+#![allow(dead_code)]
+
+#[macro_export]
+macro_rules! state {
+    ( $( $name:ident : $field:ty )* ) => (
+        #[derive(Default)]
+        struct State {
+            $($name : $field),*
+        }
+    )
+}
+
+state! { x: i64 }
+
+pub fn main() {
+}
diff --git a/src/test/ui/match/issue-27021.rs b/src/test/ui/match/issue-27021.rs
new file mode 100644 (file)
index 0000000..ef3b114
--- /dev/null
@@ -0,0 +1,28 @@
+// run-pass
+
+// This test is bogus (i.e., should be check-fail) during the period
+// where #54986 is implemented and #54987 is *not* implemented. For
+// now: just ignore it
+//
+// ignore-test
+
+// These are variants of issue-26996.rs. In all cases we are writing
+// into a record field that has been moved out of, and ensuring that
+// such a write won't overwrite the state of the thing it was moved
+// into.
+//
+// That's a fine thing to test when this code is accepted by the
+// compiler, and this code is being transcribed accordingly into
+// the ui test issue-21232-partial-init-and-use.rs
+
+fn main() {
+    let mut c = (1, (1, "".to_owned()));
+    match c {
+        c2 => { (c.1).0 = 2; assert_eq!((c2.1).0, 1); }
+    }
+
+    let mut c = (1, (1, (1, "".to_owned())));
+    match c.1 {
+        c2 => { ((c.1).1).0 = 3; assert_eq!((c2.1).0, 1); }
+    }
+}
diff --git a/src/test/ui/pattern/issue-27320.rs b/src/test/ui/pattern/issue-27320.rs
new file mode 100644 (file)
index 0000000..d1aa56b
--- /dev/null
@@ -0,0 +1,15 @@
+// run-pass
+#![allow(unused_variables)]
+#![allow(dead_code)]
+
+macro_rules! piece(
+    ($piece:pat) => ($piece);
+);
+
+enum Piece {A, B}
+
+fn main() {
+    match Piece::A {
+        piece!(pt@ Piece::A) | piece!(pt@ Piece::B) => {}
+    }
+}
diff --git a/src/test/ui/process/issue-13304.rs b/src/test/ui/process/issue-13304.rs
new file mode 100644 (file)
index 0000000..b10f6d5
--- /dev/null
@@ -0,0 +1,39 @@
+// run-pass
+#![allow(unused_mut)]
+// ignore-emscripten no processes
+// ignore-sgx no processes
+
+use std::env;
+use std::io::prelude::*;
+use std::io;
+use std::process::{Command, Stdio};
+use std::str;
+
+fn main() {
+    let args: Vec<String> = env::args().collect();
+    if args.len() > 1 && args[1] == "child" {
+        child();
+    } else {
+        parent();
+    }
+}
+
+fn parent() {
+    let args: Vec<String> = env::args().collect();
+    let mut p = Command::new(&args[0]).arg("child")
+                        .stdout(Stdio::piped())
+                        .stdin(Stdio::piped())
+                        .spawn().unwrap();
+    p.stdin.as_mut().unwrap().write_all(b"test1\ntest2\ntest3").unwrap();
+    let out = p.wait_with_output().unwrap();
+    assert!(out.status.success());
+    let s = str::from_utf8(&out.stdout).unwrap();
+    assert_eq!(s, "test1\ntest2\ntest3\n");
+}
+
+fn child() {
+    let mut stdin = io::stdin();
+    for line in stdin.lock().lines() {
+        println!("{}", line.unwrap());
+    }
+}
index 2ba4f4f5d9f46381c5c2f68fb5cdc00caa1fd239..b8b9de627af309279e0fea8582831dccd45662b2 100644 (file)
@@ -8,7 +8,7 @@ LL |     *x = *y;
    |          ^^ ...but data from `y` flows into `x` here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:7
+  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:19:7
    |
 LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
    |                     ---------          --------- these two types are declared with different lifetimes...
@@ -17,13 +17,13 @@ LL |     a(x, y);
    |       ^ ...but data from `y` flows into `x` here
 
 error[E0308]: mismatched types
-  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:43
+  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:26:43
    |
 LL |     let _: fn(&mut &isize, &mut &isize) = a;
    |                                           ^ one type is more general than the other
    |
    = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
-              found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
+                 found fn item `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
 
 error: aborting due to 3 previous errors
 
index c64309743346d09b7815d8eab4feabe8cd9b84d1..8a4b313264654f553099cce145c9106f1004ee97 100644 (file)
@@ -1,50 +1,12 @@
-error: lifetime may not live long enough
-  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:12:5
-   |
-LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
-   |      --  -- lifetime `'b` defined here
-   |      |
-   |      lifetime `'a` defined here
-LL |     // Illegal now because there is no `'b:'a` declaration.
-LL |     *x = *y;
-   |     ^^^^^^^ assignment requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:5
-   |
-LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
-   |      -- -- lifetime `'b` defined here
-   |      |
-   |      lifetime `'a` defined here
-...
-LL |     a(x, y);
-   |     ^^^^^^^ argument requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-   = note: requirement occurs because of a mutable reference to `&isize`
-   = note: mutable references are invariant over their type parameter
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-error[E0308]: mismatched types
-  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12
-   |
-LL |     let _: fn(&mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-   |
-   = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
-              found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
-
 error[E0308]: mismatched types
-  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:28:12
+  --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:26:43
    |
 LL |     let _: fn(&mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |                                           ^ one type is more general than the other
    |
    = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
-              found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
+                 found fn item `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
 
-error: aborting due to 4 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0308`.
index ec91d1798083c5c63b196f1ea1307620539e3923..61ae1cc3fad6ae66efd062fd1d606a5a2d33d77b 100644 (file)
@@ -11,7 +11,6 @@ fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
     // Illegal now because there is no `'b:'a` declaration.
     *x = *y;
     //[base]~^ ERROR E0623
-    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
@@ -19,7 +18,6 @@ fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
     // related as required.
     a(x, y);
     //[base]~^ ERROR lifetime mismatch [E0623]
-    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn d() {
@@ -27,7 +25,6 @@ fn d() {
     // inconstraints:
     let _: fn(&mut &isize, &mut &isize) = a;
     //~^ ERROR mismatched types [E0308]
-    //[nll]~^^ ERROR mismatched types [E0308]
 }
 
 fn e() {
index 537a1fb98a50f1093be89bf14b2144731f1e75a8..062411e6f6890de64892b6bbe34894ddc922dad4 100644 (file)
@@ -8,7 +8,7 @@ LL |     *x = *y;
    |          ^^ ...but data from `y` flows into `x` here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:10
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:15:10
    |
 LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
    |                                             ---------          ---------
@@ -19,7 +19,7 @@ LL |     *z = *y;
    |          ^^ ...but data from `y` flows into `z` here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:7
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:21:7
    |
 LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
    |                         ---------          --------- these two types are declared with different lifetimes...
@@ -28,13 +28,13 @@ LL |     a(x, y, z);
    |       ^ ...but data from `y` flows into `x` here
 
 error[E0308]: mismatched types
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:56
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:28:56
    |
 LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
    |                                                        ^ one type is more general than the other
    |
    = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
-              found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)`
+                 found fn item `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
 
 error: aborting due to 4 previous errors
 
index 053078f58df93d54ddafe4a7595f10a24c6d274b..f304c69d44b5d991ec416d6910f4d08e8a323f7c 100644 (file)
@@ -1,59 +1,12 @@
-error: lifetime may not live long enough
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:13:5
-   |
-LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
-   |      --  -- lifetime `'b` defined here
-   |      |
-   |      lifetime `'a` defined here
-LL |     // Illegal now because there is no `'b:'a` declaration.
-LL |     *x = *y;
-   |     ^^^^^^^ assignment requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:5
-   |
-LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
-   |      -- -- lifetime `'b` defined here
-   |      |
-   |      lifetime `'a` defined here
-...
-LL |     a(x, y, z);
-   |     ^^^^^^^^^^ argument requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-   = note: requirement occurs because of a mutable reference to `&isize`
-   = note: mutable references are invariant over their type parameter
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-error[E0308]: mismatched types
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12
-   |
-LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-   |
-   = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
-              found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)`
-
-error[E0308]: mismatched types
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12
-   |
-LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-   |
-   = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
-              found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)`
-
 error[E0308]: mismatched types
-  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:30:12
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:28:56
    |
 LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |                                                        ^ one type is more general than the other
    |
    = note: expected fn pointer `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
-              found fn pointer `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)`
+                 found fn item `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
 
-error: aborting due to 5 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0308`.
index 8b5c1d47ec61b506f42e5ad9a0fe567f42ea53da..da225d842d9b03062ec8665d201c4c2f45f91331 100644 (file)
@@ -12,7 +12,6 @@ fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
     // Illegal now because there is no `'b:'a` declaration.
     *x = *y;
     //[base]~^ ERROR E0623
-    //[nll]~^^ ERROR lifetime may not live long enough
     *z = *y; //[base]~ ERROR E0623
 }
 
@@ -21,7 +20,6 @@ fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
     // related as required.
     a(x, y, z);
     //[base]~^ ERROR lifetime mismatch [E0623]
-    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn d() {
@@ -29,8 +27,6 @@ fn d() {
     // inconstraints:
     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
     //~^ ERROR E0308
-    //[nll]~^^ ERROR mismatched types [E0308]
-    //[nll]~| ERROR mismatched types [E0308]
 }
 
 fn e() {
index 2182d8f661ff8453441f7ba2b05f01555113a5e6..4616035870abfe7148d3c0147e299973a1cdffd7 100644 (file)
@@ -2,10 +2,17 @@ error[E0308]: mismatched types
   --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:12
    |
 LL |     want_G(baz);
-   |            ^^^ one type is more general than the other
+   |     ------ ^^^ one type is more general than the other
+   |     |
+   |     arguments to this function are incorrect
    |
    = note: expected fn pointer `for<'cx> fn(&'cx S) -> &'static S`
-              found fn pointer `for<'r> fn(&'r S) -> &'r S`
+                 found fn item `for<'r> fn(&'r S) -> &'r S {baz}`
+note: function defined here
+  --> $DIR/regions-fn-subtyping-return-static-fail.rs:24:4
+   |
+LL | fn want_G(f: G) {}
+   |    ^^^^^^ ----
 
 error: aborting due to previous error
 
index 0bca2cfbefd9f2a4b884eddca27ef8768b380359..4616035870abfe7148d3c0147e299973a1cdffd7 100644 (file)
@@ -1,11 +1,18 @@
 error[E0308]: mismatched types
-  --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:5
+  --> $DIR/regions-fn-subtyping-return-static-fail.rs:52:12
    |
 LL |     want_G(baz);
-   |     ^^^^^^^^^^^ one type is more general than the other
+   |     ------ ^^^ one type is more general than the other
+   |     |
+   |     arguments to this function are incorrect
    |
    = note: expected fn pointer `for<'cx> fn(&'cx S) -> &'static S`
-              found fn pointer `for<'r> fn(&'r S) -> &'r S`
+                 found fn item `for<'r> fn(&'r S) -> &'r S {baz}`
+note: function defined here
+  --> $DIR/regions-fn-subtyping-return-static-fail.rs:24:4
+   |
+LL | fn want_G(f: G) {}
+   |    ^^^^^^ ----
 
 error: aborting due to previous error
 
index e57b06aac39272e2c7305e15f4dda86f1ef1d760..613e9af90a43fb5d16692048997e9152ad3fc76b 100644 (file)
@@ -8,7 +8,7 @@ LL |     *x = *y;
    |          ^^ ...but data from `y` flows into `x` here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/regions-lifetime-bounds-on-fns.rs:20:7
+  --> $DIR/regions-lifetime-bounds-on-fns.rs:19:7
    |
 LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
    |                     ---------          --------- these two types are declared with different lifetimes...
@@ -17,13 +17,13 @@ LL |     a(x, y);
    |       ^ ...but data from `y` flows into `x` here
 
 error[E0308]: mismatched types
-  --> $DIR/regions-lifetime-bounds-on-fns.rs:28:43
+  --> $DIR/regions-lifetime-bounds-on-fns.rs:26:43
    |
 LL |     let _: fn(&mut &isize, &mut &isize) = a;
    |                                           ^ one type is more general than the other
    |
    = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
-              found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
+                 found fn item `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
 
 error: aborting due to 3 previous errors
 
index 7fe8b4bf57fc197c2e23fb1c049a0aeb12d68be1..268a60968b7349cbafbf71919050222a2f752f08 100644 (file)
@@ -1,50 +1,12 @@
-error: lifetime may not live long enough
-  --> $DIR/regions-lifetime-bounds-on-fns.rs:12:5
-   |
-LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
-   |      --  -- lifetime `'b` defined here
-   |      |
-   |      lifetime `'a` defined here
-LL |     // Illegal now because there is no `'b:'a` declaration.
-LL |     *x = *y;
-   |     ^^^^^^^ assignment requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-
-error: lifetime may not live long enough
-  --> $DIR/regions-lifetime-bounds-on-fns.rs:20:5
-   |
-LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
-   |      -- -- lifetime `'b` defined here
-   |      |
-   |      lifetime `'a` defined here
-...
-LL |     a(x, y);
-   |     ^^^^^^^ argument requires that `'b` must outlive `'a`
-   |
-   = help: consider adding the following bound: `'b: 'a`
-   = note: requirement occurs because of a mutable reference to `&isize`
-   = note: mutable references are invariant over their type parameter
-   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-
-error[E0308]: mismatched types
-  --> $DIR/regions-lifetime-bounds-on-fns.rs:28:12
-   |
-LL |     let _: fn(&mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
-   |
-   = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
-              found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
-
 error[E0308]: mismatched types
-  --> $DIR/regions-lifetime-bounds-on-fns.rs:28:12
+  --> $DIR/regions-lifetime-bounds-on-fns.rs:26:43
    |
 LL |     let _: fn(&mut &isize, &mut &isize) = a;
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |                                           ^ one type is more general than the other
    |
    = note: expected fn pointer `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
-              found fn pointer `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)`
+                 found fn item `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
 
-error: aborting due to 4 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0308`.
index 97c08d8ab0e3c9810f6268434e126a7f3f7bd33c..ef5e5cb12ef10fdead8ebedb8f54ce1d165a1d72 100644 (file)
@@ -11,7 +11,6 @@ fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
     // Illegal now because there is no `'b:'a` declaration.
     *x = *y;
     //[base]~^ ERROR lifetime mismatch [E0623]
-    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
@@ -19,7 +18,6 @@ fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
     // related as required.
     a(x, y);
     //[base]~^ ERROR lifetime mismatch [E0623]
-    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn d() {
@@ -27,7 +25,6 @@ fn d() {
     // inconstraints:
     let _: fn(&mut &isize, &mut &isize) = a;
     //~^ ERROR mismatched types [E0308]
-    //[nll]~^^ ERROR mismatched types [E0308]
 }
 
 fn e() {
diff --git a/src/test/ui/save-analysis/issue-26459.rs b/src/test/ui/save-analysis/issue-26459.rs
new file mode 100644 (file)
index 0000000..2ba05a0
--- /dev/null
@@ -0,0 +1,8 @@
+// compile-flags: -Zsave-analysis
+
+fn main() {
+    match 'a' {
+        char{ch} => true
+        //~^ ERROR expected struct, variant or union type, found builtin type `char`
+    };
+}
diff --git a/src/test/ui/save-analysis/issue-26459.stderr b/src/test/ui/save-analysis/issue-26459.stderr
new file mode 100644 (file)
index 0000000..9f59499
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0574]: expected struct, variant or union type, found builtin type `char`
+  --> $DIR/issue-26459.rs:5:9
+   |
+LL |         char{ch} => true
+   |         ^^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
diff --git a/src/test/ui/typeck/auxiliary/issue-36708.rs b/src/test/ui/typeck/auxiliary/issue-36708.rs
new file mode 100644 (file)
index 0000000..bd8580f
--- /dev/null
@@ -0,0 +1,5 @@
+#![crate_type = "lib"]
+
+pub trait Foo {
+    fn foo();
+}
diff --git a/src/test/ui/typeck/issue-36708.rs b/src/test/ui/typeck/issue-36708.rs
new file mode 100644 (file)
index 0000000..c9d9f2a
--- /dev/null
@@ -0,0 +1,12 @@
+// aux-build:issue-36708.rs
+
+extern crate issue_36708 as lib;
+
+struct Bar;
+
+impl lib::Foo for Bar {
+    fn foo<T>() {}
+    //~^ ERROR E0049
+}
+
+fn main() {}
diff --git a/src/test/ui/typeck/issue-36708.stderr b/src/test/ui/typeck/issue-36708.stderr
new file mode 100644 (file)
index 0000000..140f19f
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters
+  --> $DIR/issue-36708.rs:8:12
+   |
+LL |     fn foo<T>() {}
+   |            ^ found 1 type parameter, expected 0
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0049`.
diff --git a/src/test/ui/unsized/issue-40231-1.rs b/src/test/ui/unsized/issue-40231-1.rs
new file mode 100644 (file)
index 0000000..999399e
--- /dev/null
@@ -0,0 +1,54 @@
+// check-pass
+
+#![allow(dead_code)]
+
+trait Structure<E>: Sized where E: Encoding {
+    type RefTarget: ?Sized;
+    type FfiPtr;
+    unsafe fn borrow_from_ffi_ptr<'a>(ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget>;
+}
+
+enum Slice {}
+
+impl<E> Structure<E> for Slice where E: Encoding {
+    type RefTarget = [E::Unit];
+    type FfiPtr = (*const E::FfiUnit, usize);
+    unsafe fn borrow_from_ffi_ptr<'a>(_ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget> {
+        panic!()
+    }
+}
+
+trait Encoding {
+    type Unit: Unit;
+    type FfiUnit;
+}
+
+trait Unit {}
+
+enum Utf16 {}
+
+impl Encoding for Utf16 {
+    type Unit = Utf16Unit;
+    type FfiUnit = u16;
+}
+
+struct Utf16Unit(pub u16);
+
+impl Unit for Utf16Unit {}
+
+type SUtf16Str = SeStr<Slice, Utf16>;
+
+struct SeStr<S, E> where S: Structure<E>, E: Encoding {
+    _data: S::RefTarget,
+}
+
+impl<S, E> SeStr<S, E> where S: Structure<E>, E: Encoding {
+    pub unsafe fn from_ptr<'a>(_ptr: S::FfiPtr) -> Option<&'a Self> {
+        panic!()
+    }
+}
+
+fn main() {
+    const TEXT_U16: &'static [u16] = &[];
+    let _ = unsafe { SUtf16Str::from_ptr((TEXT_U16.as_ptr(), TEXT_U16.len())).unwrap() };
+}
diff --git a/src/test/ui/unsized/issue-40231-2.rs b/src/test/ui/unsized/issue-40231-2.rs
new file mode 100644 (file)
index 0000000..780433b
--- /dev/null
@@ -0,0 +1,54 @@
+// check-pass
+
+#![allow(dead_code)]
+
+trait Structure<E>: Sized where E: Encoding {
+    type RefTarget: ?Sized;
+    type FfiPtr;
+    unsafe fn borrow_from_ffi_ptr<'a>(ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget>;
+}
+
+enum Slice {}
+
+impl<E> Structure<E> for Slice where E: Encoding {
+    type RefTarget = [E::Unit];
+    type FfiPtr = (*const E::FfiUnit, usize);
+    unsafe fn borrow_from_ffi_ptr<'a>(_ptr: Self::FfiPtr) -> Option<&'a Self::RefTarget> {
+        panic!()
+    }
+}
+
+trait Encoding {
+    type Unit: Unit;
+    type FfiUnit;
+}
+
+trait Unit {}
+
+enum Utf16 {}
+
+impl Encoding for Utf16 {
+    type Unit = Utf16Unit;
+    type FfiUnit = u16;
+}
+
+struct Utf16Unit(pub u16);
+
+impl Unit for Utf16Unit {}
+
+struct SUtf16Str {
+    _data: <Slice as Structure<Utf16>>::RefTarget,
+}
+
+impl SUtf16Str {
+    pub unsafe fn from_ptr<'a>(ptr: <Slice as Structure<Utf16>>::FfiPtr)
+    -> Option<&'a Self> {
+        std::mem::transmute::<Option<&[<Utf16 as Encoding>::Unit]>, _>(
+            <Slice as Structure<Utf16>>::borrow_from_ffi_ptr(ptr))
+    }
+}
+
+fn main() {
+    const TEXT_U16: &'static [u16] = &[];
+    let _ = unsafe { SUtf16Str::from_ptr((TEXT_U16.as_ptr(), TEXT_U16.len())).unwrap() };
+}
index 5712e84adbc202475fdb25752c0095610f5448b6..cf72dc4bd09a38b8f655e58a17af0cbfe16f333c 100644 (file)
@@ -7,8 +7,8 @@
 
 const ENTRY_LIMIT: usize = 1000;
 // FIXME: The following limits should be reduced eventually.
-const ROOT_ENTRY_LIMIT: usize = 974;
-const ISSUES_ENTRY_LIMIT: usize = 2248;
+const ROOT_ENTRY_LIMIT: usize = 971;
+const ISSUES_ENTRY_LIMIT: usize = 2234;
 
 fn check_entries(path: &Path, bad: &mut bool) {
     let dirs = walkdir::WalkDir::new(&path.join("test/ui"))