From 295f5f514bf423e79ad67ed99c6d90944b299c10 Mon Sep 17 00:00:00 2001 From: Tim Neumann Date: Sun, 11 Dec 2022 19:05:37 +0000 Subject: [PATCH 1/8] KCFI test: Also support LLVM 16 output --- ...izer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs index 0afd9727517ed..8e0d02550ee94 100644 --- a/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -20,24 +20,21 @@ impl Copy for i32 {} pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo - // FIXME(rcvalle): Change to !kcfi_type when Rust is updated to LLVM 16 - // CHECK-SAME: {{.*}}! ![[TYPE1:[0-9]+]] + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE1:[0-9]+]] // CHECK: call i32 %f(i32 %arg){{.*}}[ "kcfi"(i32 -1666898348) ] f(arg) } pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { // CHECK-LABEL: define{{.*}}bar - // FIXME(rcvalle): Change to !kcfi_type when Rust is updated to LLVM 16 - // CHECK-SAME: {{.*}}! ![[TYPE2:[0-9]+]] + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE2:[0-9]+]] // CHECK: call i32 %f(i32 %arg1, i32 %arg2){{.*}}[ "kcfi"(i32 -1789026986) ] f(arg1, arg2) } pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { // CHECK-LABEL: define{{.*}}baz - // FIXME(rcvalle): Change to !kcfi_type when Rust is updated to LLVM 16 - // CHECK-SAME: {{.*}}! ![[TYPE3:[0-9]+]] + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE3:[0-9]+]] // CHECK: call i32 %f(i32 %arg1, i32 %arg2, i32 %arg3){{.*}}[ "kcfi"(i32 1248878270) ] f(arg1, arg2, arg3) } From c1181e12243f078b1cc562249569e6766d90f8f6 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 17 Dec 2022 22:32:57 +0000 Subject: [PATCH 2/8] Ensure param-env is const before calling eval_to_valtree --- .../rustc_const_eval/src/interpret/operand.rs | 6 ++-- src/test/ui/consts/issue-104396.rs | 36 +++++++++++++++++++ src/test/ui/consts/issue-104396.stderr | 11 ++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/consts/issue-104396.rs create mode 100644 src/test/ui/consts/issue-104396.stderr diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 221e359d24ab8..5bc2e3dd4fc60 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -569,8 +569,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ty::ConstKind::Unevaluated(uv) => { let instance = self.resolve(uv.def, uv.substs)?; let cid = GlobalId { instance, promoted: None }; - self.ctfe_query(span, |tcx| tcx.eval_to_valtree(self.param_env.and(cid)))? - .unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}")) + self.ctfe_query(span, |tcx| { + tcx.eval_to_valtree(self.param_env.with_const().and(cid)) + })? + .unwrap_or_else(|| bug!("unable to create ValTree for {uv:?}")) } ty::ConstKind::Bound(..) | ty::ConstKind::Infer(..) => { span_bug!(self.cur_span(), "unexpected ConstKind in ctfe: {val:?}") diff --git a/src/test/ui/consts/issue-104396.rs b/src/test/ui/consts/issue-104396.rs new file mode 100644 index 0000000000000..315b0cf0fd6bf --- /dev/null +++ b/src/test/ui/consts/issue-104396.rs @@ -0,0 +1,36 @@ +// compile-flags: -Zmir-opt-level=3 +// check-pass + +#![feature(generic_const_exprs)] +//~^ WARN the feature `generic_const_exprs` is incomplete + +#[inline(always)] +fn from_fn_1 f32>(mut f: F) -> [f32; N] { + let mut result = [0.0; N]; + let mut i = 0; + while i < N { + result[i] = f(i); + i += 1; + } + result +} + +pub struct TestArray +where + [(); N / 2]:, +{ + array: [f32; N / 2], +} + +impl TestArray +where + [(); N / 2]:, +{ + fn from_fn_2 f32>(f: F) -> Self { + Self { array: from_fn_1(f) } + } +} + +fn main() { + TestArray::<4>::from_fn_2(|i| 0.0); +} diff --git a/src/test/ui/consts/issue-104396.stderr b/src/test/ui/consts/issue-104396.stderr new file mode 100644 index 0000000000000..5856bee09a3fc --- /dev/null +++ b/src/test/ui/consts/issue-104396.stderr @@ -0,0 +1,11 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-104396.rs:4:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + From 2f5334dff2cf7be2f1cc33565c55925b58950694 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 21 Dec 2022 05:03:11 +0000 Subject: [PATCH 3/8] forgot a return in drop tracking handle_uninhabited_return --- .../drop_ranges/cfg_build.rs | 1 + ...=> unresolved-ct-var.drop_tracking.stderr} | 22 +++--- src/test/ui/generator/unresolved-ct-var.rs | 2 + .../generator/unresolved-ct-var.stock.stderr | 78 +++++++++++++++++++ 4 files changed, 92 insertions(+), 11 deletions(-) rename src/test/ui/generator/{unresolved-ct-var.stderr => unresolved-ct-var.drop_tracking.stderr} (88%) create mode 100644 src/test/ui/generator/unresolved-ct-var.stock.stderr diff --git a/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs b/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs index fd8ea1ad7bff4..16806fdba4fbc 100644 --- a/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs +++ b/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs @@ -233,6 +233,7 @@ impl<'a, 'tcx> DropRangeVisitor<'a, 'tcx> { self.tcx() .sess .delay_span_bug(expr.span, format!("could not resolve infer vars in `{ty}`")); + return; } let ty = self.tcx().erase_regions(ty); let m = self.tcx().parent_module(expr.hir_id).to_def_id(); diff --git a/src/test/ui/generator/unresolved-ct-var.stderr b/src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr similarity index 88% rename from src/test/ui/generator/unresolved-ct-var.stderr rename to src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr index fdf00dfad7ab7..a328c43765db2 100644 --- a/src/test/ui/generator/unresolved-ct-var.stderr +++ b/src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr @@ -1,5 +1,5 @@ error[E0277]: `[(); _]` is not a future - --> $DIR/unresolved-ct-var.rs:6:44 + --> $DIR/unresolved-ct-var.rs:8:44 | LL | let s = std::array::from_fn(|_| ()).await; | ---------------------------^^^^^^ @@ -13,61 +13,61 @@ LL | let s = std::array::from_fn(|_| ()).await; = note: required for `[(); _]` to implement `IntoFuture` error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 + --> $DIR/unresolved-ct-var.rs:8:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:44 + --> $DIR/unresolved-ct-var.rs:8:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 + --> $DIR/unresolved-ct-var.rs:8:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:44 + --> $DIR/unresolved-ct-var.rs:8:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 + --> $DIR/unresolved-ct-var.rs:8:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:44 + --> $DIR/unresolved-ct-var.rs:8:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 + --> $DIR/unresolved-ct-var.rs:8:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:44 + --> $DIR/unresolved-ct-var.rs:8:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:6:17 + --> $DIR/unresolved-ct-var.rs:8:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:6:44 + --> $DIR/unresolved-ct-var.rs:8:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ diff --git a/src/test/ui/generator/unresolved-ct-var.rs b/src/test/ui/generator/unresolved-ct-var.rs index 0a1570fc2395e..6720f46588723 100644 --- a/src/test/ui/generator/unresolved-ct-var.rs +++ b/src/test/ui/generator/unresolved-ct-var.rs @@ -1,5 +1,7 @@ // incremental // edition:2021 +// revisions: drop_tracking stock +//[drop_tracking] compile-flags: -Zdrop-tracking fn main() { let _ = async { diff --git a/src/test/ui/generator/unresolved-ct-var.stock.stderr b/src/test/ui/generator/unresolved-ct-var.stock.stderr new file mode 100644 index 0000000000000..a328c43765db2 --- /dev/null +++ b/src/test/ui/generator/unresolved-ct-var.stock.stderr @@ -0,0 +1,78 @@ +error[E0277]: `[(); _]` is not a future + --> $DIR/unresolved-ct-var.rs:8:44 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ---------------------------^^^^^^ + | | | + | | `[(); _]` is not a future + | | help: remove the `.await` + | this call returns `[(); _]` + | + = help: the trait `Future` is not implemented for `[(); _]` + = note: [(); _] must be a future or must implement `IntoFuture` to be awaited + = note: required for `[(); _]` to implement `IntoFuture` + +error[E0698]: type inside `async` block must be known in this context + --> $DIR/unresolved-ct-var.rs:8:17 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` + | +note: the type is part of the `async` block because of this `await` + --> $DIR/unresolved-ct-var.rs:8:44 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^ + +error[E0698]: type inside `async` block must be known in this context + --> $DIR/unresolved-ct-var.rs:8:17 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` + | +note: the type is part of the `async` block because of this `await` + --> $DIR/unresolved-ct-var.rs:8:44 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^ + +error[E0698]: type inside `async` block must be known in this context + --> $DIR/unresolved-ct-var.rs:8:17 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` + | +note: the type is part of the `async` block because of this `await` + --> $DIR/unresolved-ct-var.rs:8:44 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^ + +error[E0698]: type inside `async` block must be known in this context + --> $DIR/unresolved-ct-var.rs:8:17 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` + | +note: the type is part of the `async` block because of this `await` + --> $DIR/unresolved-ct-var.rs:8:44 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^ + +error[E0698]: type inside `async` block must be known in this context + --> $DIR/unresolved-ct-var.rs:8:17 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` + | +note: the type is part of the `async` block because of this `await` + --> $DIR/unresolved-ct-var.rs:8:44 + | +LL | let s = std::array::from_fn(|_| ()).await; + | ^^^^^^ + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0277, E0698. +For more information about an error, try `rustc --explain E0277`. From 2b661c33de0b3bc96b47915f589c74d71a755998 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 21 Dec 2022 18:03:31 -0700 Subject: [PATCH 4/8] rustdoc: simplify CSS and DOM for more-scraped-examples This gets rid of the more-scraped-examples-inner wrapper, instead nesting the children directly and using absolute positioning for the toggle line. --- src/librustdoc/html/render/mod.rs | 5 ++--- src/librustdoc/html/static/css/rustdoc.css | 17 ++++++----------- .../rustdoc-gui/scrape-examples-layout.goml | 10 +++++----- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 146e5010e4e42..8bccf68029aa3 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -3005,8 +3005,7 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite \
Hide additional examples
\
\ -
\ -
" +
" ); // 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 write!(w, "
"); } - write!(w, "
"); + write!(w, ""); } write!(w, ""); diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b2f220b057110..21dc3eac5564e 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1991,20 +1991,15 @@ in storage.js } .more-scraped-examples { - margin-left: 5px; - display: flex; - flex-direction: row; -} - -.more-scraped-examples-inner { - /* 20px is width of toggle-line + toggle-line-inner */ - width: calc(100% - 20px); + margin-left: 25px; + position: relative; } .toggle-line { - align-self: stretch; - margin-right: 10px; - margin-top: 5px; + position: absolute; + top: 5px; + bottom: 0; + right: calc(100% + 10px); padding: 0 4px; cursor: pointer; } diff --git a/src/test/rustdoc-gui/scrape-examples-layout.goml b/src/test/rustdoc-gui/scrape-examples-layout.goml index 988c911b7839a..fde9a0ab0bc30 100644 --- a/src/test/rustdoc-gui/scrape-examples-layout.goml +++ b/src/test/rustdoc-gui/scrape-examples-layout.goml @@ -10,26 +10,26 @@ assert-property-false: ( // Check that examples with very long lines have the same width as ones that don't. store-property: ( clientWidth, - ".more-scraped-examples .scraped-example:nth-child(1) .code-wrapper .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers", "clientWidth" ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(3) .code-wrapper .src-line-numbers", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(3) .code-wrapper .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(4) .code-wrapper .src-line-numbers", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(4) .code-wrapper .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(5) .code-wrapper .src-line-numbers", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(5) .code-wrapper .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(6) .code-wrapper .src-line-numbers", {"clientWidth": |clientWidth|} ) From 33ff610d1355832dd82bd5dc926e836eb8cf8d41 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 22 Dec 2022 11:38:39 +0100 Subject: [PATCH 5/8] Migrate search tab title color to CSS variable --- src/librustdoc/html/static/css/rustdoc.css | 1 + src/librustdoc/html/static/css/themes/ayu.css | 5 +---- src/librustdoc/html/static/css/themes/dark.css | 5 +---- src/librustdoc/html/static/css/themes/light.css | 5 +---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 022ed606cc3b8..1bca973bf7171 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1287,6 +1287,7 @@ a.test-arrow:hover { #titles > button > div.count { display: inline-block; font-size: 1rem; + color: var(--search-tab-title-count-color); } #src-sidebar-toggle { diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index de0dfcd469045..1355ae9c2bacd 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -45,6 +45,7 @@ Original by Dempfi (https://github.com/dempfi/ayu) --search-color: #fff; --search-results-alias-color: #c5c5c5; --search-results-grey-color: #999; + --search-tab-title-count-color: #888; --stab-background-color: #314559; --stab-code-color: #e6e1cf; --code-highlight-kw-color: #ff7733; @@ -175,10 +176,6 @@ pre, .rustdoc.source .example-wrap { border-bottom: 1px solid rgba(242, 151, 24, 0.3); } -#titles > button > div.count { - color: #888; -} - /* rules that this theme does not need to set, here to satisfy the rule checker */ /* note that a lot of these are partially set in some way (meaning they are set individually rather than as a group) */ diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index dd7fc6892537c..84449542f22bf 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -40,6 +40,7 @@ --search-color: #111; --search-results-alias-color: #fff; --search-results-grey-color: #ccc; + --search-tab-title-count-color: #888; --stab-background-color: #314559; --stab-code-color: #e6e1cf; --code-highlight-kw-color: #ab8ac1; @@ -96,10 +97,6 @@ background-color: #353535; } -#titles > button > div.count { - color: #888; -} - .scraped-example-list .scrape-help { border-color: #aaa; color: #eee; diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index b69d8a1cff957..68dc0ce539b05 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -40,6 +40,7 @@ --search-color: #000; --search-results-alias-color: #000; --search-results-grey-color: #999; + --search-tab-title-count-color: #888; --stab-background-color: #fff5d6; --stab-code-color: #000; --code-highlight-kw-color: #8959a8; @@ -93,10 +94,6 @@ border-top-color: #0089ff; } -#titles > button > div.count { - color: #888; -} - .scraped-example-list .scrape-help { border-color: #555; color: #333; From faebd7a788fd9f04743805b557a5321ee13bfbb0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 22 Dec 2022 11:38:59 +0100 Subject: [PATCH 6/8] Extend search GUI test to include search tab title color check --- src/test/rustdoc-gui/search-result-color.goml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml index dde43b1c980af..d124045608c12 100644 --- a/src/test/rustdoc-gui/search-result-color.goml +++ b/src/test/rustdoc-gui/search-result-color.goml @@ -66,6 +66,11 @@ reload: // Waiting for the search results to appear... wait-for: "#titles" +assert-css: ( + "#titles > button > div.count", + {"color": "rgb(136, 136, 136)"}, + ALL, +) assert-css: ( "//*[@class='desc'][text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"}, @@ -178,6 +183,11 @@ reload: // Waiting for the search results to appear... wait-for: "#titles" +assert-css: ( + "#titles > button > div.count", + {"color": "rgb(136, 136, 136)"}, + ALL, +) assert-css: ( "//*[@class='desc'][text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"}, @@ -275,6 +285,11 @@ reload: // Waiting for the search results to appear... wait-for: "#titles" +assert-css: ( + "#titles > button > div.count", + {"color": "rgb(136, 136, 136)"}, + ALL, +) assert-css: ( "//*[@class='desc'][text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"}, From 34ae96868fcbdb2d2fa4a0b269fab94279c13e6b Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 22 Dec 2022 20:29:20 +0900 Subject: [PATCH 7/8] Add regression test for #94293 Signed-off-by: Yuki Okushi --- .../generic_const_exprs/issue-94293.rs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-94293.rs diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-94293.rs b/src/test/ui/const-generics/generic_const_exprs/issue-94293.rs new file mode 100644 index 0000000000000..713c5d89a9300 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-94293.rs @@ -0,0 +1,31 @@ +// check-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] +#![deny(const_evaluatable_unchecked)] + +pub struct If; +pub trait True {} +impl True for If {} + +pub struct FixedI8 { + pub bits: i8, +} + +impl PartialEq> for FixedI8 +where + If<{ FRAC_RHS <= 8 }>: True, +{ + fn eq(&self, _rhs: &FixedI8) -> bool { + unimplemented!() + } +} + +impl PartialEq for FixedI8 { + fn eq(&self, rhs: &i8) -> bool { + let rhs_as_fixed = FixedI8::<0> { bits: *rhs }; + PartialEq::eq(self, &rhs_as_fixed) + } +} + +fn main() {} From 51ba7b4e43179f1262c7684ad3c0a04ddb703e9d Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 22 Dec 2022 17:51:45 +0000 Subject: [PATCH 8/8] Use separate files instead of revisions --- .../unresolved-ct-var-drop-tracking.rs | 15 +++++++++++++ ...=> unresolved-ct-var-drop-tracking.stderr} | 22 +++++++++---------- src/test/ui/generator/unresolved-ct-var.rs | 2 -- ...acking.stderr => unresolved-ct-var.stderr} | 22 +++++++++---------- 4 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 src/test/ui/generator/unresolved-ct-var-drop-tracking.rs rename src/test/ui/generator/{unresolved-ct-var.stock.stderr => unresolved-ct-var-drop-tracking.stderr} (84%) rename src/test/ui/generator/{unresolved-ct-var.drop_tracking.stderr => unresolved-ct-var.stderr} (88%) diff --git a/src/test/ui/generator/unresolved-ct-var-drop-tracking.rs b/src/test/ui/generator/unresolved-ct-var-drop-tracking.rs new file mode 100644 index 0000000000000..a6589348d301e --- /dev/null +++ b/src/test/ui/generator/unresolved-ct-var-drop-tracking.rs @@ -0,0 +1,15 @@ +// incremental +// edition:2021 +// compile-flags: -Zdrop-tracking + +fn main() { + let _ = async { + let s = std::array::from_fn(|_| ()).await; + //~^ ERROR `[(); _]` is not a future + //~| ERROR type inside `async` block must be known in this context + //~| ERROR type inside `async` block must be known in this context + //~| ERROR type inside `async` block must be known in this context + //~| ERROR type inside `async` block must be known in this context + //~| ERROR type inside `async` block must be known in this context + }; +} diff --git a/src/test/ui/generator/unresolved-ct-var.stock.stderr b/src/test/ui/generator/unresolved-ct-var-drop-tracking.stderr similarity index 84% rename from src/test/ui/generator/unresolved-ct-var.stock.stderr rename to src/test/ui/generator/unresolved-ct-var-drop-tracking.stderr index a328c43765db2..9e1fed54c548a 100644 --- a/src/test/ui/generator/unresolved-ct-var.stock.stderr +++ b/src/test/ui/generator/unresolved-ct-var-drop-tracking.stderr @@ -1,5 +1,5 @@ error[E0277]: `[(); _]` is not a future - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44 | LL | let s = std::array::from_fn(|_| ()).await; | ---------------------------^^^^^^ @@ -13,61 +13,61 @@ LL | let s = std::array::from_fn(|_| ()).await; = note: required for `[(); _]` to implement `IntoFuture` error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ diff --git a/src/test/ui/generator/unresolved-ct-var.rs b/src/test/ui/generator/unresolved-ct-var.rs index 6720f46588723..0a1570fc2395e 100644 --- a/src/test/ui/generator/unresolved-ct-var.rs +++ b/src/test/ui/generator/unresolved-ct-var.rs @@ -1,7 +1,5 @@ // incremental // edition:2021 -// revisions: drop_tracking stock -//[drop_tracking] compile-flags: -Zdrop-tracking fn main() { let _ = async { diff --git a/src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr b/src/test/ui/generator/unresolved-ct-var.stderr similarity index 88% rename from src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr rename to src/test/ui/generator/unresolved-ct-var.stderr index a328c43765db2..fdf00dfad7ab7 100644 --- a/src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr +++ b/src/test/ui/generator/unresolved-ct-var.stderr @@ -1,5 +1,5 @@ error[E0277]: `[(); _]` is not a future - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var.rs:6:44 | LL | let s = std::array::from_fn(|_| ()).await; | ---------------------------^^^^^^ @@ -13,61 +13,61 @@ LL | let s = std::array::from_fn(|_| ()).await; = note: required for `[(); _]` to implement `IntoFuture` error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var.rs:6:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var.rs:6:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var.rs:6:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var.rs:6:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var.rs:6:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var.rs:6:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var.rs:6:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var.rs:6:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^ error[E0698]: type inside `async` block must be known in this context - --> $DIR/unresolved-ct-var.rs:8:17 + --> $DIR/unresolved-ct-var.rs:6:17 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn` | note: the type is part of the `async` block because of this `await` - --> $DIR/unresolved-ct-var.rs:8:44 + --> $DIR/unresolved-ct-var.rs:6:44 | LL | let s = std::array::from_fn(|_| ()).await; | ^^^^^^