Auto merge of #95565 - jackh726:remove-borrowck-mode, r=nikomatsakis
Remove migrate borrowck mode Closes #58781 Closes #43234 # Stabilization proposal This PR proposes the stabilization of `#![feature(nll)]` and the removal of `-Z borrowck`. Current borrow checking behavior of item bodies is currently done by first infering regions *lexically* and reporting any errors during HIR type checking. If there *are* any errors, then MIR borrowck (NLL) never occurs. If there *aren't* any errors, then MIR borrowck happens and any errors there would be reported. This PR removes the lexical region check of item bodies entirely and only uses MIR borrowck. Because MIR borrowck could never *not* be run for a compiled program, this should not break any programs. It does, however, change diagnostics significantly and allows a slightly larger set of programs to compile. Tracking issue: #43234 RFC: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md Version: 1.63 (2022-06-30 => beta, 2022-08-11 => stable). ## Motivation Over time, the Rust borrow checker has become "smarter" and thus allowed more programs to compile. There have been three different implementations: AST borrowck, MIR borrowck, and polonius (well, in progress). Additionally, there is the "lexical region resolver", which (roughly) solves the constraints generated through HIR typeck. It is not a full borrow checker, but does emit some errors. The AST borrowck was the original implementation of the borrow checker and was part of the initially stabilized Rust 1.0. In mid 2017, work began to implement the current MIR borrow checker and that effort ompleted by the end of 2017, for the most part. During 2018, efforts were made to migrate away from the AST borrow checker to the MIR borrow checker - eventually culminating into "migrate" mode - where HIR typeck with lexical region resolving following by MIR borrow checking - being active by default in the 2018 edition. In early 2019, migrate mode was turned on by default in the 2015 edition as well, but with MIR borrowck errors emitted as warnings. By late 2019, these warnings were upgraded to full errors. This was followed by the complete removal of the AST borrow checker. In the period since, various errors emitted by the MIR borrow checker have been improved to the point that they are mostly the same or better than those emitted by the lexical region resolver. While there do remain some degradations in errors (tracked under the [NLL-diagnostics tag](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-diagnostics), those are sufficiently small and rare enough that increased flexibility of MIR borrow check-only is now a worthwhile tradeoff. ## What is stabilized As said previously, this does not fundamentally change the landscape of accepted programs. However, there are a [few](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-fixed-by-NLL) cases where programs can compile under `feature(nll)`, but not otherwise. There are two notable patterns that are "fixed" by this stabilization. First, the `scoped_threads` feature, which is a continutation of a pre-1.0 API, can sometimes emit a [weird lifetime error](https://github.com/rust-lang/rust/issues/95527) without NLL. Second, actually seen in the standard library. In the `Extend` impl for `HashMap`, there is an implied bound of `K: 'a` that is available with NLL on but not without - this is utilized in the impl. As mentioned before, there are a large number of diagnostic differences. Most of them are better, but some are worse. None are serious or happen often enough to need to block this PR. The biggest change is the loss of error code for a number of lifetime errors in favor of more general "lifetime may not live long enough" error. While this may *seem* bad, the former error codes were just attempts to somewhat-arbitrarily bin together lifetime errors of the same type; however, on paper, they end up being roughly the same with roughly the same kinds of solutions. ## What isn't stabilized This PR does not completely remove the lexical region resolver. In the future, it may be possible to remove that (while still keeping HIR typeck) or to remove it together with HIR typeck. ## Tests Many test outputs get updated by this PR. However, there are number of tests specifically geared towards NLL under `src/test/ui/nll` ## History * On 2017-07-14, [tracking issue opened](https://github.com/rust-lang/rust/issues/43234) * On 2017-07-20, [initial empty MIR pass added](https://github.com/rust-lang/rust/pull/43271) * On 2017-08-29, [RFC opened](https://github.com/rust-lang/rfcs/pull/2094) * On 2017-11-16, [Integrate MIR type-checker with NLL](https://github.com/rust-lang/rust/pull/45825) * On 2017-12-20, [NLL feature complete](https://github.com/rust-lang/rust/pull/46862) * On 2018-07-07, [Don't run AST borrowck on mir mode](https://github.com/rust-lang/rust/pull/52083) * On 2018-07-27, [Add migrate mode](https://github.com/rust-lang/rust/pull/52681) * On 2019-04-22, [Enable migrate mode on 2015 edition](https://github.com/rust-lang/rust/pull/59114) * On 2019-08-26, [Don't downgrade errors on 2015 edition](https://github.com/rust-lang/rust/pull/64221) * On 2019-08-27, [Remove AST borrowck](https://github.com/rust-lang/rust/pull/64790)
This commit is contained in:
commit
bb55bd449e
985 changed files with 1824 additions and 12137 deletions
|
|
@ -452,7 +452,7 @@ Arguments:
|
|||
./x.py test library/std --test-args hash_map
|
||||
./x.py test library/std --stage 0 --no-doc
|
||||
./x.py test src/test/ui --bless
|
||||
./x.py test src/test/ui --compare-mode nll
|
||||
./x.py test src/test/ui --compare-mode chalk
|
||||
|
||||
Note that `test src/test/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
|
||||
just like `build library/std --stage N` it tests the compiler produced by the previous
|
||||
|
|
|
|||
|
|
@ -1167,12 +1167,7 @@ macro_rules! test_definitions {
|
|||
};
|
||||
}
|
||||
|
||||
default_test_with_compare_mode!(Ui {
|
||||
path: "src/test/ui",
|
||||
mode: "ui",
|
||||
suite: "ui",
|
||||
compare_mode: "nll"
|
||||
});
|
||||
default_test!(Ui { path: "src/test/ui", mode: "ui", suite: "ui" });
|
||||
|
||||
default_test!(RunPassValgrind {
|
||||
path: "src/test/run-pass-valgrind",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#![feature(drain_filter)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(let_else)]
|
||||
#![feature(nll)]
|
||||
#![cfg_attr(bootstrap, feature(nll))]
|
||||
#![feature(test)]
|
||||
#![feature(never_type)]
|
||||
#![feature(once_cell)]
|
||||
|
|
|
|||
|
|
@ -1,113 +1,113 @@
|
|||
// MIR for `full_tested_match` after PromoteTemps
|
||||
|
||||
fn full_tested_match() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:14:28: 14:28
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
|
||||
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:16:9: 16:16
|
||||
let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
|
||||
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:16:35: 16:36
|
||||
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:17:14: 17:15
|
||||
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:17:24: 17:25
|
||||
let mut _11: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:12:28: 12:28
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:13:13: 17:6
|
||||
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:14:9: 14:16
|
||||
let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:14:20: 14:27
|
||||
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:14:35: 14:36
|
||||
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:15:14: 15:15
|
||||
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:15:24: 15:25
|
||||
let mut _11: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
scope 1 {
|
||||
}
|
||||
scope 2 {
|
||||
debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
}
|
||||
scope 3 {
|
||||
debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:17:14: 17:15
|
||||
debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:15:14: 15:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:15:13: 19:6
|
||||
StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
_2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:15:13: 15:27
|
||||
StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:13:13: 17:6
|
||||
StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
_2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:13:13: 13:27
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:18:17: 18:23
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:18:17: 18:23
|
||||
_1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:16:17: 16:23
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:16:17: 16:23
|
||||
}
|
||||
|
||||
bb2: {
|
||||
falseEdge -> [real: bb5, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:16:9: 16:16
|
||||
falseEdge -> [real: bb5, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:14:9: 14:16
|
||||
}
|
||||
|
||||
bb3: {
|
||||
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:17:9: 17:16
|
||||
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:15:9: 15:16
|
||||
}
|
||||
|
||||
bb4: {
|
||||
unreachable; // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
unreachable; // scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
_11 = const full_tested_match::promoted[0]; // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
_11 = const full_tested_match::promoted[0]; // scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
// mir::Constant
|
||||
// + span: $DIR/match_false_edges.rs:16:14: 16:15
|
||||
// + span: $DIR/match_false_edges.rs:14:14: 14:15
|
||||
// + literal: Const { ty: &Option<i32>, val: Unevaluated(full_tested_match, [], Some(promoted[0])) }
|
||||
_6 = &(((*_11) as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
_4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:15:19: 15:27
|
||||
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
|
||||
_7 = guard() -> [return: bb6, unwind: bb11]; // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
|
||||
_6 = &(((*_11) as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
_4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:13:19: 13:27
|
||||
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:14:20: 14:27
|
||||
_7 = guard() -> [return: bb6, unwind: bb11]; // scope 0 at $DIR/match_false_edges.rs:14:20: 14:27
|
||||
// mir::Constant
|
||||
// + span: $DIR/match_false_edges.rs:16:20: 16:25
|
||||
// + span: $DIR/match_false_edges.rs:14:20: 14:25
|
||||
// + literal: Const { ty: fn() -> bool {guard}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb6: {
|
||||
switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
|
||||
switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:14:20: 14:27
|
||||
}
|
||||
|
||||
bb7: {
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:16:26: 16:27
|
||||
FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:16:26: 16:27
|
||||
FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:16:26: 16:27
|
||||
StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
_5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15
|
||||
StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:16:35: 16:36
|
||||
_8 = _5; // scope 2 at $DIR/match_false_edges.rs:16:35: 16:36
|
||||
_1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:16:31: 16:37
|
||||
StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:16:36: 16:37
|
||||
StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:14:26: 14:27
|
||||
FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:14:26: 14:27
|
||||
FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:14:26: 14:27
|
||||
StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
_5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:14:14: 14:15
|
||||
StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:14:35: 14:36
|
||||
_8 = _5; // scope 2 at $DIR/match_false_edges.rs:14:35: 14:36
|
||||
_1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:14:31: 14:37
|
||||
StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:14:36: 14:37
|
||||
StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:14:36: 14:37
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:14:36: 14:37
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:14:36: 14:37
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:16:26: 16:27
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37
|
||||
goto -> bb3; // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:14:26: 14:27
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:14:36: 14:37
|
||||
goto -> bb3; // scope 0 at $DIR/match_false_edges.rs:14:20: 14:27
|
||||
}
|
||||
|
||||
bb9: {
|
||||
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:17:14: 17:15
|
||||
_9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:17:14: 17:15
|
||||
StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:17:24: 17:25
|
||||
_10 = _9; // scope 3 at $DIR/match_false_edges.rs:17:24: 17:25
|
||||
_1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:17:20: 17:26
|
||||
StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:17:25: 17:26
|
||||
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:17:25: 17:26
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:17:25: 17:26
|
||||
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:15:14: 15:15
|
||||
_9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:15:14: 15:15
|
||||
StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:15:24: 15:25
|
||||
_10 = _9; // scope 3 at $DIR/match_false_edges.rs:15:24: 15:25
|
||||
_1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:15:20: 15:26
|
||||
StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:15:25: 15:26
|
||||
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:15:25: 15:26
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:15:25: 15:26
|
||||
}
|
||||
|
||||
bb10: {
|
||||
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:19:6: 19:7
|
||||
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:19:6: 19:7
|
||||
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:14:28: 20:2
|
||||
return; // scope 0 at $DIR/match_false_edges.rs:20:2: 20:2
|
||||
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:17:6: 17:7
|
||||
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:17:6: 17:7
|
||||
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:12:28: 18:2
|
||||
return; // scope 0 at $DIR/match_false_edges.rs:18:2: 18:2
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
resume; // scope 0 at $DIR/match_false_edges.rs:14:1: 20:2
|
||||
resume; // scope 0 at $DIR/match_false_edges.rs:12:1: 18:2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,108 +1,108 @@
|
|||
// MIR for `full_tested_match2` before PromoteTemps
|
||||
|
||||
fn full_tested_match2() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:25:29: 25:29
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
|
||||
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:27:9: 27:16
|
||||
let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
|
||||
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:27:35: 27:36
|
||||
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:29:14: 29:15
|
||||
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:29:24: 29:25
|
||||
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:23:29: 23:29
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:24:13: 28:6
|
||||
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:25:9: 25:16
|
||||
let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:25:20: 25:27
|
||||
let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:25:35: 25:36
|
||||
let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:27:24: 27:25
|
||||
scope 1 {
|
||||
}
|
||||
scope 2 {
|
||||
debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
}
|
||||
scope 3 {
|
||||
debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:29:14: 29:15
|
||||
debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:26:13: 30:6
|
||||
StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
_2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:26:13: 26:27
|
||||
StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:24:13: 28:6
|
||||
StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
_2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
_3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:24:13: 24:27
|
||||
}
|
||||
|
||||
bb1: {
|
||||
falseEdge -> [real: bb9, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:28:9: 28:13
|
||||
falseEdge -> [real: bb9, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:26:9: 26:13
|
||||
}
|
||||
|
||||
bb2: {
|
||||
falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:27:9: 27:16
|
||||
falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:25:9: 25:16
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:29:14: 29:15
|
||||
_9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:29:14: 29:15
|
||||
StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:29:24: 29:25
|
||||
_10 = _9; // scope 3 at $DIR/match_false_edges.rs:29:24: 29:25
|
||||
_1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:29:20: 29:26
|
||||
StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:29:25: 29:26
|
||||
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:29:25: 29:26
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:29:25: 29:26
|
||||
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
_9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:27:24: 27:25
|
||||
_10 = _9; // scope 3 at $DIR/match_false_edges.rs:27:24: 27:25
|
||||
_1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:27:20: 27:26
|
||||
StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:27:25: 27:26
|
||||
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:27:25: 27:26
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:27:25: 27:26
|
||||
}
|
||||
|
||||
bb4: {
|
||||
unreachable; // scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
unreachable; // scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
_6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
_4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:26:19: 26:27
|
||||
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
|
||||
_7 = guard() -> [return: bb6, unwind: bb11]; // scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
|
||||
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
_6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
_4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:24:19: 24:27
|
||||
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:25:20: 25:27
|
||||
_7 = guard() -> [return: bb6, unwind: bb11]; // scope 0 at $DIR/match_false_edges.rs:25:20: 25:27
|
||||
// mir::Constant
|
||||
// + span: $DIR/match_false_edges.rs:27:20: 27:25
|
||||
// + span: $DIR/match_false_edges.rs:25:20: 25:25
|
||||
// + literal: Const { ty: fn() -> bool {guard}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb6: {
|
||||
switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
|
||||
switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:25:20: 25:27
|
||||
}
|
||||
|
||||
bb7: {
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:27:26: 27:27
|
||||
FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:27:26: 27:27
|
||||
FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:27:26: 27:27
|
||||
StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
_5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15
|
||||
StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:27:35: 27:36
|
||||
_8 = _5; // scope 2 at $DIR/match_false_edges.rs:27:35: 27:36
|
||||
_1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:27:31: 27:37
|
||||
StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:27:36: 27:37
|
||||
StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:25:26: 25:27
|
||||
FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:25:26: 25:27
|
||||
FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:25:26: 25:27
|
||||
StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
_5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:25:14: 25:15
|
||||
StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:25:35: 25:36
|
||||
_8 = _5; // scope 2 at $DIR/match_false_edges.rs:25:35: 25:36
|
||||
_1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:25:31: 25:37
|
||||
StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:25:36: 25:37
|
||||
StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:25:36: 25:37
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:25:36: 25:37
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:25:36: 25:37
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:27:26: 27:27
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37
|
||||
falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:27:20: 27:27
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:25:26: 25:27
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:25:36: 25:37
|
||||
falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:25:20: 25:27
|
||||
}
|
||||
|
||||
bb9: {
|
||||
_1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:28:17: 28:23
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:28:17: 28:23
|
||||
_1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:26:17: 26:23
|
||||
goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:26:17: 26:23
|
||||
}
|
||||
|
||||
bb10: {
|
||||
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:30:6: 30:7
|
||||
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:30:6: 30:7
|
||||
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:25:29: 31:2
|
||||
return; // scope 0 at $DIR/match_false_edges.rs:31:2: 31:2
|
||||
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:28:6: 28:7
|
||||
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:28:6: 28:7
|
||||
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:23:29: 29:2
|
||||
return; // scope 0 at $DIR/match_false_edges.rs:29:2: 29:2
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
resume; // scope 0 at $DIR/match_false_edges.rs:25:1: 31:2
|
||||
resume; // scope 0 at $DIR/match_false_edges.rs:23:1: 29:2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,153 +1,153 @@
|
|||
// MIR for `main` before PromoteTemps
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:34:11: 34:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
|
||||
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:38:9: 38:16
|
||||
let mut _4: isize; // in scope 0 at $DIR/match_false_edges.rs:36:9: 36:17
|
||||
let mut _5: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
let _6: i32; // in scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
let _7: &i32; // in scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
let mut _8: bool; // in scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
|
||||
let _9: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
let _10: i32; // in scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
let _11: &i32; // in scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
let mut _12: bool; // in scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
|
||||
let mut _13: i32; // in scope 0 at $DIR/match_false_edges.rs:38:27: 38:28
|
||||
let _14: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:39:9: 39:11
|
||||
let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:32:11: 32:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/match_false_edges.rs:33:13: 38:6
|
||||
let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:36:9: 36:16
|
||||
let mut _4: isize; // in scope 0 at $DIR/match_false_edges.rs:34:9: 34:17
|
||||
let mut _5: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
let _6: i32; // in scope 0 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
let _7: &i32; // in scope 0 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
let mut _8: bool; // in scope 0 at $DIR/match_false_edges.rs:34:21: 34:28
|
||||
let _9: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:35:9: 35:11
|
||||
let _10: i32; // in scope 0 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
let _11: &i32; // in scope 0 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
let mut _12: bool; // in scope 0 at $DIR/match_false_edges.rs:36:20: 36:29
|
||||
let mut _13: i32; // in scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
let _14: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
scope 1 {
|
||||
}
|
||||
scope 2 {
|
||||
debug _w => _6; // in scope 2 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
debug _w => _7; // in scope 2 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
debug _w => _6; // in scope 2 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
debug _w => _7; // in scope 2 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
}
|
||||
scope 3 {
|
||||
debug _x => _9; // in scope 3 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
debug _x => _9; // in scope 3 at $DIR/match_false_edges.rs:35:9: 35:11
|
||||
}
|
||||
scope 4 {
|
||||
debug y => _10; // in scope 4 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
debug y => _11; // in scope 4 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
debug y => _10; // in scope 4 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
debug y => _11; // in scope 4 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
}
|
||||
scope 5 {
|
||||
debug _z => _14; // in scope 5 at $DIR/match_false_edges.rs:39:9: 39:11
|
||||
debug _z => _14; // in scope 5 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:35:13: 40:6
|
||||
StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
_2 = Option::<i32>::Some(const 1_i32); // scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
_4 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:35:13: 35:26
|
||||
StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:33:13: 38:6
|
||||
StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
_2 = Option::<i32>::Some(const 1_i32); // scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
_4 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:33:13: 33:26
|
||||
}
|
||||
|
||||
bb1: {
|
||||
falseEdge -> [real: bb9, imaginary: bb4]; // scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
falseEdge -> [real: bb9, imaginary: bb4]; // scope 0 at $DIR/match_false_edges.rs:35:9: 35:11
|
||||
}
|
||||
|
||||
bb2: {
|
||||
falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:36:9: 36:17
|
||||
falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:34:9: 34:17
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageLive(_14); // scope 0 at $DIR/match_false_edges.rs:39:9: 39:11
|
||||
_14 = _2; // scope 0 at $DIR/match_false_edges.rs:39:9: 39:11
|
||||
_1 = const 4_i32; // scope 5 at $DIR/match_false_edges.rs:39:15: 39:16
|
||||
StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:39:15: 39:16
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:39:15: 39:16
|
||||
StorageLive(_14); // scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
_14 = _2; // scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
_1 = const 4_i32; // scope 5 at $DIR/match_false_edges.rs:37:15: 37:16
|
||||
StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:37:15: 37:16
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:37:15: 37:16
|
||||
}
|
||||
|
||||
bb4: {
|
||||
falseEdge -> [real: bb10, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:38:9: 38:16
|
||||
falseEdge -> [real: bb10, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:36:9: 36:16
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
_7 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
_5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
StorageLive(_8); // scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
|
||||
_8 = guard() -> [return: bb6, unwind: bb15]; // scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
|
||||
StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
_7 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
_5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
StorageLive(_8); // scope 0 at $DIR/match_false_edges.rs:34:21: 34:28
|
||||
_8 = guard() -> [return: bb6, unwind: bb15]; // scope 0 at $DIR/match_false_edges.rs:34:21: 34:28
|
||||
// mir::Constant
|
||||
// + span: $DIR/match_false_edges.rs:36:21: 36:26
|
||||
// + span: $DIR/match_false_edges.rs:34:21: 34:26
|
||||
// + literal: Const { ty: fn() -> bool {guard}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb6: {
|
||||
switchInt(move _8) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
|
||||
switchInt(move _8) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:34:21: 34:28
|
||||
}
|
||||
|
||||
bb7: {
|
||||
StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
_6 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:16
|
||||
_1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:36:32: 36:33
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33
|
||||
StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:34:27: 34:28
|
||||
FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:34:27: 34:28
|
||||
FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:34:27: 34:28
|
||||
StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
_6 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:34:14: 34:16
|
||||
_1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:34:32: 34:33
|
||||
StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:34:32: 34:33
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:34:32: 34:33
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:34:32: 34:33
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33
|
||||
falseEdge -> [real: bb1, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:36:21: 36:28
|
||||
StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:34:27: 34:28
|
||||
StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:34:32: 34:33
|
||||
falseEdge -> [real: bb1, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:34:21: 34:28
|
||||
}
|
||||
|
||||
bb9: {
|
||||
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
_9 = _2; // scope 0 at $DIR/match_false_edges.rs:37:9: 37:11
|
||||
_1 = const 2_i32; // scope 3 at $DIR/match_false_edges.rs:37:15: 37:16
|
||||
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:37:15: 37:16
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:37:15: 37:16
|
||||
StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:35:9: 35:11
|
||||
_9 = _2; // scope 0 at $DIR/match_false_edges.rs:35:9: 35:11
|
||||
_1 = const 2_i32; // scope 3 at $DIR/match_false_edges.rs:35:15: 35:16
|
||||
StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:35:15: 35:16
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:35:15: 35:16
|
||||
}
|
||||
|
||||
bb10: {
|
||||
StorageLive(_11); // scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
_11 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
_5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:35:19: 35:26
|
||||
StorageLive(_12); // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
|
||||
StorageLive(_13); // scope 0 at $DIR/match_false_edges.rs:38:27: 38:28
|
||||
_13 = (*_11); // scope 0 at $DIR/match_false_edges.rs:38:27: 38:28
|
||||
_12 = guard2(move _13) -> [return: bb11, unwind: bb15]; // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
|
||||
StorageLive(_11); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
_11 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
_5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:33:19: 33:26
|
||||
StorageLive(_12); // scope 0 at $DIR/match_false_edges.rs:36:20: 36:29
|
||||
StorageLive(_13); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
_13 = (*_11); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28
|
||||
_12 = guard2(move _13) -> [return: bb11, unwind: bb15]; // scope 0 at $DIR/match_false_edges.rs:36:20: 36:29
|
||||
// mir::Constant
|
||||
// + span: $DIR/match_false_edges.rs:38:20: 38:26
|
||||
// + span: $DIR/match_false_edges.rs:36:20: 36:26
|
||||
// + literal: Const { ty: fn(i32) -> bool {guard2}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb11: {
|
||||
switchInt(move _12) -> [false: bb13, otherwise: bb12]; // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
|
||||
switchInt(move _12) -> [false: bb13, otherwise: bb12]; // scope 0 at $DIR/match_false_edges.rs:36:20: 36:29
|
||||
}
|
||||
|
||||
bb12: {
|
||||
StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
|
||||
StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
|
||||
FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
|
||||
FakeRead(ForGuardBinding, _11); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
|
||||
StorageLive(_10); // scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
_10 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:38:14: 38:15
|
||||
_1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:38:33: 38:34
|
||||
StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34
|
||||
StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34
|
||||
StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:36:28: 36:29
|
||||
StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:36:28: 36:29
|
||||
FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:36:28: 36:29
|
||||
FakeRead(ForGuardBinding, _11); // scope 0 at $DIR/match_false_edges.rs:36:28: 36:29
|
||||
StorageLive(_10); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
_10 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:15
|
||||
_1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:36:33: 36:34
|
||||
StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
|
||||
StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
|
||||
goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
|
||||
}
|
||||
|
||||
bb13: {
|
||||
StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
|
||||
StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29
|
||||
StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34
|
||||
falseEdge -> [real: bb3, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29
|
||||
StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:36:28: 36:29
|
||||
StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:36:28: 36:29
|
||||
StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34
|
||||
falseEdge -> [real: bb3, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:36:20: 36:29
|
||||
}
|
||||
|
||||
bb14: {
|
||||
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:40:6: 40:7
|
||||
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:40:6: 40:7
|
||||
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:34:11: 41:2
|
||||
return; // scope 0 at $DIR/match_false_edges.rs:41:2: 41:2
|
||||
StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:38:6: 38:7
|
||||
StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:38:6: 38:7
|
||||
_0 = const (); // scope 0 at $DIR/match_false_edges.rs:32:11: 39:2
|
||||
return; // scope 0 at $DIR/match_false_edges.rs:39:2: 39:2
|
||||
}
|
||||
|
||||
bb15 (cleanup): {
|
||||
resume; // scope 0 at $DIR/match_false_edges.rs:34:1: 41:2
|
||||
resume; // scope 0 at $DIR/match_false_edges.rs:32:1: 39:2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// compile-flags: -Z borrowck=mir
|
||||
|
||||
fn guard() -> bool {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
// suitable variables and that we setup the outlives relationship
|
||||
// between R0 and R1 properly.
|
||||
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// ^^^^^^^^^ force compiler to dump more region information
|
||||
// compile-flags: -Zverbose
|
||||
// ^^^^^^^^^ force compiler to dump more region information
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// in the type of `p` includes the points after `&v[0]` up to (but not
|
||||
// including) the call to `use_x`. The `else` branch is not included.
|
||||
|
||||
// compile-flags:-Zborrowck=mir -Zverbose
|
||||
// ^^^^^^^^^ force compiler to dump more region information
|
||||
// compile-flags:-Zverbose
|
||||
// ^^^^^^^^^ force compiler to dump more region information
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// random #![feature] to ensure that crate attrs
|
||||
// do not offset things
|
||||
/// ```rust
|
||||
/// #![feature(nll)]
|
||||
/// #![feature(bool_to_option)]
|
||||
/// let x: char = 1;
|
||||
/// ```
|
||||
pub fn foo() {
|
||||
|
|
@ -13,7 +13,7 @@ pub fn foo() {
|
|||
/// Add some text around the test...
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(nll)]
|
||||
/// #![feature(bool_to_option)]
|
||||
/// let x: char = 1;
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -22,7 +22,7 @@ pub fn foo() {
|
|||
/// Let's also add a second test in the same doc comment.
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(nll)]
|
||||
/// #![feature(bool_to_option)]
|
||||
/// let x: char = 1;
|
||||
/// ```
|
||||
pub fn bar() {}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/implied-region-constraints.rs:21:64
|
||||
|
|
||||
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
|
||||
| ------------- this type is declared with multiple lifetimes...
|
||||
...
|
||||
LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
|
||||
| ^^^^^ ...but data with one lifetime flows into the other here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/implied-region-constraints.rs:43:72
|
||||
|
|
||||
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
|
||||
| -------------- this type is declared with multiple lifetimes...
|
||||
...
|
||||
LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x;
|
||||
| ^^ ...but data with one lifetime flows into the other here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
#![feature(associated_type_bounds)]
|
||||
|
||||
trait Tr1 { type As1; }
|
||||
|
|
@ -19,8 +15,7 @@ where
|
|||
{
|
||||
// This should fail because `T: 'b` is not implied from `WF(St<'a, 'b, T>)`.
|
||||
let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
|
||||
//[base]~^ ERROR lifetime mismatch [E0623]
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
enum En7<'a, 'b, T> // `<T::As1 as Tr2>::As2: 'a` is implied.
|
||||
|
|
@ -41,8 +36,7 @@ where
|
|||
En7::V0(x) => {
|
||||
// Also fails for the same reason as above:
|
||||
let _failure_proves_not_implied_outlives_region_b: &'b T = &x;
|
||||
//[base]~^ ERROR lifetime mismatch [E0623]
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
},
|
||||
En7::V1(_) => {},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/implied-region-constraints.rs:21:56
|
||||
--> $DIR/implied-region-constraints.rs:17:56
|
||||
|
|
||||
LL | fn _bad_st<'a, 'b, T>(x: St<'a, 'b, T>)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -12,7 +12,7 @@ LL | let _failure_proves_not_implied_outlives_region_b: &'b T = &x.f0;
|
|||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/implied-region-constraints.rs:43:64
|
||||
--> $DIR/implied-region-constraints.rs:38:64
|
||||
|
|
||||
LL | fn _bad_en7<'a, 'b, T>(x: En7<'a, 'b, T>)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||
--> $DIR/associated-types-eq-hr.rs:91:5
|
||||
|
|
||||
LL | foo::<UintStruct>();
|
||||
| ^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||
|
|
||||
note: expected this to be `&isize`
|
||||
--> $DIR/associated-types-eq-hr.rs:30:14
|
||||
|
|
||||
LL | type A = &'a usize;
|
||||
| ^^^^^^^^^
|
||||
= note: expected reference `&isize`
|
||||
found reference `&usize`
|
||||
note: required by a bound in `foo`
|
||||
--> $DIR/associated-types-eq-hr.rs:49:36
|
||||
|
|
||||
LL | fn foo<T>()
|
||||
| --- required by a bound in this
|
||||
LL | where
|
||||
LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
|
||||
| ^^^^^^^^^^^^^ required by this bound in `foo`
|
||||
|
||||
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||
--> $DIR/associated-types-eq-hr.rs:95:5
|
||||
|
|
||||
LL | bar::<IntStruct>();
|
||||
| ^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||
|
|
||||
note: expected this to be `&usize`
|
||||
--> $DIR/associated-types-eq-hr.rs:18:14
|
||||
|
|
||||
LL | type A = &'a isize;
|
||||
| ^^^^^^^^^
|
||||
= note: expected reference `&usize`
|
||||
found reference `&isize`
|
||||
note: required by a bound in `bar`
|
||||
--> $DIR/associated-types-eq-hr.rs:56:36
|
||||
|
|
||||
LL | fn bar<T>()
|
||||
| --- required by a bound in this
|
||||
LL | where
|
||||
LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>,
|
||||
| ^^^^^^^^^^^^^ required by this bound in `bar`
|
||||
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:100:5
|
||||
|
|
||||
LL | tuple_one::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:100:5
|
||||
|
|
||||
LL | tuple_one::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:106:5
|
||||
|
|
||||
LL | tuple_two::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:106:5
|
||||
|
|
||||
LL | tuple_two::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:116:5
|
||||
|
|
||||
LL | tuple_four::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
// Check testing of equality constraints in a higher-ranked context.
|
||||
|
||||
pub trait TheTrait<T> {
|
||||
|
|
@ -98,14 +94,10 @@ pub fn call_bar() {
|
|||
|
||||
pub fn call_tuple_one() {
|
||||
tuple_one::<Tuple>();
|
||||
//[base]~^ ERROR implementation of `TheTrait` is not general enough
|
||||
//[base]~| ERROR implementation of `TheTrait` is not general enough
|
||||
}
|
||||
|
||||
pub fn call_tuple_two() {
|
||||
tuple_two::<Tuple>();
|
||||
//[base]~^ ERROR implementation of `TheTrait` is not general enough
|
||||
//[base]~| ERROR implementation of `TheTrait` is not general enough
|
||||
}
|
||||
|
||||
pub fn call_tuple_three() {
|
||||
|
|
@ -114,7 +106,6 @@ pub fn call_tuple_three() {
|
|||
|
||||
pub fn call_tuple_four() {
|
||||
tuple_four::<Tuple>();
|
||||
//[base]~^ ERROR implementation of `TheTrait` is not general enough
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||
--> $DIR/associated-types-eq-hr.rs:91:5
|
||||
--> $DIR/associated-types-eq-hr.rs:87:5
|
||||
|
|
||||
LL | foo::<UintStruct>();
|
||||
| ^^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
|
||||
|
|
||||
note: expected this to be `&isize`
|
||||
--> $DIR/associated-types-eq-hr.rs:30:14
|
||||
--> $DIR/associated-types-eq-hr.rs:26:14
|
||||
|
|
||||
LL | type A = &'a usize;
|
||||
| ^^^^^^^^^
|
||||
= note: expected reference `&isize`
|
||||
found reference `&usize`
|
||||
note: required by a bound in `foo`
|
||||
--> $DIR/associated-types-eq-hr.rs:49:36
|
||||
--> $DIR/associated-types-eq-hr.rs:45:36
|
||||
|
|
||||
LL | fn foo<T>()
|
||||
| --- required by a bound in this
|
||||
|
|
@ -21,20 +21,20 @@ LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>,
|
|||
| ^^^^^^^^^^^^^ required by this bound in `foo`
|
||||
|
||||
error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||
--> $DIR/associated-types-eq-hr.rs:95:5
|
||||
--> $DIR/associated-types-eq-hr.rs:91:5
|
||||
|
|
||||
LL | bar::<IntStruct>();
|
||||
| ^^^^^^^^^^^^^^^^ type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
|
||||
|
|
||||
note: expected this to be `&usize`
|
||||
--> $DIR/associated-types-eq-hr.rs:18:14
|
||||
--> $DIR/associated-types-eq-hr.rs:14:14
|
||||
|
|
||||
LL | type A = &'a isize;
|
||||
| ^^^^^^^^^
|
||||
= note: expected reference `&usize`
|
||||
found reference `&isize`
|
||||
note: required by a bound in `bar`
|
||||
--> $DIR/associated-types-eq-hr.rs:56:36
|
||||
--> $DIR/associated-types-eq-hr.rs:52:36
|
||||
|
|
||||
LL | fn bar<T>()
|
||||
| --- required by a bound in this
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:26:40
|
||||
|
|
||||
LL | x: <I as Foo<&'a isize>>::A,
|
||||
| --------- these two types are declared with different lifetimes...
|
||||
LL | y: <I as Foo<&'b isize>>::A,
|
||||
| ---------
|
||||
...
|
||||
LL | let z: I::A = if cond { x } else { y };
|
||||
| ^ ...but data from `x` flows into `y` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// Check projection of an associated type out of a higher-ranked
|
||||
// trait-bound in the context of a function body.
|
||||
|
||||
|
|
@ -24,9 +20,8 @@ fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
|
|||
{
|
||||
// x and y here have two distinct lifetimes:
|
||||
let z: I::A = if cond { x } else { y };
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//[nll]~| ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
//~| ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:26:29
|
||||
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:29
|
||||
|
|
||||
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -12,7 +12,7 @@ LL | let z: I::A = if cond { x } else { y };
|
|||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:26:40
|
||||
--> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40
|
||||
|
|
||||
LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/associated-types-subtyping-1.rs:31:38
|
||||
|
|
||||
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
| ----- ----- these two types are declared with different lifetimes...
|
||||
...
|
||||
LL | let _c: <T as Trait<'b>>::Type = a;
|
||||
| ^ ...but data from `y` flows into `x` here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/associated-types-subtyping-1.rs:41:38
|
||||
|
|
||||
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
| ----- ----- these two types are declared with different lifetimes...
|
||||
...
|
||||
LL | let _c: <T as Trait<'a>>::Type = b;
|
||||
| ^ ...but data from `y` flows into `x` here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
#![allow(unused_variables)]
|
||||
|
||||
fn make_any<T>() -> T { loop {} }
|
||||
|
|
@ -26,10 +22,9 @@ fn method2<'a,'b,T>(x: &'a T, y: &'b T)
|
|||
{
|
||||
// Note that &'static T <: &'a T.
|
||||
let a: <T as Trait<'a>>::Type = make_any();
|
||||
//[nll]~^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
let b: <T as Trait<'b>>::Type = make_any();
|
||||
let _c: <T as Trait<'b>>::Type = a;
|
||||
//[base]~^ ERROR E0623
|
||||
}
|
||||
|
||||
fn method3<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
|
|
@ -39,8 +34,7 @@ fn method3<'a,'b,T>(x: &'a T, y: &'b T)
|
|||
let a: <T as Trait<'a>>::Type = make_any();
|
||||
let b: <T as Trait<'b>>::Type = make_any();
|
||||
let _c: <T as Trait<'a>>::Type = b;
|
||||
//[base]~^ ERROR E0623
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn method4<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/associated-types-subtyping-1.rs:28:12
|
||||
--> $DIR/associated-types-subtyping-1.rs:24:12
|
||||
|
|
||||
LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -12,7 +12,7 @@ LL | let a: <T as Trait<'a>>::Type = make_any();
|
|||
= help: consider adding the following bound: `'b: 'a`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/associated-types-subtyping-1.rs:41:13
|
||||
--> $DIR/associated-types-subtyping-1.rs:36:13
|
||||
|
|
||||
LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-contravariant-nll.rs:51:5
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
| ------- ------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^ ...but data from `y` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-contravariant-nll.rs:51:8
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
| ------- ------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^ ...but data from `x` is returned here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
#![feature(unboxed_closures)]
|
||||
|
||||
// Test for projection cache. We should be able to project distinct
|
||||
// lifetimes from `foo` as we reinstantiate it multiple times, but not
|
||||
// if we do it just once. In this variant, the region `'a` is used in
|
||||
// an contravariant position, which affects the results.
|
||||
|
||||
// revisions: ok oneuse transmute krisskross
|
||||
//[ok] check-pass
|
||||
//[oneuse] check-pass
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// FIXME(nll): When stabilizing, this test should replace `project-fn-ret-contravariant.rs`
|
||||
// The two would normally be just revisions, but this test uses revisions heavily, so splitting into
|
||||
// a separate test is just easier.
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
fn foo<'a>() -> &'a u32 { loop { } }
|
||||
|
||||
fn bar<T>(t: T, x: T::Output) -> T::Output
|
||||
where T: FnOnce<()>
|
||||
{
|
||||
t()
|
||||
}
|
||||
|
||||
#[cfg(ok)] // two instantiations: OK
|
||||
fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
let a = bar(foo, x);
|
||||
let b = bar(foo, y);
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[cfg(oneuse)] // one instantiation: OK (surprisingly)
|
||||
fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
let f /* : fn() -> &'static u32 */ = foo; // <-- inferred type annotated
|
||||
let a = bar(f, x); // this is considered ok because fn args are contravariant...
|
||||
let b = bar(f, y); // ...and hence we infer T to distinct values in each call.
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[cfg(transmute)] // one instantiations: BAD
|
||||
fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
||||
bar(foo, x) //[transmute]~ ERROR E0759
|
||||
}
|
||||
|
||||
#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
let a = bar(foo, y);
|
||||
let b = bar(foo, x);
|
||||
(a, b) //[krisskross]~ ERROR lifetime mismatch [E0623]
|
||||
//[krisskross]~^ ERROR lifetime mismatch [E0623]
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/project-fn-ret-contravariant-nll.rs:44:8
|
||||
|
|
||||
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
||||
| ------- this data with lifetime `'a`...
|
||||
LL | bar(foo, x)
|
||||
| ^^^ - ...is used and required to live as long as `'static` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
|
@ -1,25 +1,30 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-contravariant.rs:52:5
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-contravariant.rs:46:4
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
| ------- ------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^ ...but data from `y` is returned here
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-contravariant.rs:52:8
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-contravariant.rs:46:4
|
||||
|
|
||||
LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
| ------- ------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^ ...but data from `x` is returned here
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
||||
|
|
||||
= help: consider adding the following bound: `'b: 'a`
|
||||
|
||||
help: `'a` and `'b` must be the same: replace one with the other
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@
|
|||
//[ok] check-pass
|
||||
//[oneuse] check-pass
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// FIXME(nll): When stabilizing, this test should be replaced with
|
||||
// `project-fn-ret-contravariant-nll.rs` The two would normally be just
|
||||
// revisions, but this test uses revisions heavily, so splitting into
|
||||
// a separate test is just easier.
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
fn foo<'a>() -> &'a u32 { loop { } }
|
||||
|
|
@ -42,15 +36,15 @@ fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
|||
|
||||
#[cfg(transmute)] // one instantiations: BAD
|
||||
fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
||||
bar(foo, x) //[transmute]~ ERROR E0759
|
||||
bar(foo, x) //[transmute]~ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
|
||||
let a = bar(foo, y);
|
||||
let b = bar(foo, x);
|
||||
(a, b) //[krisskross]~ ERROR lifetime mismatch [E0623]
|
||||
//[krisskross]~^ ERROR lifetime mismatch [E0623]
|
||||
(a, b) //[krisskross]~ ERROR lifetime may not live long enough
|
||||
//[krisskross]~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/project-fn-ret-contravariant.rs:45:8
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-contravariant.rs:39:4
|
||||
|
|
||||
LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
|
||||
| ------- this data with lifetime `'a`...
|
||||
| -- lifetime `'a` defined here
|
||||
LL | bar(foo, x)
|
||||
| ^^^ - ...is used and required to live as long as `'static` here
|
||||
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant-nll.rs:64:5
|
||||
|
|
||||
LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant-nll.rs:64:5
|
||||
|
|
||||
LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
||||
|
|
||||
= help: consider adding the following bound: `'b: 'a`
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
help: `'a` and `'b` must be the same: replace one with the other
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant-nll.rs:46:13
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
LL | let a = bar(f, x);
|
||||
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant-nll.rs:46:13
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
LL | let a = bar(f, x);
|
||||
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'b: 'a`
|
||||
= note: requirement occurs because of a function pointer to `foo`
|
||||
= note: the function `foo` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
help: `'a` and `'b` must be the same: replace one with the other
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#![feature(unboxed_closures)]
|
||||
// Test for projection cache. We should be able to project distinct
|
||||
// lifetimes from `foo` as we reinstantiate it multiple times, but not
|
||||
// if we do it just once. In this variant, the region `'a` is used in
|
||||
// an invariant position, which affects the results.
|
||||
|
||||
// revisions: ok oneuse transmute krisskross
|
||||
//[ok] check-pass
|
||||
|
||||
// compile-flags: -Z borrowck=mir
|
||||
// ignore-compare-mode-nll
|
||||
// FIXME(nll): When stabilizing, this test should replace with `project-fn-ret-invariant.rs`
|
||||
// The two would normally be just revisions, but this test uses revisions heavily, so splitting into
|
||||
// a separate test is just easier.
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
struct Type<'a> {
|
||||
// Invariant
|
||||
data: PhantomData<fn(&'a u32) -> &'a u32>,
|
||||
}
|
||||
|
||||
fn foo<'a>() -> Type<'a> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn bar<T>(t: T, x: T::Output) -> T::Output
|
||||
where
|
||||
T: FnOnce<()>,
|
||||
{
|
||||
t()
|
||||
}
|
||||
|
||||
#[cfg(ok)] // two instantiations: OK
|
||||
fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let a = bar(foo, x);
|
||||
let b = bar(foo, y);
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[cfg(oneuse)] // one instantiation: BAD
|
||||
fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
let a = bar(f, x); //[oneuse]~ ERROR lifetime may not live long enough
|
||||
//[oneuse]~^ ERROR lifetime may not live long enough
|
||||
let b = bar(f, y);
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[cfg(transmute)] // one instantiations: BAD
|
||||
fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
|
||||
// Cannot instantiate `foo` with any lifetime other than `'a`,
|
||||
// since it is provided as input.
|
||||
|
||||
bar(foo, x) //[transmute]~ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let a = bar(foo, y);
|
||||
let b = bar(foo, x);
|
||||
(a, b)
|
||||
//[krisskross]~^ ERROR lifetime may not live long enough
|
||||
//[krisskross]~| ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant-nll.rs:57:5
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
|
||||
| -- lifetime `'a` defined here
|
||||
...
|
||||
LL | bar(foo, x)
|
||||
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,24 +1,36 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-invariant.rs:60:22
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant.rs:59:5
|
||||
|
|
||||
LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -------- --------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | let a = bar(foo, y);
|
||||
| ^ ...but data from `x` is returned here
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-invariant.rs:62:9
|
||||
|
|
||||
LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -------- --------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^ ...but data from `x` is returned here
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant.rs:59:5
|
||||
|
|
||||
LL | fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
...
|
||||
LL | (a, b)
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
|
||||
|
|
||||
= help: consider adding the following bound: `'b: 'a`
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
help: `'a` and `'b` must be the same: replace one with the other
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
|||
|
|
@ -1,14 +1,36 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/project-fn-ret-invariant.rs:46:20
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant.rs:40:13
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -------- --------------------
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
...
|
||||
LL | let b = bar(f, y);
|
||||
| ^ ...but data from `x` is returned here
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
LL | let a = bar(f, x);
|
||||
| ^^^^^^^^^ argument requires that `'a` must outlive `'b`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
error: aborting due to previous error
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant.rs:40:13
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
LL | let a = bar(f, x);
|
||||
| ^^^^^^^^^ argument requires that `'b` must outlive `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'b: 'a`
|
||||
= note: requirement occurs because of a function pointer to `foo`
|
||||
= note: the function `foo` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
help: `'a` and `'b` must be the same: replace one with the other
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
|
|||
|
|
@ -7,11 +7,6 @@
|
|||
// revisions: ok oneuse transmute krisskross
|
||||
//[ok] check-pass
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// FIXME(nll): When stabilizing, this test should be replaced with `project-fn-ret-invariant-nll.rs`
|
||||
// The two would normally be just revisions, but this test uses revisions heavily, so splitting into
|
||||
// a separate test is just easier.
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
|
@ -43,7 +38,9 @@ fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
|||
fn baz<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let f = foo; // <-- No consistent type can be inferred for `f` here.
|
||||
let a = bar(f, x);
|
||||
let b = bar(f, y); //[oneuse]~ ERROR lifetime mismatch [E0623]
|
||||
//[oneuse]~^ ERROR lifetime may not live long enough
|
||||
//[oneuse]~| ERROR lifetime may not live long enough
|
||||
let b = bar(f, y);
|
||||
(a, b)
|
||||
}
|
||||
|
||||
|
|
@ -52,14 +49,16 @@ fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
|
|||
// Cannot instantiate `foo` with any lifetime other than `'a`,
|
||||
// since it is provided as input.
|
||||
|
||||
bar(foo, x) //[transmute]~ ERROR E0759
|
||||
bar(foo, x) //[transmute]~ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
|
||||
fn transmute<'a, 'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
|
||||
let a = bar(foo, y); //[krisskross]~ ERROR E0623
|
||||
let a = bar(foo, y);
|
||||
let b = bar(foo, x);
|
||||
(a, b) //[krisskross]~ ERROR E0623
|
||||
(a, b)
|
||||
//[krisskross]~^ ERROR lifetime may not live long enough
|
||||
//[krisskross]~| ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/project-fn-ret-invariant.rs:55:9
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/project-fn-ret-invariant.rs:52:5
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
|
||||
| -------- this data with lifetime `'a`...
|
||||
| -- lifetime `'a` defined here
|
||||
...
|
||||
LL | bar(foo, x)
|
||||
| ^^^ - ...is used and required to live as long as `'static` here
|
||||
| ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
|
||||
|
|
||||
note: `'static` lifetime requirement introduced by the return type
|
||||
--> $DIR/project-fn-ret-invariant.rs:51:37
|
||||
|
|
||||
LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> {
|
||||
| ^^^^^^^ `'static` requirement introduced here
|
||||
...
|
||||
LL | bar(foo, x)
|
||||
| ----------- because of this returned expression
|
||||
= note: requirement occurs because of the type `Type<'_>`, which makes the generic argument `'_` invariant
|
||||
= note: the struct `Type<'a>` is invariant over the parameter `'a`
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/higher-ranked-projection.rs:25:5
|
||||
|
|
||||
LL | foo(());
|
||||
| ^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected reference `&'a ()`
|
||||
found reference `&()`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/higher-ranked-projection.rs:15:33
|
||||
|
|
||||
LL | where for<'a> &'a T: Mirror<Image=U>
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/higher-ranked-projection.rs:25:5
|
||||
--> $DIR/higher-ranked-projection.rs:23:5
|
||||
|
|
||||
LL | foo(());
|
||||
| ^^^ lifetime mismatch
|
||||
| ^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected reference `&'a ()`
|
||||
found reference `&()`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/higher-ranked-projection.rs:15:33
|
||||
--> $DIR/higher-ranked-projection.rs:14:33
|
||||
|
|
||||
LL | where for<'a> &'a T: Mirror<Image=U>
|
||||
| ^^^^^^^
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
|||
--> $DIR/higher-ranked-projection.rs:25:5
|
||||
|
|
||||
LL | foo(());
|
||||
| ^^^ lifetime mismatch
|
||||
| ^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected reference `&'a ()`
|
||||
found reference `&()`
|
||||
|
|
|
|||
|
|
@ -1,17 +1,2 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/higher-ranked-projection.rs:25:5
|
||||
|
|
||||
LL | foo(());
|
||||
| ^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected reference `&'a ()`
|
||||
found reference `&()`
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/higher-ranked-projection.rs:16:33
|
||||
|
|
||||
LL | where for<'a> &'a T: Mirror<Image=U>
|
||||
| ^^^^^^^
|
||||
error: unknown debugging option: `borrowck`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: good badbase badnll
|
||||
// revisions: good bad
|
||||
//[good] check-pass
|
||||
// [badnll]compile-flags: -Zborrowck=mir
|
||||
|
||||
trait Mirror {
|
||||
type Image;
|
||||
|
|
@ -11,7 +9,7 @@ impl<T> Mirror for T {
|
|||
type Image = T;
|
||||
}
|
||||
|
||||
#[cfg(any(badbase, badnll))]
|
||||
#[cfg(bad)]
|
||||
fn foo<U, T>(_t: T)
|
||||
where for<'a> &'a T: Mirror<Image=U>
|
||||
{}
|
||||
|
|
@ -23,6 +21,5 @@ fn foo<U, T>(_t: T)
|
|||
|
||||
fn main() {
|
||||
foo(());
|
||||
//[badbase]~^ ERROR mismatched types
|
||||
//[badnll]~^^ ERROR mismatched types
|
||||
//[bad]~^ ERROR mismatched types
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/issue-76547.rs:24:13
|
||||
|
|
||||
LL | async fn fut(bufs: &mut [&mut [u8]]) {
|
||||
| ---------------- these two types are declared with different lifetimes...
|
||||
LL | ListFut(bufs).await
|
||||
| ^^^^ ...but data from `bufs` flows into `bufs` here
|
||||
|
|
||||
= note: each elided lifetime in input position becomes a distinct lifetime
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) {
|
||||
| ++++ ++ ++
|
||||
|
||||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/issue-76547.rs:39:14
|
||||
|
|
||||
LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
|
||||
| ---------------- these two types are declared with different lifetimes...
|
||||
LL | ListFut2(bufs).await
|
||||
| ^^^^ ...but data from `bufs` flows into `bufs` here
|
||||
|
|
||||
= note: each elided lifetime in input position becomes a distinct lifetime
|
||||
help: consider introducing a named lifetime parameter
|
||||
|
|
||||
LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 {
|
||||
| ++++ ++ ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// Test for diagnostic improvement issue #76547
|
||||
// edition:2018
|
||||
|
||||
|
|
@ -22,8 +18,7 @@ impl<'a> Future for ListFut<'a> {
|
|||
|
||||
async fn fut(bufs: &mut [&mut [u8]]) {
|
||||
ListFut(bufs).await
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]);
|
||||
|
|
@ -37,8 +32,7 @@ impl<'a> Future for ListFut2<'a> {
|
|||
|
||||
async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
|
||||
ListFut2(bufs).await
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/issue-76547.rs:24:13
|
||||
--> $DIR/issue-76547.rs:20:13
|
||||
|
|
||||
LL | async fn fut(bufs: &mut [&mut [u8]]) {
|
||||
| - - let's call the lifetime of this reference `'2`
|
||||
|
|
@ -14,7 +14,7 @@ LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) {
|
|||
| ++++ ++ ++
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/issue-76547.rs:39:14
|
||||
--> $DIR/issue-76547.rs:34:14
|
||||
|
|
||||
LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
|
||||
| - - let's call the lifetime of this reference `'2`
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/issue-62097.rs:16:31
|
||||
|
|
||||
LL | pub async fn run_dummy_fn(&self) {
|
||||
| ^^^^^ this data with an anonymous lifetime `'_`...
|
||||
LL |
|
||||
LL | foo(|| self.bar()).await;
|
||||
| --- ...is used and required to live as long as `'static` here
|
||||
|
|
||||
note: `'static` lifetime requirement introduced by this bound
|
||||
--> $DIR/issue-62097.rs:8:19
|
||||
|
|
||||
LL | F: FnOnce() + 'static
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// edition:2018
|
||||
async fn foo<F>(fun: F)
|
||||
where
|
||||
|
|
@ -14,10 +10,9 @@ struct Struct;
|
|||
|
||||
impl Struct {
|
||||
pub async fn run_dummy_fn(&self) {
|
||||
//[base]~^ ERROR E0759
|
||||
foo(|| self.bar()).await;
|
||||
//[nll]~^ ERROR closure may outlive the current function
|
||||
//[nll]~| ERROR borrowed data escapes outside of associated function
|
||||
//~^ ERROR closure may outlive the current function
|
||||
//~| ERROR borrowed data escapes outside of associated function
|
||||
}
|
||||
|
||||
pub fn bar(&self) {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0373]: closure may outlive the current function, but it borrows `self`, which is owned by the current function
|
||||
--> $DIR/issue-62097.rs:18:13
|
||||
--> $DIR/issue-62097.rs:13:13
|
||||
|
|
||||
LL | foo(|| self.bar()).await;
|
||||
| ^^ ---- `self` is borrowed here
|
||||
|
|
@ -7,7 +7,7 @@ LL | foo(|| self.bar()).await;
|
|||
| may outlive borrowed value `self`
|
||||
|
|
||||
note: function requires argument type to outlive `'static`
|
||||
--> $DIR/issue-62097.rs:18:9
|
||||
--> $DIR/issue-62097.rs:13:9
|
||||
|
|
||||
LL | foo(|| self.bar()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -17,14 +17,13 @@ LL | foo(move || self.bar()).await;
|
|||
| ++++
|
||||
|
||||
error[E0521]: borrowed data escapes outside of associated function
|
||||
--> $DIR/issue-62097.rs:18:9
|
||||
--> $DIR/issue-62097.rs:13:9
|
||||
|
|
||||
LL | pub async fn run_dummy_fn(&self) {
|
||||
| -----
|
||||
| |
|
||||
| `self` is a reference that is only valid in the associated function body
|
||||
| let's call the lifetime of this reference `'1`
|
||||
LL |
|
||||
LL | foo(|| self.bar()).await;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
error[E0621]: explicit lifetime required in the type of `foo`
|
||||
--> $DIR/issue-63388-1.rs:19:9
|
||||
|
|
||||
LL | &'a self, foo: &dyn Foo
|
||||
| -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
|
||||
...
|
||||
LL | foo
|
||||
| ^^^ lifetime `'a` required
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// edition:2018
|
||||
|
||||
struct Xyz {
|
||||
|
|
@ -15,9 +11,8 @@ impl Xyz {
|
|||
&'a self, foo: &dyn Foo
|
||||
) -> &dyn Foo
|
||||
{
|
||||
//[nll]~^ ERROR explicit lifetime required in the type of `foo` [E0621]
|
||||
//~^ ERROR explicit lifetime required in the type of `foo` [E0621]
|
||||
foo
|
||||
//[base]~^ ERROR explicit lifetime required in the type of `foo` [E0621]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0621]: explicit lifetime required in the type of `foo`
|
||||
--> $DIR/issue-63388-1.rs:17:5
|
||||
--> $DIR/issue-63388-1.rs:13:5
|
||||
|
|
||||
LL | &'a self, foo: &dyn Foo
|
||||
| -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
|
||||
|
|
@ -7,7 +7,6 @@ LL | ) -> &dyn Foo
|
|||
LL | / {
|
||||
LL | |
|
||||
LL | | foo
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_____^ lifetime `'a` required
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/issue-72312.rs:14:24
|
||||
|
|
||||
LL | pub async fn start(&self) {
|
||||
| ^^^^^ this data with an anonymous lifetime `'_`...
|
||||
...
|
||||
LL | &self;
|
||||
| ----- ...is used here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/issue-72312.rs:20:9
|
||||
|
|
||||
LL | require_static(async move {
|
||||
| ^^^^^^^^^^^^^^
|
||||
note: `'static` lifetime requirement introduced by this bound
|
||||
--> $DIR/issue-72312.rs:6:22
|
||||
|
|
||||
LL | fn require_static<T: 'static>(val: T) -> T {
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// edition:2018
|
||||
fn require_static<T: 'static>(val: T) -> T {
|
||||
//[base]~^ NOTE 'static` lifetime requirement introduced by this bound
|
||||
val
|
||||
}
|
||||
|
||||
|
|
@ -12,17 +7,13 @@ struct Problem;
|
|||
|
||||
impl Problem {
|
||||
pub async fn start(&self) {
|
||||
//[base]~^ ERROR E0759
|
||||
//[base]~| NOTE this data with an anonymous lifetime `'_`
|
||||
//[base]~| NOTE in this expansion of desugaring of `async` block or function
|
||||
//[nll]~^^^^ NOTE let's call
|
||||
//[nll]~| NOTE `self` is a reference
|
||||
//~^ NOTE let's call
|
||||
//~| NOTE `self` is a reference
|
||||
require_static(async move {
|
||||
//[base]~^ NOTE ...and is required to live as long as `'static` here
|
||||
//[nll]~^^ ERROR borrowed data escapes
|
||||
//[nll]~| NOTE `self` escapes
|
||||
//[nll]~| NOTE argument requires
|
||||
&self; //[base]~ NOTE ...is used here...
|
||||
//~^ ERROR borrowed data escapes
|
||||
//~| NOTE `self` escapes
|
||||
//~| NOTE argument requires
|
||||
&self;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0521]: borrowed data escapes outside of associated function
|
||||
--> $DIR/issue-72312.rs:20:9
|
||||
--> $DIR/issue-72312.rs:12:9
|
||||
|
|
||||
LL | pub async fn start(&self) {
|
||||
| -----
|
||||
|
|
@ -11,7 +11,6 @@ LL | / require_static(async move {
|
|||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | &self;
|
||||
LL | | });
|
||||
| | ^
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/ret-impl-trait-one.rs:14:85
|
||||
|
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ______________________________________________________------_____-------------------_^
|
||||
| | |
|
||||
| | this parameter and the return type are declared with different lifetimes...
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^ ...but data from `a` is returned here
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ret-impl-trait-one.rs:21:80
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ____________________________________--__________________________________________^
|
||||
| | |
|
||||
| | hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
help: to declare that the `impl Trait` captures `'b`, you can add an explicit `'b` lifetime bound
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0623, E0700.
|
||||
For more information about an error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// edition:2018
|
||||
|
||||
// Test that a feature gate is needed to use `impl Trait` as the
|
||||
|
|
@ -12,8 +8,7 @@ impl<T> Trait<'_> for T { }
|
|||
|
||||
// Fails to recognize that both 'a and 'b are mentioned and should thus be accepted
|
||||
async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
(a, b)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/ret-impl-trait-one.rs:14:85
|
||||
--> $DIR/ret-impl-trait-one.rs:10:85
|
||||
|
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ________________________________--__--_______________________________________________^
|
||||
|
|
@ -7,7 +7,6 @@ LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trai
|
|||
| | | lifetime `'b` defined here
|
||||
| | lifetime `'a` defined here
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
|
@ -15,7 +14,7 @@ LL | | }
|
|||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ret-impl-trait-one.rs:21:80
|
||||
--> $DIR/ret-impl-trait-one.rs:16:80
|
||||
|
|
||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||
| ____________________________________--__________________________________________^
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
//compile-flags: -Z borrowck=mir
|
||||
|
||||
fn foo(_:String) {}
|
||||
|
||||
fn main()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0382]: use of moved value: `my_str`
|
||||
--> $DIR/borrowck-drop-from-guard.rs:11:23
|
||||
--> $DIR/borrowck-drop-from-guard.rs:9:23
|
||||
|
|
||||
LL | let my_str = "hello".to_owned();
|
||||
| ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
error[E0507]: cannot move out of `foo` in pattern guard
|
||||
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:18
|
||||
|
|
||||
LL | (|| { let bar = foo; bar.take() })();
|
||||
| ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
|
||||
| |
|
||||
| move out of `foo` occurs here
|
||||
|
|
||||
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
// This is a test that the `#![feature(nll)]` opt-in overrides the
|
||||
// migration mode. The intention here is to emulate the goal behavior
|
||||
// that `--edition 2018` effects on borrowck (modeled here by `-Z
|
||||
// borrowck=migrate`) are themselves overridden by the
|
||||
// `#![feature(nll)]` opt-in.
|
||||
//
|
||||
// Therefore, for developer convenience, under `#[feature(nll)]` the
|
||||
// NLL checks will be emitted as errors *even* in the presence of `-Z
|
||||
// borrowck=migrate`.
|
||||
|
||||
// revisions: zflag edition
|
||||
//[zflag]compile-flags: -Z borrowck=migrate
|
||||
//[edition]edition:2018
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
fn main() {
|
||||
match Some(&4) {
|
||||
None => {},
|
||||
ref mut foo
|
||||
if {
|
||||
(|| { let bar = foo; bar.take() })();
|
||||
//[zflag]~^ ERROR cannot move out of `foo` in pattern guard [E0507]
|
||||
//[edition]~^^ ERROR cannot move out of `foo` in pattern guard [E0507]
|
||||
false
|
||||
} => {},
|
||||
Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
|
||||
_ => println!("Here is some supposedly unreachable code."),
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
error[E0507]: cannot move out of `foo` in pattern guard
|
||||
--> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:18
|
||||
|
|
||||
LL | (|| { let bar = foo; bar.take() })();
|
||||
| ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait
|
||||
| |
|
||||
| move out of `foo` occurs here
|
||||
|
|
||||
= note: variables bound in patterns cannot be moved from until after the end of the pattern guard
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
||||
|
|
@ -2,9 +2,6 @@
|
|||
// error-pattern:panic 1
|
||||
// ignore-emscripten no processes
|
||||
|
||||
// revisions: migrate mir
|
||||
//[mir]compile-flags: -Z borrowck=mir
|
||||
|
||||
fn main() {
|
||||
let x = 2;
|
||||
let y = &x;
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
error[E0623]: lifetime mismatch
|
||||
--> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:13:5
|
||||
|
|
||||
LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
|
||||
| ------------- -----
|
||||
| |
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | S { pointer: &mut *p.pointer }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `p` is returned here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0623`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
// Test that assignments to an `&mut` pointer which is found in a
|
||||
// borrowed (but otherwise non-aliasable) location is illegal.
|
||||
|
||||
|
|
@ -11,8 +7,7 @@ struct S<'a> {
|
|||
|
||||
fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
|
||||
S { pointer: &mut *p.pointer }
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[nll]~^^ ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:13:5
|
||||
--> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:9:5
|
||||
|
|
||||
LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
|
||||
| -- -- lifetime `'b` defined here
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:17:46
|
||||
|
|
||||
LL | pub fn e(x: &'static mut isize) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
LL | static mut Y: isize = 3;
|
||||
LL | let mut c1 = |y: &'static mut isize| x = y;
|
||||
| ^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:28:50
|
||||
|
|
||||
LL | pub fn ee(x: &'static mut isize) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
...
|
||||
LL | let mut c2 = |y: &'static mut isize| x = y;
|
||||
| ^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14
|
||||
|
|
||||
LL | pub fn capture_assign_whole(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
LL | || { x = (1,); };
|
||||
| ^^^^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:45:14
|
||||
|
|
||||
LL | pub fn capture_assign_part(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
LL | || { x.0 = 1; };
|
||||
| ^^^^^^^ cannot assign
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:50:14
|
||||
|
|
||||
LL | pub fn capture_reborrow_whole(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
LL | || { &mut x; };
|
||||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:55:14
|
||||
|
|
||||
LL | pub fn capture_reborrow_part(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
LL | || { &mut x.0; };
|
||||
| ^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0594, E0596.
|
||||
For more information about an error, try `rustc --explain E0594`.
|
||||
|
|
@ -2,21 +2,12 @@
|
|||
// analysis of a closure body may only be caught when AST-borrowck
|
||||
// looks at some parent.
|
||||
|
||||
// revisions: migrate nll
|
||||
//[nll]compile-flags: -Z borrowck=mir
|
||||
|
||||
// Since we are testing nll (and migration) explicitly as a separate
|
||||
// revisions, don't worry about the --compare-mode=nll on this test.
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
|
||||
// transcribed from borrowck-closures-unique.rs
|
||||
mod borrowck_closures_unique {
|
||||
pub fn e(x: &'static mut isize) {
|
||||
static mut Y: isize = 3;
|
||||
let mut c1 = |y: &'static mut isize| x = y;
|
||||
//[migrate]~^ ERROR is not declared as mutable
|
||||
//[nll]~^^ ERROR is not declared as mutable
|
||||
//~^ ERROR is not declared as mutable
|
||||
unsafe { c1(&mut Y); }
|
||||
}
|
||||
}
|
||||
|
|
@ -26,8 +17,7 @@ mod borrowck_closures_unique_grandparent {
|
|||
static mut Z: isize = 3;
|
||||
let mut c1 = |z: &'static mut isize| {
|
||||
let mut c2 = |y: &'static mut isize| x = y;
|
||||
//[migrate]~^ ERROR is not declared as mutable
|
||||
//[nll]~^^ ERROR is not declared as mutable
|
||||
//~^ ERROR is not declared as mutable
|
||||
c2(z);
|
||||
};
|
||||
unsafe { c1(&mut Z); }
|
||||
|
|
@ -38,23 +28,19 @@ mod borrowck_closures_unique_grandparent {
|
|||
mod mutability_errors {
|
||||
pub fn capture_assign_whole(x: (i32,)) {
|
||||
|| { x = (1,); };
|
||||
//[migrate]~^ ERROR is not declared as mutable
|
||||
//[nll]~^^ ERROR is not declared as mutable
|
||||
//~^ ERROR is not declared as mutable
|
||||
}
|
||||
pub fn capture_assign_part(x: (i32,)) {
|
||||
|| { x.0 = 1; };
|
||||
//[migrate]~^ ERROR is not declared as mutable
|
||||
//[nll]~^^ ERROR is not declared as mutable
|
||||
//~^ ERROR is not declared as mutable
|
||||
}
|
||||
pub fn capture_reborrow_whole(x: (i32,)) {
|
||||
|| { &mut x; };
|
||||
//[migrate]~^ ERROR is not declared as mutable
|
||||
//[nll]~^^ ERROR is not declared as mutable
|
||||
//~^ ERROR is not declared as mutable
|
||||
}
|
||||
pub fn capture_reborrow_part(x: (i32,)) {
|
||||
|| { &mut x.0; };
|
||||
//[migrate]~^ ERROR is not declared as mutable
|
||||
//[nll]~^^ ERROR is not declared as mutable
|
||||
//~^ ERROR is not declared as mutable
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:17:46
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:9:46
|
||||
|
|
||||
LL | pub fn e(x: &'static mut isize) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y;
|
|||
| ^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:28:50
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:19:50
|
||||
|
|
||||
LL | pub fn ee(x: &'static mut isize) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y;
|
|||
| ^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:14
|
||||
|
|
||||
LL | pub fn capture_assign_whole(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
@ -25,7 +25,7 @@ LL | || { x = (1,); };
|
|||
| ^^^^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:45:14
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:14
|
||||
|
|
||||
LL | pub fn capture_assign_part(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
@ -33,7 +33,7 @@ LL | || { x.0 = 1; };
|
|||
| ^^^^^^^ cannot assign
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:50:14
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:38:14
|
||||
|
|
||||
LL | pub fn capture_reborrow_whole(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
@ -41,7 +41,7 @@ LL | || { &mut x; };
|
|||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:55:14
|
||||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:42:14
|
||||
|
|
||||
LL | pub fn capture_reborrow_part(x: (i32,)) {
|
||||
| - help: consider changing this to be mutable: `mut x`
|
||||
|
|
@ -1,18 +1,20 @@
|
|||
// Regression test for #71546.
|
||||
|
||||
// ignore-compare-mode-nll
|
||||
// NLL stderr is different from the original one.
|
||||
|
||||
pub fn serialize_as_csv<V>(value: &V) -> Result<String, &str>
|
||||
where
|
||||
V: 'static,
|
||||
for<'a> &'a V: IntoIterator,
|
||||
for<'a> <&'a V as IntoIterator>::Item: ToString + 'static,
|
||||
{
|
||||
let csv_str: String = value //~ ERROR: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
|
||||
let csv_str: String = value
|
||||
//~^ ERROR higher-ranked lifetime error
|
||||
//~| ERROR higher-ranked lifetime error
|
||||
//~| ERROR higher-ranked lifetime error
|
||||
.into_iter()
|
||||
.map(|elem| elem.to_string())
|
||||
//~^ ERROR higher-ranked lifetime error
|
||||
.collect::<String>();
|
||||
//~^ ERROR higher-ranked lifetime error
|
||||
Ok(csv_str)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,59 @@
|
|||
error[E0310]: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
|
||||
--> $DIR/issue-71546.rs:12:27
|
||||
error: higher-ranked lifetime error
|
||||
--> $DIR/issue-71546.rs:9:27
|
||||
|
|
||||
LL | let csv_str: String = value
|
||||
| ___________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | .into_iter()
|
||||
LL | | .map(|elem| elem.to_string())
|
||||
| |_____________________________________^
|
||||
|
|
||||
= help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`...
|
||||
= note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds...
|
||||
note: ...that is required by this bound
|
||||
--> $DIR/issue-71546.rs:10:55
|
||||
= note: could not prove for<'r> [closure@$DIR/issue-71546.rs:14:14: 14:37] well-formed
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
--> $DIR/issue-71546.rs:9:27
|
||||
|
|
||||
LL | for<'a> <&'a V as IntoIterator>::Item: ToString + 'static,
|
||||
| ^^^^^^^
|
||||
LL | let csv_str: String = value
|
||||
| ___________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | .into_iter()
|
||||
LL | | .map(|elem| elem.to_string())
|
||||
| |_____________________________________^
|
||||
|
|
||||
= note: could not prove for<'r, 's> Map<<&'r V as IntoIterator>::IntoIter, [closure@$DIR/issue-71546.rs:14:14: 14:37]> well-formed
|
||||
|
||||
error: aborting due to previous error
|
||||
error: higher-ranked lifetime error
|
||||
--> $DIR/issue-71546.rs:9:27
|
||||
|
|
||||
LL | let csv_str: String = value
|
||||
| ___________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | .collect::<String>();
|
||||
| |____________________________^
|
||||
|
|
||||
= note: could not prove for<'r, 's> Map<<&'r V as IntoIterator>::IntoIter, [closure@$DIR/issue-71546.rs:14:14: 14:37]> well-formed
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
--> $DIR/issue-71546.rs:14:14
|
||||
|
|
||||
LL | .map(|elem| elem.to_string())
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: could not prove for<'a> <&'a V as IntoIterator>::Item: 'static
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
--> $DIR/issue-71546.rs:16:10
|
||||
|
|
||||
LL | .collect::<String>();
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0310`.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:30:15
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:28:15
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
|
|
@ -10,7 +10,7 @@ LL | *y += 1;
|
|||
| ------- mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:38:13
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:36:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
|
|
@ -21,7 +21,7 @@ LL | *y += 1;
|
|||
| ------- mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:49:13
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:47:13
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
|
|
@ -32,7 +32,7 @@ LL | *y += 1;
|
|||
| ------- mutable borrow later used here
|
||||
|
||||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:60:14
|
||||
--> $DIR/two-phase-activation-sharing-interference.rs:58:14
|
||||
|
|
||||
LL | let y = &mut x;
|
||||
| ------ mutable borrow occurs here
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// revisions: nll_target
|
||||
|
||||
// The following revisions are disabled due to missing support from two-phase beyond autorefs
|
||||
//[nll_beyond] compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
|
||||
|
||||
//[nll_target] compile-flags: -Z borrowck=mir
|
||||
//[nll_beyond] compile-flags: -Z two-phase-beyond-autoref
|
||||
|
||||
// This is an important corner case pointed out by Niko: one is
|
||||
// allowed to initiate a shared borrow during a reservation, but it
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0503]: cannot use `i` because it was mutably borrowed
|
||||
--> $DIR/two-phase-allow-access-during-reservation.rs:28:19
|
||||
--> $DIR/two-phase-allow-access-during-reservation.rs:26:19
|
||||
|
|
||||
LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
|
||||
| ------ borrow of `i` occurs here
|
||||
|
|
@ -11,7 +11,7 @@ LL | /*3*/ *p += 1; // (mutable borrow of `i` starts here, since `p`
|
|||
| ------- borrow later used here
|
||||
|
||||
error[E0503]: cannot use `i` because it was mutably borrowed
|
||||
--> $DIR/two-phase-allow-access-during-reservation.rs:33:19
|
||||
--> $DIR/two-phase-allow-access-during-reservation.rs:31:19
|
||||
|
|
||||
LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
|
||||
| ------ borrow of `i` occurs here
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// revisions: nll_target
|
||||
|
||||
// The following revisions are disabled due to missing support for two_phase_beyond_autoref
|
||||
//[nll_beyond] compile-flags: -Z borrowck=mir -Z two_phase_beyond_autoref
|
||||
|
||||
//[nll_target] compile-flags: -Z borrowck=mir
|
||||
//[nll_beyond] compile-flags: -Z two_phase_beyond_autoref
|
||||
|
||||
// This is the second counter-example from Niko's blog post
|
||||
// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// compile-flags: -Z borrowck=mir
|
||||
|
||||
// This is the third counter-example from Niko's blog post
|
||||
// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-cannot-nest-mut-self-calls.rs:16:9
|
||||
--> $DIR/two-phase-cannot-nest-mut-self-calls.rs:14:9
|
||||
|
|
||||
LL | vec.get({
|
||||
| - --- immutable borrow later used by call
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// compile-flags: -Z borrowck=mir
|
||||
|
||||
// run-pass
|
||||
|
||||
struct Foo<'a> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// compile-flags: -Z borrowck=mir
|
||||
|
||||
// run-pass
|
||||
|
||||
use std::io::Result;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:51:11
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:50:11
|
||||
|
|
||||
LL | f(f(10));
|
||||
| - ^ second mutable borrow occurs here
|
||||
|
|
@ -8,7 +8,7 @@ LL | f(f(10));
|
|||
| first borrow later used by call
|
||||
|
||||
error[E0382]: use of moved value: `f`
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:58:11
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:57:11
|
||||
|
|
||||
LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
|
||||
| - move occurs because `f` has type `Box<F>`, which does not implement the `Copy` trait
|
||||
|
|
@ -18,7 +18,7 @@ LL | f(f(10));
|
|||
| value moved here
|
||||
|
||||
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:63:11
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:62:11
|
||||
|
|
||||
LL | f(f(10));
|
||||
| - ^ second mutable borrow occurs here
|
||||
|
|
@ -27,7 +27,7 @@ LL | f(f(10));
|
|||
| first borrow later used by call
|
||||
|
||||
error[E0382]: use of moved value: `f`
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:70:11
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:69:11
|
||||
|
|
||||
LL | fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
|
||||
| - move occurs because `f` has type `Box<dyn FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
|
||||
|
|
@ -37,7 +37,7 @@ LL | f(f(10));
|
|||
| value moved here
|
||||
|
||||
error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:108:27
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:107:27
|
||||
|
|
||||
LL | double_access(&mut a, &a);
|
||||
| ------------- ------ ^^ immutable borrow occurs here
|
||||
|
|
@ -46,7 +46,7 @@ LL | double_access(&mut a, &a);
|
|||
| mutable borrow later used by call
|
||||
|
||||
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:133:7
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:132:7
|
||||
|
|
||||
LL | i[i[3]] = 4;
|
||||
| --^----
|
||||
|
|
@ -56,18 +56,18 @@ LL | i[i[3]] = 4;
|
|||
| mutable borrow later used here
|
||||
|
|
||||
help: try adding a local storing this...
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:133:7
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:132:7
|
||||
|
|
||||
LL | i[i[3]] = 4;
|
||||
| ^^^^
|
||||
help: ...and then using that local here
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:133:5
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:132:5
|
||||
|
|
||||
LL | i[i[3]] = 4;
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:139:7
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:138:7
|
||||
|
|
||||
LL | i[i[3]] = i[4];
|
||||
| --^----
|
||||
|
|
@ -77,12 +77,12 @@ LL | i[i[3]] = i[4];
|
|||
| mutable borrow later used here
|
||||
|
|
||||
help: try adding a local storing this...
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:139:7
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:138:7
|
||||
|
|
||||
LL | i[i[3]] = i[4];
|
||||
| ^^^^
|
||||
help: ...and then using that local here
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:139:5
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:138:5
|
||||
|
|
||||
LL | i[i[3]] = i[4];
|
||||
| ^^^^^^^
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:51:11
|
||||
|
|
||||
LL | f(f(10));
|
||||
| - ^ second mutable borrow occurs here
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
| first borrow later used by call
|
||||
|
||||
error[E0382]: use of moved value: `f`
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:58:11
|
||||
|
|
||||
LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
|
||||
| - move occurs because `f` has type `Box<F>`, which does not implement the `Copy` trait
|
||||
LL | f(f(10));
|
||||
| - ^ value used here after move
|
||||
| |
|
||||
| value moved here
|
||||
|
||||
error[E0499]: cannot borrow `*f` as mutable more than once at a time
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:63:11
|
||||
|
|
||||
LL | f(f(10));
|
||||
| - ^ second mutable borrow occurs here
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
| first borrow later used by call
|
||||
|
||||
error[E0382]: use of moved value: `f`
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:70:11
|
||||
|
|
||||
LL | fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
|
||||
| - move occurs because `f` has type `Box<dyn FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
|
||||
LL | f(f(10));
|
||||
| - ^ value used here after move
|
||||
| |
|
||||
| value moved here
|
||||
|
||||
error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:108:27
|
||||
|
|
||||
LL | double_access(&mut a, &a);
|
||||
| ------------- ------ ^^ immutable borrow occurs here
|
||||
| | |
|
||||
| | mutable borrow occurs here
|
||||
| mutable borrow later used by call
|
||||
|
||||
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:133:7
|
||||
|
|
||||
LL | i[i[3]] = 4;
|
||||
| --^----
|
||||
| | |
|
||||
| | immutable borrow occurs here
|
||||
| mutable borrow occurs here
|
||||
| mutable borrow later used here
|
||||
|
|
||||
help: try adding a local storing this...
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:133:7
|
||||
|
|
||||
LL | i[i[3]] = 4;
|
||||
| ^^^^
|
||||
help: ...and then using that local here
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:133:5
|
||||
|
|
||||
LL | i[i[3]] = 4;
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:139:7
|
||||
|
|
||||
LL | i[i[3]] = i[4];
|
||||
| --^----
|
||||
| | |
|
||||
| | immutable borrow occurs here
|
||||
| mutable borrow occurs here
|
||||
| mutable borrow later used here
|
||||
|
|
||||
help: try adding a local storing this...
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:139:7
|
||||
|
|
||||
LL | i[i[3]] = i[4];
|
||||
| ^^^^
|
||||
help: ...and then using that local here
|
||||
--> $DIR/two-phase-nonrecv-autoref.rs:139:5
|
||||
|
|
||||
LL | i[i[3]] = i[4];
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0382, E0499, E0502.
|
||||
For more information about an error, try `rustc --explain E0382`.
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
// revisions: base nll
|
||||
//[nll]compile-flags: -Z borrowck=mir
|
||||
// revisions: base
|
||||
|
||||
//[g2p]compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
|
||||
//[g2p]compile-flags: -Z two-phase-beyond-autoref
|
||||
// the above revision is disabled until two-phase-beyond-autoref support is better
|
||||
|
||||
// This is a test checking that when we limit two-phase borrows to
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
LL |
|
||||
LL | v.extend(shared);
|
||||
| ^^------^^^^^^^^
|
||||
| | |
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:27:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
LL |
|
||||
LL | v.extend(shared);
|
||||
| ^^------^^^^^^^^
|
||||
| | |
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
LL |
|
||||
LL | v.extend(shared);
|
||||
| ^^------^^^^^^^^
|
||||
| | |
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:27:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
LL |
|
||||
LL | v.extend(shared);
|
||||
| ^^------^^^^^^^^
|
||||
| | |
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
LL |
|
||||
LL | v.extend(shared);
|
||||
| ^^------^^^^^^^^
|
||||
| | |
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
| | | |
|
||||
| | | immutable borrow occurs here
|
||||
| | immutable borrow later used by call
|
||||
| mutable borrow occurs here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0502`.
|
||||
|
|
@ -2,31 +2,21 @@
|
|||
// accidentally allowed under migrate/nll, then linted against in migrate mode
|
||||
// but disallowed under NLL. Now, we accept it everywhere.
|
||||
|
||||
//ignore-compare-mode-nll
|
||||
//ignore-compare-mode-polonius
|
||||
|
||||
//revisions: base nll
|
||||
|
||||
//[migrate2018] edition:2018
|
||||
//[nll2018] edition:2018
|
||||
|
||||
#![cfg_attr(nll, feature(nll))]
|
||||
|
||||
fn double_conflicts() {
|
||||
let mut v = vec![0, 1, 2];
|
||||
let shared = &v;
|
||||
|
||||
v.extend(shared);
|
||||
//[base]~^ ERROR cannot borrow `v` as mutable
|
||||
//[nll]~^^ ERROR cannot borrow `v` as mutable
|
||||
//~^ ERROR cannot borrow `v` as mutable
|
||||
}
|
||||
|
||||
fn activation_conflict() {
|
||||
let mut v = vec![0, 1, 2];
|
||||
|
||||
v.extend(&v);
|
||||
//[base]~^ ERROR cannot borrow `v` as mutable
|
||||
//[nll]~^^ ERROR cannot borrow `v` as mutable
|
||||
//~^ ERROR cannot borrow `v` as mutable
|
||||
}
|
||||
|
||||
fn reservation_allowed() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:19:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:11:5
|
||||
|
|
||||
LL | let shared = &v;
|
||||
| -- immutable borrow occurs here
|
||||
|
|
@ -11,7 +11,7 @@ LL | v.extend(shared);
|
|||
| mutable borrow occurs here
|
||||
|
||||
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:29:5
|
||||
--> $DIR/two-phase-reservation-sharing-interference-2.rs:18:5
|
||||
|
|
||||
LL | v.extend(&v);
|
||||
| ^^------^--^
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
|
||||
--> $DIR/two-phase-reservation-sharing-interference.rs:34:17
|
||||
--> $DIR/two-phase-reservation-sharing-interference.rs:32:17
|
||||
|
|
||||
LL | let shared = &vec;
|
||||
| ---- immutable borrow occurs here
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
// revisions: nll_target
|
||||
|
||||
// The nll_beyond revision is disabled due to missing support from two-phase beyond autorefs
|
||||
//[nll_beyond]compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
|
||||
//[nll_beyond]compile-flags: -Z two-phase-beyond-autoref
|
||||
//[nll_beyond]should-fail
|
||||
|
||||
//[nll_target]compile-flags: -Z borrowck=mir
|
||||
|
||||
// This is a corner case that the current implementation is (probably)
|
||||
// treating more conservatively than is necessary. But it also does
|
||||
// not seem like a terribly important use case to cover.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// cmpile-flags: -Z borrowck=mir
|
||||
|
||||
// This is the first counter-example from Niko's blog post
|
||||
// smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/
|
||||
// of a danger for code to crash if we just turned off the check for whether
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0499]: cannot borrow `v` as mutable more than once at a time
|
||||
--> $DIR/two-phase-sneaky.rs:12:9
|
||||
--> $DIR/two-phase-sneaky.rs:10:9
|
||||
|
|
||||
LL | v[0].push_str({
|
||||
| - -------- first borrow later used by call
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:20:52
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||
| ^^^^^^^^^^^ lifetime mismatch
|
||||
|
|
||||
= note: expected fn pointer `fn(&u32)`
|
||||
found fn pointer `fn(&'x u32)`
|
||||
note: the anonymous lifetime #1 defined here...
|
||||
--> $DIR/expect-fn-supply-fn.rs:20:48
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: ...does not necessarily outlive the lifetime `'x` as defined here
|
||||
--> $DIR/expect-fn-supply-fn.rs:17:36
|
||||
|
|
||||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
||||
| ^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:20:52
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||
| ^^^^^^^^^^^ lifetime mismatch
|
||||
|
|
||||
= note: expected fn pointer `fn(&u32)`
|
||||
found fn pointer `fn(&'x u32)`
|
||||
note: the lifetime `'x` as defined here...
|
||||
--> $DIR/expect-fn-supply-fn.rs:17:36
|
||||
|
|
||||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
||||
| ^^
|
||||
note: ...does not necessarily outlive the anonymous lifetime #1 defined here
|
||||
--> $DIR/expect-fn-supply-fn.rs:20:48
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:38:52
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
|
||||
| ^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected fn pointer `fn(&u32)`
|
||||
found fn pointer `for<'r> fn(&'r u32)`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:45:53
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
|
||||
| ^^^^^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected fn pointer `for<'r> fn(&'r u32)`
|
||||
found fn pointer `fn(&'x u32)`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:54:53
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
|
||||
| ^^^^^^^ one type is more general than the other
|
||||
|
|
||||
= note: expected fn pointer `for<'r> fn(&'r u32)`
|
||||
found fn pointer `fn(&u32)`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// revisions: base nll
|
||||
// ignore-compare-mode-nll
|
||||
//[nll] compile-flags: -Z borrowck=mir
|
||||
|
||||
fn with_closure_expecting_fn_with_free_region<F>(_: F)
|
||||
where
|
||||
F: for<'a> FnOnce(fn(&'a u32), &i32),
|
||||
|
|
@ -18,10 +14,8 @@ fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
|||
// Here, the type given for `'x` "obscures" a region from the
|
||||
// expected signature that is bound at closure level.
|
||||
with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
||||
//[base]~^ ERROR mismatched types
|
||||
//[base]~| ERROR mismatched types
|
||||
//[nll]~^^^ ERROR lifetime may not live long enough
|
||||
//[nll]~| ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
//~| ERROR lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn expect_free_supply_free_from_closure() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: lifetime may not live long enough
|
||||
--> $DIR/expect-fn-supply-fn.rs:20:49
|
||||
--> $DIR/expect-fn-supply-fn.rs:16:49
|
||||
|
|
||||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
||||
| -- lifetime `'x` defined here
|
||||
|
|
@ -11,7 +11,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
|||
| requires that `'1` must outlive `'x`
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/expect-fn-supply-fn.rs:20:49
|
||||
--> $DIR/expect-fn-supply-fn.rs:16:49
|
||||
|
|
||||
LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
|
||||
| -- lifetime `'x` defined here
|
||||
|
|
@ -20,7 +20,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
|
|||
| ^ requires that `'x` must outlive `'static`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:38:49
|
||||
--> $DIR/expect-fn-supply-fn.rs:32:49
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
|
||||
| ^ one type is more general than the other
|
||||
|
|
@ -29,7 +29,7 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
|
|||
found fn pointer `fn(&u32)`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:45:50
|
||||
--> $DIR/expect-fn-supply-fn.rs:39:50
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
|
||||
| ^ one type is more general than the other
|
||||
|
|
@ -38,7 +38,7 @@ LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
|
|||
found fn pointer `for<'r> fn(&'r u32)`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-fn-supply-fn.rs:54:50
|
||||
--> $DIR/expect-fn-supply-fn.rs:48:50
|
||||
|
|
||||
LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
|
||||
| ^ one type is more general than the other
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:9
|
||||
|
|
||||
LL | fn foo(x: &()) {
|
||||
| --- this data with an anonymous lifetime `'_`...
|
||||
LL | bar(|| {
|
||||
| _________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _ = x;
|
||||
LL | | })
|
||||
| |_____^ ...is used here...
|
||||
|
|
||||
note: ...and is required to live as long as `'static` here
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:5
|
||||
|
|
||||
LL | bar(|| {
|
||||
| ^^^
|
||||
note: `'static` lifetime requirement introduced by this bound
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:39
|
||||
|
|
||||
LL | fn bar<F>(blk: F) where F: FnOnce() + 'static {
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0759`.
|
||||
|
|
@ -1,15 +1,10 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
fn bar<F>(blk: F) where F: FnOnce() + 'static {
|
||||
}
|
||||
|
||||
fn foo(x: &()) {
|
||||
bar(|| {
|
||||
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||
//[nll]~^^ ERROR borrowed data escapes
|
||||
//[nll]~| ERROR closure may outlive
|
||||
//~^ ERROR borrowed data escapes
|
||||
//~| ERROR closure may outlive
|
||||
let _ = x;
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0521]: borrowed data escapes outside of function
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:5
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
||||
|
|
||||
LL | fn foo(x: &()) {
|
||||
| - - let's call the lifetime of this reference `'1`
|
||||
|
|
@ -8,7 +8,6 @@ LL | fn foo(x: &()) {
|
|||
LL | / bar(|| {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _ = x;
|
||||
LL | | })
|
||||
| | ^
|
||||
|
|
@ -17,7 +16,7 @@ LL | | })
|
|||
| argument requires that `'1` must outlive `'static`
|
||||
|
||||
error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:9
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
|
||||
|
|
||||
LL | bar(|| {
|
||||
| ^^ may outlive borrowed value `x`
|
||||
|
|
@ -26,12 +25,11 @@ LL | let _ = x;
|
|||
| - `x` is borrowed here
|
||||
|
|
||||
note: function requires argument type to outlive `'static`
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:5
|
||||
--> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
|
||||
|
|
||||
LL | / bar(|| {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | let _ = x;
|
||||
LL | | })
|
||||
| |______^
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-region-supply-region-2.rs:18:33
|
||||
|
|
||||
LL | closure_expecting_bound(|x: &'x u32| {
|
||||
| ^^^^^^^ lifetime mismatch
|
||||
|
|
||||
= note: expected reference `&u32`
|
||||
found reference `&'x u32`
|
||||
note: the anonymous lifetime #1 defined here...
|
||||
--> $DIR/expect-region-supply-region-2.rs:18:29
|
||||
|
|
||||
LL | closure_expecting_bound(|x: &'x u32| {
|
||||
| _____________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | f = Some(x);
|
||||
LL | | });
|
||||
| |_____^
|
||||
note: ...does not necessarily outlive the lifetime `'x` as defined here
|
||||
--> $DIR/expect-region-supply-region-2.rs:13:30
|
||||
|
|
||||
LL | fn expect_bound_supply_named<'x>() {
|
||||
| ^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/expect-region-supply-region-2.rs:18:33
|
||||
|
|
||||
LL | closure_expecting_bound(|x: &'x u32| {
|
||||
| ^^^^^^^ lifetime mismatch
|
||||
|
|
||||
= note: expected reference `&u32`
|
||||
found reference `&'x u32`
|
||||
note: the lifetime `'x` as defined here...
|
||||
--> $DIR/expect-region-supply-region-2.rs:13:30
|
||||
|
|
||||
LL | fn expect_bound_supply_named<'x>() {
|
||||
| ^^
|
||||
note: ...does not necessarily outlive the anonymous lifetime #1 defined here
|
||||
--> $DIR/expect-region-supply-region-2.rs:18:29
|
||||
|
|
||||
LL | closure_expecting_bound(|x: &'x u32| {
|
||||
| _____________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | f = Some(x);
|
||||
LL | | });
|
||||
| |_____^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
// ignore-compare-mode-nll
|
||||
// revisions: base nll
|
||||
// [nll]compile-flags: -Zborrowck=mir
|
||||
|
||||
#![allow(warnings)]
|
||||
|
||||
fn closure_expecting_bound<F>(_: F)
|
||||
|
|
@ -16,10 +12,8 @@ fn expect_bound_supply_named<'x>() {
|
|||
// Here we give a type annotation that `x` should be free. We get
|
||||
// an error because of that.
|
||||
closure_expecting_bound(|x: &'x u32| {
|
||||
//[base]~^ ERROR mismatched types
|
||||
//[base]~| ERROR mismatched types
|
||||
//[nll]~^^^ ERROR lifetime may not live long enough
|
||||
//[nll]~| ERROR lifetime may not live long enough
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
//~| ERROR lifetime may not live long enough
|
||||
|
||||
// Borrowck doesn't get a chance to run, but if it did it should error
|
||||
// here.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue