Skip to content

Commit 8a97b48

Browse files
committed
Auto merge of rust-lang#106054 - matthiaskrgr:rollup-38epsfh, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#105567 (KCFI test: Also support LLVM 16 output) - rust-lang#105847 (Ensure param-env is const before calling `eval_to_valtree`) - rust-lang#105983 (Add a missing early return in drop tracking `handle_uninhabited_return`) - rust-lang#106027 (rustdoc: simplify CSS and DOM for more-scraped-examples) - rust-lang#106035 (Migrate search tab title color to CSS variable) - rust-lang#106037 (Add regression test for rust-lang#94293) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents cca80b9 + ee43f34 commit 8a97b48

File tree

15 files changed

+211
-39
lines changed

15 files changed

+211
-39
lines changed

compiler/rustc_const_eval/src/interpret/operand.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
577577
ty::ConstKind::Unevaluated(uv) => {
578578
let instance = self.resolve(uv.def, uv.substs)?;
579579
let cid = GlobalId { instance, promoted: None };
580-
self.ctfe_query(span, |tcx| tcx.eval_to_valtree(self.param_env.and(cid)))?
581-
.unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}"))
580+
self.ctfe_query(span, |tcx| {
581+
tcx.eval_to_valtree(self.param_env.with_const().and(cid))
582+
})?
583+
.unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}"))
582584
}
583585
ty::ConstKind::Bound(..) | ty::ConstKind::Infer(..) => {
584586
span_bug!(self.cur_span(), "unexpected ConstKind in ctfe: {val:?}")

compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ impl<'a, 'tcx> DropRangeVisitor<'a, 'tcx> {
233233
self.tcx()
234234
.sess
235235
.delay_span_bug(expr.span, format!("could not resolve infer vars in `{ty}`"));
236+
return;
236237
}
237238
let ty = self.tcx().erase_regions(ty);
238239
let m = self.tcx().parent_module(expr.hir_id).to_def_id();

src/librustdoc/html/render/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -3005,8 +3005,7 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
30053005
</summary>\
30063006
<div class=\"hide-more\">Hide additional examples</div>\
30073007
<div class=\"more-scraped-examples\">\
3008-
<div class=\"toggle-line\"><div class=\"toggle-line-inner\"></div></div>\
3009-
<div class=\"more-scraped-examples-inner\">"
3008+
<div class=\"toggle-line\"><div class=\"toggle-line-inner\"></div></div>"
30103009
);
30113010

30123011
// Only generate inline code for MAX_FULL_EXAMPLES number of examples. Otherwise we could
@@ -3030,7 +3029,7 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
30303029
write!(w, "</ul></div>");
30313030
}
30323031

3033-
write!(w, "</div></div></details>");
3032+
write!(w, "</div></details>");
30343033
}
30353034

30363035
write!(w, "</div>");

src/librustdoc/html/static/css/rustdoc.css

+7-11
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ a.test-arrow:hover {
12811281
#titles > button > div.count {
12821282
display: inline-block;
12831283
font-size: 1rem;
1284+
color: var(--search-tab-title-count-color);
12841285
}
12851286

12861287
#src-sidebar-toggle {
@@ -1991,20 +1992,15 @@ in storage.js
19911992
}
19921993

19931994
.more-scraped-examples {
1994-
margin-left: 5px;
1995-
display: flex;
1996-
flex-direction: row;
1997-
}
1998-
1999-
.more-scraped-examples-inner {
2000-
/* 20px is width of toggle-line + toggle-line-inner */
2001-
width: calc(100% - 20px);
1995+
margin-left: 25px;
1996+
position: relative;
20021997
}
20031998

20041999
.toggle-line {
2005-
align-self: stretch;
2006-
margin-right: 10px;
2007-
margin-top: 5px;
2000+
position: absolute;
2001+
top: 5px;
2002+
bottom: 0;
2003+
right: calc(100% + 10px);
20082004
padding: 0 4px;
20092005
cursor: pointer;
20102006
}

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
4545
--search-color: #fff;
4646
--search-results-alias-color: #c5c5c5;
4747
--search-results-grey-color: #999;
48+
--search-tab-title-count-color: #888;
4849
--stab-background-color: #314559;
4950
--stab-code-color: #e6e1cf;
5051
--code-highlight-kw-color: #ff7733;
@@ -175,10 +176,6 @@ pre, .rustdoc.source .example-wrap {
175176
border-bottom: 1px solid rgba(242, 151, 24, 0.3);
176177
}
177178

178-
#titles > button > div.count {
179-
color: #888;
180-
}
181-
182179
/* rules that this theme does not need to set, here to satisfy the rule checker */
183180
/* note that a lot of these are partially set in some way (meaning they are set
184181
individually rather than as a group) */

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
--search-color: #111;
4141
--search-results-alias-color: #fff;
4242
--search-results-grey-color: #ccc;
43+
--search-tab-title-count-color: #888;
4344
--stab-background-color: #314559;
4445
--stab-code-color: #e6e1cf;
4546
--code-highlight-kw-color: #ab8ac1;
@@ -96,10 +97,6 @@
9697
background-color: #353535;
9798
}
9899

99-
#titles > button > div.count {
100-
color: #888;
101-
}
102-
103100
.scraped-example-list .scrape-help {
104101
border-color: #aaa;
105102
color: #eee;

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
--search-color: #000;
4141
--search-results-alias-color: #000;
4242
--search-results-grey-color: #999;
43+
--search-tab-title-count-color: #888;
4344
--stab-background-color: #fff5d6;
4445
--stab-code-color: #000;
4546
--code-highlight-kw-color: #8959a8;
@@ -93,10 +94,6 @@
9394
border-top-color: #0089ff;
9495
}
9596

96-
#titles > button > div.count {
97-
color: #888;
98-
}
99-
10097
.scraped-example-list .scrape-help {
10198
border-color: #555;
10299
color: #333;

src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,21 @@ impl Copy for i32 {}
2020

2121
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
2222
// CHECK-LABEL: define{{.*}}foo
23-
// FIXME(rcvalle): Change <unknown kind #36> to !kcfi_type when Rust is updated to LLVM 16
24-
// CHECK-SAME: {{.*}}!<unknown kind #36> ![[TYPE1:[0-9]+]]
23+
// CHECK-SAME: {{.*}}!{{<unknown kind #36>|kcfi_type}} ![[TYPE1:[0-9]+]]
2524
// CHECK: call i32 %f(i32 %arg){{.*}}[ "kcfi"(i32 -1666898348) ]
2625
f(arg)
2726
}
2827

2928
pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 {
3029
// CHECK-LABEL: define{{.*}}bar
31-
// FIXME(rcvalle): Change <unknown kind #36> to !kcfi_type when Rust is updated to LLVM 16
32-
// CHECK-SAME: {{.*}}!<unknown kind #36> ![[TYPE2:[0-9]+]]
30+
// CHECK-SAME: {{.*}}!{{<unknown kind #36>|kcfi_type}} ![[TYPE2:[0-9]+]]
3331
// CHECK: call i32 %f(i32 %arg1, i32 %arg2){{.*}}[ "kcfi"(i32 -1789026986) ]
3432
f(arg1, arg2)
3533
}
3634

3735
pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 {
3836
// CHECK-LABEL: define{{.*}}baz
39-
// FIXME(rcvalle): Change <unknown kind #36> to !kcfi_type when Rust is updated to LLVM 16
40-
// CHECK-SAME: {{.*}}!<unknown kind #36> ![[TYPE3:[0-9]+]]
37+
// CHECK-SAME: {{.*}}!{{<unknown kind #36>|kcfi_type}} ![[TYPE3:[0-9]+]]
4138
// CHECK: call i32 %f(i32 %arg1, i32 %arg2, i32 %arg3){{.*}}[ "kcfi"(i32 1248878270) ]
4239
f(arg1, arg2, arg3)
4340
}

src/test/rustdoc-gui/scrape-examples-layout.goml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@ assert-property-false: (
1010
// Check that examples with very long lines have the same width as ones that don't.
1111
store-property: (
1212
clientWidth,
13-
".more-scraped-examples .scraped-example:nth-child(1) .code-wrapper .src-line-numbers",
13+
".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers",
1414
"clientWidth"
1515
)
1616

1717
assert-property: (
18-
".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers",
18+
".more-scraped-examples .scraped-example:nth-child(3) .code-wrapper .src-line-numbers",
1919
{"clientWidth": |clientWidth|}
2020
)
2121

2222
assert-property: (
23-
".more-scraped-examples .scraped-example:nth-child(3) .code-wrapper .src-line-numbers",
23+
".more-scraped-examples .scraped-example:nth-child(4) .code-wrapper .src-line-numbers",
2424
{"clientWidth": |clientWidth|}
2525
)
2626

2727
assert-property: (
28-
".more-scraped-examples .scraped-example:nth-child(4) .code-wrapper .src-line-numbers",
28+
".more-scraped-examples .scraped-example:nth-child(5) .code-wrapper .src-line-numbers",
2929
{"clientWidth": |clientWidth|}
3030
)
3131

3232
assert-property: (
33-
".more-scraped-examples .scraped-example:nth-child(5) .code-wrapper .src-line-numbers",
33+
".more-scraped-examples .scraped-example:nth-child(6) .code-wrapper .src-line-numbers",
3434
{"clientWidth": |clientWidth|}
3535
)

src/test/rustdoc-gui/search-result-color.goml

+15
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ reload:
6666

6767
// Waiting for the search results to appear...
6868
wait-for: "#titles"
69+
assert-css: (
70+
"#titles > button > div.count",
71+
{"color": "rgb(136, 136, 136)"},
72+
ALL,
73+
)
6974
assert-css: (
7075
"//*[@class='desc'][text()='Just a normal struct.']",
7176
{"color": "rgb(197, 197, 197)"},
@@ -178,6 +183,11 @@ reload:
178183

179184
// Waiting for the search results to appear...
180185
wait-for: "#titles"
186+
assert-css: (
187+
"#titles > button > div.count",
188+
{"color": "rgb(136, 136, 136)"},
189+
ALL,
190+
)
181191
assert-css: (
182192
"//*[@class='desc'][text()='Just a normal struct.']",
183193
{"color": "rgb(221, 221, 221)"},
@@ -275,6 +285,11 @@ reload:
275285

276286
// Waiting for the search results to appear...
277287
wait-for: "#titles"
288+
assert-css: (
289+
"#titles > button > div.count",
290+
{"color": "rgb(136, 136, 136)"},
291+
ALL,
292+
)
278293
assert-css: (
279294
"//*[@class='desc'][text()='Just a normal struct.']",
280295
{"color": "rgb(0, 0, 0)"},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// check-pass
2+
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
#![deny(const_evaluatable_unchecked)]
6+
7+
pub struct If<const CONDITION: bool>;
8+
pub trait True {}
9+
impl True for If<true> {}
10+
11+
pub struct FixedI8<const FRAC: u32> {
12+
pub bits: i8,
13+
}
14+
15+
impl<const FRAC_LHS: u32, const FRAC_RHS: u32> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS>
16+
where
17+
If<{ FRAC_RHS <= 8 }>: True,
18+
{
19+
fn eq(&self, _rhs: &FixedI8<FRAC_RHS>) -> bool {
20+
unimplemented!()
21+
}
22+
}
23+
24+
impl<const FRAC: u32> PartialEq<i8> for FixedI8<FRAC> {
25+
fn eq(&self, rhs: &i8) -> bool {
26+
let rhs_as_fixed = FixedI8::<0> { bits: *rhs };
27+
PartialEq::eq(self, &rhs_as_fixed)
28+
}
29+
}
30+
31+
fn main() {}

src/test/ui/consts/issue-104396.rs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// compile-flags: -Zmir-opt-level=3
2+
// check-pass
3+
4+
#![feature(generic_const_exprs)]
5+
//~^ WARN the feature `generic_const_exprs` is incomplete
6+
7+
#[inline(always)]
8+
fn from_fn_1<const N: usize, F: FnMut(usize) -> f32>(mut f: F) -> [f32; N] {
9+
let mut result = [0.0; N];
10+
let mut i = 0;
11+
while i < N {
12+
result[i] = f(i);
13+
i += 1;
14+
}
15+
result
16+
}
17+
18+
pub struct TestArray<const N: usize>
19+
where
20+
[(); N / 2]:,
21+
{
22+
array: [f32; N / 2],
23+
}
24+
25+
impl<const N: usize> TestArray<N>
26+
where
27+
[(); N / 2]:,
28+
{
29+
fn from_fn_2<F: FnMut(usize) -> f32>(f: F) -> Self {
30+
Self { array: from_fn_1(f) }
31+
}
32+
}
33+
34+
fn main() {
35+
TestArray::<4>::from_fn_2(|i| 0.0);
36+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-104396.rs:4:12
3+
|
4+
LL | #![feature(generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: 1 warning emitted
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// incremental
2+
// edition:2021
3+
// compile-flags: -Zdrop-tracking
4+
5+
fn main() {
6+
let _ = async {
7+
let s = std::array::from_fn(|_| ()).await;
8+
//~^ ERROR `[(); _]` is not a future
9+
//~| ERROR type inside `async` block must be known in this context
10+
//~| ERROR type inside `async` block must be known in this context
11+
//~| ERROR type inside `async` block must be known in this context
12+
//~| ERROR type inside `async` block must be known in this context
13+
//~| ERROR type inside `async` block must be known in this context
14+
};
15+
}

0 commit comments

Comments
 (0)