summary refs log tree commit diff
path: root/src/librustc_mir/borrow_check
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-08-13 06:25:52 +0000
committerbors <bors@rust-lang.org>2019-08-13 06:25:52 +0000
commiteae3437dfe991621e8afdc82734f4a172d7ddf9b (patch)
tree8936a353a9fe2195322baf40de256354626bbbcc /src/librustc_mir/borrow_check
parent3f55461efb25b3c8b5c5c3d829065cb032ec953b (diff)
parentc9be294d11352614f6f0eaa7161df325b9300de2 (diff)
downloadrust-1.37.0.tar.gz
rust-1.37.0.zip
Auto merge of #63498 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.37.0
1.37.0 stable

This promotes beta to stable and backports a few PRs:

 - Avoid ICE when referencing desugared local binding in borrow error (#63051)
 - Don't access a static just for its size and alignment (#62982) via 331e09b143aebfcf82dc1f9b69b31ee0083cbf0b
Diffstat (limited to 'src/librustc_mir/borrow_check')
-rw-r--r--src/librustc_mir/borrow_check/conflict_errors.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs
index f23cffeda68..b9cd1f07e83 100644
--- a/src/librustc_mir/borrow_check/conflict_errors.rs
+++ b/src/librustc_mir/borrow_check/conflict_errors.rs
@@ -1116,19 +1116,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                 bug!("try_report_cannot_return_reference_to_local: not a local")
             };
             match self.body.local_kind(local) {
-                LocalKind::ReturnPointer | LocalKind::Temp => {
-                    (
-                        "temporary value".to_string(),
-                        "temporary value created here".to_string(),
-                    )
-                }
-                LocalKind::Arg => {
-                    (
-                        "function parameter".to_string(),
-                        "function parameter borrowed here".to_string(),
-                    )
-                },
-                LocalKind::Var => bug!("local variable without a name"),
+                LocalKind::ReturnPointer | LocalKind::Temp => (
+                    "temporary value".to_string(),
+                    "temporary value created here".to_string(),
+                ),
+                LocalKind::Arg => (
+                    "function parameter".to_string(),
+                    "function parameter borrowed here".to_string(),
+                ),
+                LocalKind::Var => (
+                    "local binding".to_string(),
+                    "local binding introduced here".to_string(),
+                ),
             }
         };