about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-11-26 16:30:42 +0000
committerbors <bors@rust-lang.org>2021-11-26 16:30:42 +0000
commit6d246f0c8d3063fea86abbb65a824362709541ba (patch)
tree89367aa9a510b1c1dec9bd2151cf00c9182222f9 /src
parent454cc5fb86be180b3ec1138b6f2b480fbf3f1388 (diff)
parenta9710deebcfc0d24ea7b3510c9afa6afb40d2ae1 (diff)
downloadrust-6d246f0c8d3063fea86abbb65a824362709541ba.tar.gz
rust-6d246f0c8d3063fea86abbb65a824362709541ba.zip
Auto merge of #91253 - matthiaskrgr:rollup-dnlcjmr, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #91169 (Change cg_ssa's get_param to borrow the builder mutably)
 - #91176 (If the thread does not get the lock in the short term, yield the CPU)
 - #91212 (Fix ICE due to out-of-bounds statement index when reporting borrowck error)
 - #91225 (Fix invalid scrollbar display on source code page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css4
-rw-r--r--src/test/ui/borrowck/issue-91206.rs15
-rw-r--r--src/test/ui/borrowck/issue-91206.stderr12
3 files changed, 31 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 0f3eb2ca07d..bfad5106951 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -305,6 +305,10 @@ nav.sub {
 	overflow-y: scroll;
 }
 
+.rustdoc.source .sidebar {
+	overflow-y: auto;
+}
+
 /* Improve the scrollbar display on firefox */
 * {
 	scrollbar-width: initial;
diff --git a/src/test/ui/borrowck/issue-91206.rs b/src/test/ui/borrowck/issue-91206.rs
new file mode 100644
index 00000000000..3b1fbf4b699
--- /dev/null
+++ b/src/test/ui/borrowck/issue-91206.rs
@@ -0,0 +1,15 @@
+struct TestClient;
+
+impl TestClient {
+    fn get_inner_ref(&self) -> &Vec<usize> {
+        todo!()
+    }
+}
+
+fn main() {
+    let client = TestClient;
+    let inner = client.get_inner_ref();
+    //~^ HELP consider changing this to be a mutable reference
+    inner.clear();
+    //~^ ERROR cannot borrow `*inner` as mutable, as it is behind a `&` reference [E0596]
+}
diff --git a/src/test/ui/borrowck/issue-91206.stderr b/src/test/ui/borrowck/issue-91206.stderr
new file mode 100644
index 00000000000..535d247452a
--- /dev/null
+++ b/src/test/ui/borrowck/issue-91206.stderr
@@ -0,0 +1,12 @@
+error[E0596]: cannot borrow `*inner` as mutable, as it is behind a `&` reference
+  --> $DIR/issue-91206.rs:13:5
+   |
+LL |     let inner = client.get_inner_ref();
+   |         ----- help: consider changing this to be a mutable reference: `&mut Vec<usize>`
+LL |
+LL |     inner.clear();
+   |     ^^^^^^^^^^^^^ `inner` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.