Skip to content

Commit a207871

Browse files
committed
Auto merge of #83781 - JohnTitor:rollup-1vm3dxo, r=JohnTitor
Rollup of 5 pull requests Successful merges: - #83535 (Break when there is a mismatch in the type count) - #83721 (Add a button to copy the "use statement") - #83740 (Fix comment typo in once.rs) - #83745 (Add my new email address to .mailmap) - #83754 (Add test to ensure search tabs behaviour) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0978a9e + 1dfbca9 commit a207871

File tree

14 files changed

+117
-15
lines changed

14 files changed

+117
-15
lines changed

.mailmap

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Xuefeng Wu <benewu@gmail.com> Xuefeng Wu <xfwu@thoughtworks.com>
286286
Xuefeng Wu <benewu@gmail.com> XuefengWu <benewu@gmail.com>
287287
York Xiang <bombless@126.com>
288288
Youngsoo Son <ysson83@gmail.com> <ysoo.son@samsung.com>
289-
Yuki Okushi <huyuumi.dev@gmail.com>
289+
Yuki Okushi <jtitor@2k36.org> <huyuumi.dev@gmail.com>
290290
Zach Pomerantz <zmp@umich.edu>
291291
Zack Corr <zack@z0w0.me> <zackcorr95@gmail.com>
292292
Zack Slayton <zack.slayton@gmail.com>

compiler/rustc_mir/src/borrow_check/type_check/input_output.rs

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
7070

7171
// Equate expected input tys with those in the MIR.
7272
for (argument_index, &normalized_input_ty) in normalized_input_tys.iter().enumerate() {
73+
if argument_index + 1 >= body.local_decls.len() {
74+
self.tcx()
75+
.sess
76+
.delay_span_bug(body.span, "found more normalized_input_ty than local_decls");
77+
break;
78+
}
7379
// In MIR, argument N is stored in local N+1.
7480
let local = Local::new(argument_index + 1);
7581

library/std/src/sync/once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ fn wait(state_and_queue: &AtomicUsize, mut current_state: usize) {
471471
// If the managing thread happens to signal and unpark us before we
472472
// can park ourselves, the result could be this thread never gets
473473
// unparked. Luckily `park` comes with the guarantee that if it got
474-
// an `unpark` just before on an unparked thread is does not park.
474+
// an `unpark` just before on an unparked thread it does not park.
475475
thread::park();
476476
}
477477
break;

src/librustdoc/html/markdown.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,7 @@ fn init_id_map() -> FxHashMap<String, usize> {
13551355
map.insert("default-settings".to_owned(), 1);
13561356
map.insert("rustdoc-vars".to_owned(), 1);
13571357
map.insert("sidebar-vars".to_owned(), 1);
1358+
map.insert("copy-path".to_owned(), 1);
13581359
// This is the list of IDs used by rustdoc sections.
13591360
map.insert("fields".to_owned(), 1);
13601361
map.insert("variants".to_owned(), 1);

src/librustdoc/html/render/print_item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer)
7373
}
7474
}
7575
write!(buf, "<a class=\"{}\" href=\"\">{}</a>", item.type_(), item.name.as_ref().unwrap());
76+
write!(buf, "<button id=\"copy-path\" onclick=\"copy_path(this)\">⎘</button>");
7677

7778
buf.write_str("</span>"); // in-band
7879
buf.write_str("<span class=\"out-of-band\">");

src/librustdoc/html/static/main.js

+25
Original file line numberDiff line numberDiff line change
@@ -3061,3 +3061,28 @@ function hideThemeButtonState() {
30613061
window.onhashchange = onHashChange;
30623062
setupSearchLoader();
30633063
}());
3064+
3065+
function copy_path(but) {
3066+
var parent = but.parentElement;
3067+
var path = [];
3068+
3069+
onEach(parent.childNodes, function(child) {
3070+
if (child.tagName === 'A') {
3071+
path.push(child.textContent);
3072+
}
3073+
});
3074+
3075+
var el = document.createElement('textarea');
3076+
el.value = 'use ' + path.join('::') + ';';
3077+
el.setAttribute('readonly', '');
3078+
// To not make it appear on the screen.
3079+
el.style.position = 'absolute';
3080+
el.style.left = '-9999px';
3081+
3082+
document.body.appendChild(el);
3083+
el.select();
3084+
document.execCommand('copy');
3085+
document.body.removeChild(el);
3086+
3087+
but.textContent = '✓';
3088+
}

src/librustdoc/html/static/noscript.css

+5
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ rules.
3333
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
3434
margin-left: 0 !important;
3535
}
36+
37+
#copy-path {
38+
/* It requires JS to work so no need to display it in this case. */
39+
display: none;
40+
}

src/librustdoc/html/static/rustdoc.css

+16-7
Original file line numberDiff line numberDiff line change
@@ -1318,20 +1318,29 @@ h4 > .notable-traits {
13181318
outline: none;
13191319
}
13201320

1321+
#theme-picker, #settings-menu, .help-button, #copy-path {
1322+
padding: 4px;
1323+
width: 27px;
1324+
height: 29px;
1325+
border: 1px solid;
1326+
border-radius: 3px;
1327+
cursor: pointer;
1328+
}
1329+
13211330
.help-button {
13221331
right: 30px;
13231332
font-family: "Fira Sans", Arial, sans-serif;
13241333
text-align: center;
13251334
font-size: 17px;
1335+
padding-top: 2px;
13261336
}
13271337

1328-
#theme-picker, #settings-menu, .help-button {
1329-
padding: 4px;
1330-
width: 27px;
1331-
height: 29px;
1332-
border: 1px solid;
1333-
border-radius: 3px;
1334-
cursor: pointer;
1338+
#copy-path {
1339+
height: 30px;
1340+
font-size: 18px;
1341+
margin-left: 10px;
1342+
padding: 0 6px;
1343+
width: 28px;
13351344
}
13361345

13371346
#theme-choices {

src/librustdoc/html/static/themes/ayu.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ kbd {
498498
box-shadow-color: #c6cbd1;
499499
}
500500

501-
#theme-picker, #settings-menu, .help-button {
501+
#theme-picker, #settings-menu, .help-button, #copy-path {
502502
border-color: #5c6773;
503503
background-color: #0f1419;
504504
color: #fff;
@@ -510,7 +510,8 @@ kbd {
510510

511511
#theme-picker:hover, #theme-picker:focus,
512512
#settings-menu:hover, #settings-menu:focus,
513-
.help-button:hover, .help-button:focus {
513+
.help-button:hover, .help-button:focus,
514+
#copy-path:hover, #copy-path:focus {
514515
border-color: #e0e0e0;
515516
}
516517

src/librustdoc/html/static/themes/dark.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,16 @@ kbd {
388388
box-shadow-color: #c6cbd1;
389389
}
390390

391-
#theme-picker, #settings-menu, .help-button {
391+
#theme-picker, #settings-menu, .help-button, #copy-path {
392392
border-color: #e0e0e0;
393393
background: #f0f0f0;
394394
color: #000;
395395
}
396396

397397
#theme-picker:hover, #theme-picker:focus,
398398
#settings-menu:hover, #settings-menu:focus,
399-
.help-button:hover, .help-button:focus {
399+
.help-button:hover, .help-button:focus,
400+
#copy-path:hover, #copy-path:focus {
400401
border-color: #ffb900;
401402
}
402403

src/librustdoc/html/static/themes/light.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,15 @@ kbd {
380380
box-shadow-color: #c6cbd1;
381381
}
382382

383-
#theme-picker, #settings-menu, .help-button {
383+
#theme-picker, #settings-menu, .help-button, #copy-path {
384384
border-color: #e0e0e0;
385385
background-color: #fff;
386386
}
387387

388388
#theme-picker:hover, #theme-picker:focus,
389389
#settings-menu:hover, #settings-menu:focus,
390-
.help-button:hover, .help-button:focus {
390+
.help-button:hover, .help-button:focus,
391+
#copy-path:hover, #copy-path:focus {
391392
border-color: #717171;
392393
}
393394

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
goto: file://|DOC_PATH|/index.html
2+
write: (".search-input", "Foo")
3+
// Waiting for the search results to appear...
4+
wait-for: "#titles"
5+
assert: ("#titles > button:nth-of-type(1)", "class", "selected")
6+
7+
// To go back to the original "state"
8+
goto: file://|DOC_PATH|/index.html
9+
write: (".search-input", "-> String")
10+
// Waiting for the search results to appear...
11+
wait-for: "#titles"
12+
// With this search, only the last tab shouldn't be empty so it should be selected.
13+
assert: ("#titles > button:nth-of-type(3)", "class", "selected")
14+
15+
// To go back to the original "state"
16+
goto: file://|DOC_PATH|/index.html
17+
write: (".search-input", "-> Something")
18+
// Waiting for the search results to appear...
19+
wait-for: "#titles"
20+
// With this search, all the tabs are empty so the first one should remain selected.
21+
assert: ("#titles > button:nth-of-type(1)", "class", "selected")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Test that when in MIR the amount of local_decls and amount of normalized_input_tys don't match
2+
// that an out-of-bounds access does not occur.
3+
#![feature(c_variadic)]
4+
5+
fn main() {}
6+
7+
fn foo(_: Bar, ...) -> impl {}
8+
//~^ ERROR only foreign or `unsafe extern "C" functions may be C-variadic
9+
//~| ERROR cannot find type `Bar` in this scope
10+
//~| ERROR at least one trait must be specified
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error: only foreign or `unsafe extern "C" functions may be C-variadic
2+
--> $DIR/issue-83499-input-output-iteration-ice.rs:7:16
3+
|
4+
LL | fn foo(_: Bar, ...) -> impl {}
5+
| ^^^
6+
7+
error: at least one trait must be specified
8+
--> $DIR/issue-83499-input-output-iteration-ice.rs:7:24
9+
|
10+
LL | fn foo(_: Bar, ...) -> impl {}
11+
| ^^^^
12+
13+
error[E0412]: cannot find type `Bar` in this scope
14+
--> $DIR/issue-83499-input-output-iteration-ice.rs:7:11
15+
|
16+
LL | fn foo(_: Bar, ...) -> impl {}
17+
| ^^^ not found in this scope
18+
19+
error: aborting due to 3 previous errors
20+
21+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)