diff options
| author | bors <bors@rust-lang.org> | 2021-07-04 22:23:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-04 22:23:06 +0000 |
| commit | 5efa4c0555ef2879d9cb5d9e0d247ee767e2fa10 (patch) | |
| tree | fd0d93be775ecb7abc0dcd9ddfa9bb08d39d48a0 /compiler | |
| parent | b3d11f95cc5dd687fdd185ce91e02ebe40e6f46b (diff) | |
| parent | 433287ff31ecd211b41545c0ac8f4202be34fda0 (diff) | |
| download | rust-5efa4c0555ef2879d9cb5d9e0d247ee767e2fa10.tar.gz rust-5efa4c0555ef2879d9cb5d9e0d247ee767e2fa10.zip | |
Auto merge of #86875 - JohnTitor:rollup-fuefamw, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #86477 (E0716: clarify that equivalent code example is erroneous) - #86623 (Add check to ensure error code explanations are not removed anymore even if not emitted) - #86856 (Make x.py less verbose on failures) - #86858 (Stabilize `string_drain_as_str`) - #86859 (Add a regression test for issue-69323) - #86862 (re-export SwitchIntEdgeEffects) - #86864 (Add missing code example for Write::write_vectored) - #86874 (Bump deps) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0716.md | 6 | ||||
| -rw-r--r-- | compiler/rustc_mir/src/dataflow/mod.rs | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0716.md b/compiler/rustc_error_codes/src/error_codes/E0716.md index c6d0337ddda..c3546cd744f 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0716.md +++ b/compiler/rustc_error_codes/src/error_codes/E0716.md @@ -14,14 +14,16 @@ Here, the expression `&foo()` is borrowing the expression `foo()`. As `foo()` is a call to a function, and not the name of a variable, this creates a **temporary** -- that temporary stores the return value from `foo()` so that it can be borrowed. You could imagine that `let p = bar(&foo());` is equivalent to -this: +the following, which uses an explicit temporary variable. + +Erroneous code example: ```compile_fail,E0597 # fn foo() -> i32 { 22 } # fn bar(x: &i32) -> &i32 { x } let p = { let tmp = foo(); // the temporary - bar(&tmp) + bar(&tmp) // error: `tmp` does not live long enough }; // <-- tmp is freed as we exit this block let q = p; ``` diff --git a/compiler/rustc_mir/src/dataflow/mod.rs b/compiler/rustc_mir/src/dataflow/mod.rs index 5575a97982f..03531a6b004 100644 --- a/compiler/rustc_mir/src/dataflow/mod.rs +++ b/compiler/rustc_mir/src/dataflow/mod.rs @@ -7,7 +7,7 @@ pub(crate) use self::drop_flag_effects::*; pub use self::framework::{ fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState, BorrowckResults, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results, - ResultsCursor, ResultsRefCursor, ResultsVisitor, + ResultsCursor, ResultsRefCursor, ResultsVisitor, SwitchIntEdgeEffects, }; use self::move_paths::MoveData; |
