| author | bors <bors@rust-lang.org> 2024-07-22 03:31:16 UTC |
| committer | bors <bors@rust-lang.org> 2024-07-22 03:31:16 UTC |
| log | ee0fd6caf770e8b3baa403b4da3ef0c7e274dc21 |
| tree | 51ba530f78f3619f36a9fc858102ef074270302b |
| parent | 0f8534e79e4cfbda7421017047d1f5021235b0ac |
| parent | fdef1d959202b3269430fff1ac0b5e9dde746b3d |
Rollup of 6 pull requests
Successful merges:
- #127583 (Deal with invalid UTF-8 from `gai_strerror`)
- #128014 (Fix stab display in doc blocks)
- #128020 (Just totally fully deny late-bound consts)
- #128023 (rustdoc: short descriptions cause word-breaks in tables)
- #128033 (Explain why we require `_` for empty patterns)
- #128038 (Don't output incremental test artifacts into working directory)
r? `@ghost`
`@rustbot` modify labels: rollup29 files changed, 172 insertions(+), 57 deletions(-)
.gitignore-1| ... | ... | @@ -50,7 +50,6 @@ build/ |
| 50 | 50 | /target |
| 51 | 51 | /src/bootstrap/target |
| 52 | 52 | /src/tools/x/target |
| 53 | /inc-fat/ | |
| 54 | 53 | # Created by default with `src/ci/docker/run.sh` |
| 55 | 54 | /obj/ |
| 56 | 55 | /rustc-ice* |
compiler/rustc_ast_passes/messages.ftl+3| ... | ... | @@ -120,6 +120,9 @@ ast_passes_fn_without_body = |
| 120 | 120 | ast_passes_forbidden_bound = |
| 121 | 121 | bounds cannot be used in this context |
| 122 | 122 | |
| 123 | ast_passes_forbidden_const_param = | |
| 124 | late-bound const parameters cannot be used currently | |
| 125 | ||
| 123 | 126 | ast_passes_forbidden_default = |
| 124 | 127 | `default` is only allowed on items in trait impls |
| 125 | 128 | .label = `default` because of this |
compiler/rustc_ast_passes/src/errors.rs+7| ... | ... | @@ -69,6 +69,13 @@ pub struct ForbiddenBound { |
| 69 | 69 | pub spans: Vec<Span>, |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | #[derive(Diagnostic)] | |
| 73 | #[diag(ast_passes_forbidden_const_param)] | |
| 74 | pub struct ForbiddenConstParam { | |
| 75 | #[primary_span] | |
| 76 | pub const_param_spans: Vec<Span>, | |
| 77 | } | |
| 78 | ||
| 72 | 79 | #[derive(Diagnostic)] |
| 73 | 80 | #[diag(ast_passes_fn_param_too_many)] |
| 74 | 81 | pub struct FnParamTooMany { |
compiler/rustc_ast_passes/src/feature_gate.rs+16| ... | ... | @@ -162,6 +162,22 @@ impl<'a> PostExpansionVisitor<'a> { |
| 162 | 162 | crate::fluent_generated::ast_passes_forbidden_non_lifetime_param |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | // FIXME(non_lifetime_binders): Const bound params are pretty broken. | |
| 166 | // Let's keep users from using this feature accidentally. | |
| 167 | if self.features.non_lifetime_binders { | |
| 168 | let const_param_spans: Vec<_> = params | |
| 169 | .iter() | |
| 170 | .filter_map(|param| match param.kind { | |
| 171 | ast::GenericParamKind::Const { .. } => Some(param.ident.span), | |
| 172 | _ => None, | |
| 173 | }) | |
| 174 | .collect(); | |
| 175 | ||
| 176 | if !const_param_spans.is_empty() { | |
| 177 | self.sess.dcx().emit_err(errors::ForbiddenConstParam { const_param_spans }); | |
| 178 | } | |
| 179 | } | |
| 180 | ||
| 165 | 181 | for param in params { |
| 166 | 182 | if !param.bounds.is_empty() { |
| 167 | 183 | let spans: Vec<_> = param.bounds.iter().map(|b| b.span()).collect(); |
compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs+1-5| ... | ... | @@ -2094,11 +2094,7 @@ pub fn deny_non_region_late_bound( |
| 2094 | 2094 | format!("late-bound {what} parameter not allowed on {where_}"), |
| 2095 | 2095 | ); |
| 2096 | 2096 | |
| 2097 | let guar = if tcx.features().non_lifetime_binders && first { | |
| 2098 | diag.emit() | |
| 2099 | } else { | |
| 2100 | diag.delay_as_bug() | |
| 2101 | }; | |
| 2097 | let guar = diag.emit_unless(!tcx.features().non_lifetime_binders || !first); | |
| 2102 | 2098 | |
| 2103 | 2099 | first = false; |
| 2104 | 2100 | *arg = ResolvedArg::Error(guar); |
compiler/rustc_mir_build/src/thir/pattern/check_match.rs+20-16| ... | ... | @@ -16,8 +16,8 @@ use rustc_middle::ty::print::with_no_trimmed_paths; |
| 16 | 16 | use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt}; |
| 17 | 17 | use rustc_pattern_analysis::errors::Uncovered; |
| 18 | 18 | use rustc_pattern_analysis::rustc::{ |
| 19 | Constructor, DeconstructedPat, MatchArm, RustcPatCtxt as PatCtxt, Usefulness, UsefulnessReport, | |
| 20 | WitnessPat, | |
| 19 | Constructor, DeconstructedPat, MatchArm, RevealedTy, RustcPatCtxt as PatCtxt, Usefulness, | |
| 20 | UsefulnessReport, WitnessPat, | |
| 21 | 21 | }; |
| 22 | 22 | use rustc_session::lint::builtin::{ |
| 23 | 23 | BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS, |
| ... | ... | @@ -998,27 +998,31 @@ fn report_non_exhaustive_match<'p, 'tcx>( |
| 998 | 998 | err.note(format!("the matched value is of type `{}`", scrut_ty)); |
| 999 | 999 | |
| 1000 | 1000 | if !is_empty_match { |
| 1001 | let mut non_exhaustive_tys = FxIndexSet::default(); | |
| 1001 | let mut special_tys = FxIndexSet::default(); | |
| 1002 | 1002 | // Look at the first witness. |
| 1003 | collect_non_exhaustive_tys(cx, &witnesses[0], &mut non_exhaustive_tys); | |
| 1003 | collect_special_tys(cx, &witnesses[0], &mut special_tys); | |
| 1004 | 1004 | |
| 1005 | for ty in non_exhaustive_tys { | |
| 1005 | for ty in special_tys { | |
| 1006 | 1006 | if ty.is_ptr_sized_integral() { |
| 1007 | if ty == cx.tcx.types.usize { | |
| 1007 | if ty.inner() == cx.tcx.types.usize { | |
| 1008 | 1008 | err.note(format!( |
| 1009 | 1009 | "`{ty}` does not have a fixed maximum value, so half-open ranges are necessary to match \ |
| 1010 | 1010 | exhaustively", |
| 1011 | 1011 | )); |
| 1012 | } else if ty == cx.tcx.types.isize { | |
| 1012 | } else if ty.inner() == cx.tcx.types.isize { | |
| 1013 | 1013 | err.note(format!( |
| 1014 | 1014 | "`{ty}` does not have fixed minimum and maximum values, so half-open ranges are necessary to match \ |
| 1015 | 1015 | exhaustively", |
| 1016 | 1016 | )); |
| 1017 | 1017 | } |
| 1018 | } else if ty == cx.tcx.types.str_ { | |
| 1018 | } else if ty.inner() == cx.tcx.types.str_ { | |
| 1019 | 1019 | err.note("`&str` cannot be matched exhaustively, so a wildcard `_` is necessary"); |
| 1020 | } else if cx.is_foreign_non_exhaustive_enum(cx.reveal_opaque_ty(ty)) { | |
| 1020 | } else if cx.is_foreign_non_exhaustive_enum(ty) { | |
| 1021 | 1021 | err.note(format!("`{ty}` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively")); |
| 1022 | } else if cx.is_uninhabited(ty.inner()) && cx.tcx.features().min_exhaustive_patterns { | |
| 1023 | // The type is uninhabited yet there is a witness: we must be in the `MaybeInvalid` | |
| 1024 | // case. | |
| 1025 | err.note(format!("`{ty}` is uninhabited but is not being matched by value, so a wildcard `_` is required")); | |
| 1022 | 1026 | } |
| 1023 | 1027 | } |
| 1024 | 1028 | } |
| ... | ... | @@ -1168,22 +1172,22 @@ fn joined_uncovered_patterns<'p, 'tcx>( |
| 1168 | 1172 | } |
| 1169 | 1173 | } |
| 1170 | 1174 | |
| 1171 | fn collect_non_exhaustive_tys<'tcx>( | |
| 1175 | /// Collect types that require specific explanations when they show up in witnesses. | |
| 1176 | fn collect_special_tys<'tcx>( | |
| 1172 | 1177 | cx: &PatCtxt<'_, 'tcx>, |
| 1173 | 1178 | pat: &WitnessPat<'_, 'tcx>, |
| 1174 | non_exhaustive_tys: &mut FxIndexSet<Ty<'tcx>>, | |
| 1179 | special_tys: &mut FxIndexSet<RevealedTy<'tcx>>, | |
| 1175 | 1180 | ) { |
| 1176 | if matches!(pat.ctor(), Constructor::NonExhaustive) { | |
| 1177 | non_exhaustive_tys.insert(pat.ty().inner()); | |
| 1181 | if matches!(pat.ctor(), Constructor::NonExhaustive | Constructor::Never) { | |
| 1182 | special_tys.insert(*pat.ty()); | |
| 1178 | 1183 | } |
| 1179 | 1184 | if let Constructor::IntRange(range) = pat.ctor() { |
| 1180 | 1185 | if cx.is_range_beyond_boundaries(range, *pat.ty()) { |
| 1181 | 1186 | // The range denotes the values before `isize::MIN` or the values after `usize::MAX`/`isize::MAX`. |
| 1182 | non_exhaustive_tys.insert(pat.ty().inner()); | |
| 1187 | special_tys.insert(*pat.ty()); | |
| 1183 | 1188 | } |
| 1184 | 1189 | } |
| 1185 | pat.iter_fields() | |
| 1186 | .for_each(|field_pat| collect_non_exhaustive_tys(cx, field_pat, non_exhaustive_tys)) | |
| 1190 | pat.iter_fields().for_each(|field_pat| collect_special_tys(cx, field_pat, special_tys)) | |
| 1187 | 1191 | } |
| 1188 | 1192 | |
| 1189 | 1193 | fn report_adt_defined_here<'tcx>( |
compiler/rustc_pattern_analysis/src/rustc.rs+7-1| ... | ... | @@ -40,9 +40,15 @@ pub type WitnessPat<'p, 'tcx> = crate::pat::WitnessPat<RustcPatCtxt<'p, 'tcx>>; |
| 40 | 40 | /// |
| 41 | 41 | /// Use `.inner()` or deref to get to the `Ty<'tcx>`. |
| 42 | 42 | #[repr(transparent)] |
| 43 | #[derive(Clone, Copy)] | |
| 43 | #[derive(Clone, Copy, PartialEq, Eq, Hash)] | |
| 44 | 44 | pub struct RevealedTy<'tcx>(Ty<'tcx>); |
| 45 | 45 | |
| 46 | impl<'tcx> fmt::Display for RevealedTy<'tcx> { | |
| 47 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { | |
| 48 | self.0.fmt(fmt) | |
| 49 | } | |
| 50 | } | |
| 51 | ||
| 46 | 52 | impl<'tcx> fmt::Debug for RevealedTy<'tcx> { |
| 47 | 53 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 48 | 54 | self.0.fmt(fmt) |
compiler/rustc_resolve/src/late.rs+5-1| ... | ... | @@ -2763,7 +2763,11 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { |
| 2763 | 2763 | let res = match kind { |
| 2764 | 2764 | RibKind::Item(..) | RibKind::AssocItem => Res::Def(def_kind, def_id.to_def_id()), |
| 2765 | 2765 | RibKind::Normal => { |
| 2766 | if self.r.tcx.features().non_lifetime_binders { | |
| 2766 | // FIXME(non_lifetime_binders): Stop special-casing | |
| 2767 | // const params to error out here. | |
| 2768 | if self.r.tcx.features().non_lifetime_binders | |
| 2769 | && matches!(param.kind, GenericParamKind::Type { .. }) | |
| 2770 | { | |
| 2767 | 2771 | Res::Def(def_kind, def_id.to_def_id()) |
| 2768 | 2772 | } else { |
| 2769 | 2773 | Res::Err |
library/std/src/sys/pal/unix/net.rs+3-2| ... | ... | @@ -4,7 +4,6 @@ use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut}; |
| 4 | 4 | use crate::mem; |
| 5 | 5 | use crate::net::{Shutdown, SocketAddr}; |
| 6 | 6 | use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; |
| 7 | use crate::str; | |
| 8 | 7 | use crate::sys::fd::FileDesc; |
| 9 | 8 | use crate::sys::pal::unix::IsMinusOne; |
| 10 | 9 | use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; |
| ... | ... | @@ -47,7 +46,9 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> { |
| 47 | 46 | |
| 48 | 47 | #[cfg(not(target_os = "espidf"))] |
| 49 | 48 | let detail = unsafe { |
| 50 | str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap().to_owned() | |
| 49 | // We can't always expect a UTF-8 environment. When we don't get that luxury, | |
| 50 | // it's better to give a low-quality error message than none at all. | |
| 51 | CStr::from_ptr(libc::gai_strerror(err)).to_string_lossy() | |
| 51 | 52 | }; |
| 52 | 53 | |
| 53 | 54 | #[cfg(target_os = "espidf")] |
src/librustdoc/html/static/css/rustdoc.css+5| ... | ... | @@ -831,6 +831,10 @@ pre, .rustdoc.src .example-wrap { |
| 831 | 831 | 	background: var(--table-alt-row-background-color); |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | .docblock .stab, .docblock-short .stab { | |
| 835 | 	display: inline-block; | |
| 836 | } | |
| 837 | ||
| 834 | 838 | /* "where ..." clauses with block display are also smaller */ |
| 835 | 839 | div.where { |
| 836 | 840 | 	white-space: pre-wrap; |
| ... | ... | @@ -953,6 +957,7 @@ table, |
| 953 | 957 | 	display: table; |
| 954 | 958 | 	padding: 0; |
| 955 | 959 | 	margin: 0; |
| 960 | 	width: 100%; | |
| 956 | 961 | } |
| 957 | 962 | .item-table > li { |
| 958 | 963 | 	display: table-row; |
tests/crashes/127009.rs deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | //@ known-bug: #127009 | |
| 2 | ||
| 3 | #![feature(non_lifetime_binders)] | |
| 4 | ||
| 5 | fn b() | |
| 6 | where | |
| 7 | for<const C: usize> [(); C]: Copy, | |
| 8 | { | |
| 9 | } | |
| 10 | ||
| 11 | fn main() {} |
tests/rustdoc-gui/source-code-page-code-scroll.goml+2-2| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" |
| 3 | 3 | set-window-size: (800, 1000) |
| 4 | 4 | // "scrollWidth" should be superior than "clientWidth". |
| 5 | assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800}) | |
| 5 | assert-property: ("body", {"scrollWidth": 1114, "clientWidth": 800}) | |
| 6 | 6 | |
| 7 | 7 | // Both properties should be equal (ie, no scroll on the code block). |
| 8 | assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933}) | |
| 8 | assert-property: (".example-wrap .rust", {"scrollWidth": 1000, "clientWidth": 1000}) |
tests/rustdoc-gui/src/test_docs/lib.rs+4-4| ... | ... | @@ -20,10 +20,10 @@ Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated |
| 20 | 20 | Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>. |
| 21 | 21 | Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>. |
| 22 | 22 | |
| 23 | Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code> | |
| 24 | </span>. | |
| 25 | Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code> | |
| 26 | </span>. | |
| 23 | Finally, you can use `quz` only on <span class="stab portability" data-span="1"><code>Unix or x86-64 | |
| 24 | </code></span>. | |
| 25 | Finally, you can use `quz` only on <span class="stab portability" data-span="2"><code>Unix or x86-64 | |
| 26 | </code></span>. | |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | use std::convert::AsRef; |
tests/rustdoc-gui/stab-in-doc.goml created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | // This test ensure that `stab` elements if used in doc blocks are not breaking the text layout. | |
| 2 | go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" | |
| 3 | // We make the window wide enough for the two stabs who are looking into to be on the same line. | |
| 4 | set-window-size: (1100, 600) | |
| 5 | compare-elements-position: ( | |
| 6 | ".top-doc .docblock span[data-span='1']", | |
| 7 | ".top-doc .docblock span[data-span='2']", | |
| 8 | ["y"], | |
| 9 | ) |
tests/ui/closures/binder/const-bound.rs+2-1| ... | ... | @@ -3,5 +3,6 @@ |
| 3 | 3 | |
| 4 | 4 | fn main() { |
| 5 | 5 | for<const N: i32> || -> () {}; |
| 6 | //~^ ERROR late-bound const parameter not allowed on closures | |
| 6 | //~^ ERROR late-bound const parameters cannot be used currently | |
| 7 | //~| ERROR late-bound const parameter not allowed on closures | |
| 7 | 8 | } |
tests/ui/closures/binder/const-bound.stderr+7-1| ... | ... | @@ -1,3 +1,9 @@ |
| 1 | error: late-bound const parameters cannot be used currently | |
| 2 | --> $DIR/const-bound.rs:5:15 | |
| 3 | | | |
| 4 | LL | for<const N: i32> || -> () {}; | |
| 5 | | ^ | |
| 6 | ||
| 1 | 7 | warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes |
| 2 | 8 | --> $DIR/const-bound.rs:1:37 |
| 3 | 9 | | |
| ... | ... | @@ -13,5 +19,5 @@ error: late-bound const parameter not allowed on closures |
| 13 | 19 | LL | for<const N: i32> || -> () {}; |
| 14 | 20 | | ^^^^^^^^^^^^ |
| 15 | 21 | |
| 16 | error: aborting due to 1 previous error; 1 warning emitted | |
| 22 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 17 | 23 |
tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.rs+2-1| ... | ... | @@ -7,7 +7,8 @@ |
| 7 | 7 | pub fn foo() |
| 8 | 8 | where |
| 9 | 9 | for<const N: usize = { const fn bar() {} bar(); 1 }> ():, |
| 10 | //~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 10 | //~^ ERROR late-bound const parameters cannot be used currently | |
| 11 | //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 11 | 12 | {} |
| 12 | 13 | |
| 13 | 14 | fn main() {} |
tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.stderr+7-1| ... | ... | @@ -1,8 +1,14 @@ |
| 1 | error: late-bound const parameters cannot be used currently | |
| 2 | --> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:15 | |
| 3 | | | |
| 4 | LL | for<const N: usize = { const fn bar() {} bar(); 1 }> ():, | |
| 5 | | ^ | |
| 6 | ||
| 1 | 7 | error: defaults for generic parameters are not allowed in `for<...>` binders |
| 2 | 8 | --> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:9 |
| 3 | 9 | | |
| 4 | 10 | LL | for<const N: usize = { const fn bar() {} bar(); 1 }> ():, |
| 5 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 12 | |
| 7 | error: aborting due to 1 previous error | |
| 13 | error: aborting due to 2 previous errors | |
| 8 | 14 |
tests/ui/lto/debuginfo-lto-alloc.rs+2-1| ... | ... | @@ -9,7 +9,8 @@ |
| 9 | 9 | // that compilation is successful. |
| 10 | 10 | |
| 11 | 11 | //@ check-pass |
| 12 | //@ compile-flags: --test -C debuginfo=2 -C lto=fat -C incremental=inc-fat | |
| 12 | //@ compile-flags: --test -C debuginfo=2 -C lto=fat | |
| 13 | //@ incremental | |
| 13 | 14 | |
| 14 | 15 | extern crate alloc; |
| 15 | 16 |
tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr+9| ... | ... | @@ -204,6 +204,7 @@ note: `Option<Void>` defined here |
| 204 | 204 | | |
| 205 | 205 | = note: not covered |
| 206 | 206 | = note: the matched value is of type `Option<Void>` |
| 207 | = note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 207 | 208 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 208 | 209 | | |
| 209 | 210 | LL ~ None => {}, |
| ... | ... | @@ -349,6 +350,7 @@ LL | match slice_never { |
| 349 | 350 | | ^^^^^^^^^^^ pattern `&[_, ..]` not covered |
| 350 | 351 | | |
| 351 | 352 | = note: the matched value is of type `&[!]` |
| 353 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 352 | 354 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 353 | 355 | | |
| 354 | 356 | LL ~ [] => {}, |
| ... | ... | @@ -484,6 +486,7 @@ note: `Option<!>` defined here |
| 484 | 486 | | |
| 485 | 487 | = note: not covered |
| 486 | 488 | = note: the matched value is of type `&Option<!>` |
| 489 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 487 | 490 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 488 | 491 | | |
| 489 | 492 | LL ~ &None => {}, |
| ... | ... | @@ -502,6 +505,7 @@ note: `Option<!>` defined here |
| 502 | 505 | | |
| 503 | 506 | = note: not covered |
| 504 | 507 | = note: the matched value is of type `Option<!>` |
| 508 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 505 | 509 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 506 | 510 | | |
| 507 | 511 | LL ~ None => {}, |
| ... | ... | @@ -520,6 +524,7 @@ note: `Result<!, !>` defined here |
| 520 | 524 | | |
| 521 | 525 | = note: not covered |
| 522 | 526 | = note: the matched value is of type `Result<!, !>` |
| 527 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 523 | 528 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 524 | 529 | | |
| 525 | 530 | LL ~ Ok(_) => {}, |
| ... | ... | @@ -538,6 +543,7 @@ note: `Result<!, !>` defined here |
| 538 | 543 | | |
| 539 | 544 | = note: not covered |
| 540 | 545 | = note: the matched value is of type `Result<!, !>` |
| 546 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 541 | 547 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 542 | 548 | | |
| 543 | 549 | LL ~ Ok(_a) => {}, |
| ... | ... | @@ -589,6 +595,7 @@ LL | match ref_never { |
| 589 | 595 | | ^^^^^^^^^ pattern `&_` not covered |
| 590 | 596 | | |
| 591 | 597 | = note: the matched value is of type `&!` |
| 598 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 592 | 599 | = note: references are always considered inhabited |
| 593 | 600 | = note: match arms with guards don't count towards exhaustivity |
| 594 | 601 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| ... | ... | @@ -609,6 +616,7 @@ note: `Result<!, !>` defined here |
| 609 | 616 | | |
| 610 | 617 | = note: not covered |
| 611 | 618 | = note: the matched value is of type `Result<!, !>` |
| 619 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 612 | 620 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 613 | 621 | | |
| 614 | 622 | LL ~ Err(_) => {}, |
| ... | ... | @@ -627,6 +635,7 @@ note: `Option<Result<!, !>>` defined here |
| 627 | 635 | | |
| 628 | 636 | = note: not covered |
| 629 | 637 | = note: the matched value is of type `Option<Result<!, !>>` |
| 638 | = note: `Result<!, !>` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 630 | 639 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 631 | 640 | | |
| 632 | 641 | LL ~ None => {}, |
tests/ui/pattern/usefulness/slice_of_empty.min_exhaustive_patterns.stderr+1| ... | ... | @@ -5,6 +5,7 @@ LL | match nevers { |
| 5 | 5 | | ^^^^^^ pattern `&[_, ..]` not covered |
| 6 | 6 | | |
| 7 | 7 | = note: the matched value is of type `&[!]` |
| 8 | = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required | |
| 8 | 9 | help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown |
| 9 | 10 | | |
| 10 | 11 | LL ~ &[] => (), |
tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.rs+2-1| ... | ... | @@ -18,7 +18,8 @@ trait TraitC {} |
| 18 | 18 | fn foo<T>() |
| 19 | 19 | where |
| 20 | 20 | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>, |
| 21 | //~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 21 | //~^ ERROR late-bound const parameters cannot be used currently | |
| 22 | //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 22 | 23 | //~| ERROR `impl Trait` is not allowed in bounds |
| 23 | 24 | { |
| 24 | 25 | } |
tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.stderr+7-1| ... | ... | @@ -1,3 +1,9 @@ |
| 1 | error: late-bound const parameters cannot be used currently | |
| 2 | --> $DIR/bad-suggestion-on-missing-assoc.rs:20:15 | |
| 3 | | | |
| 4 | LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>, | |
| 5 | | ^ | |
| 6 | ||
| 1 | 7 | warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes |
| 2 | 8 | --> $DIR/bad-suggestion-on-missing-assoc.rs:1:12 |
| 3 | 9 | | |
| ... | ... | @@ -29,6 +35,6 @@ LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl Trai |
| 29 | 35 | | |
| 30 | 36 | = note: `impl Trait` is only allowed in arguments and return types of functions and methods |
| 31 | 37 | |
| 32 | error: aborting due to 2 previous errors; 2 warnings emitted | |
| 38 | error: aborting due to 3 previous errors; 2 warnings emitted | |
| 33 | 39 | |
| 34 | 40 | For more information about this error, try `rustc --explain E0562`. |
tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs+3-2| ... | ... | @@ -4,10 +4,11 @@ |
| 4 | 4 | pub fn bar() |
| 5 | 5 | where |
| 6 | 6 | for<const N: usize = { |
| 7 | //~^ ERROR late-bound const parameters cannot be used currently | |
| 8 | //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 7 | 9 | (||1usize)() |
| 8 | 10 | }> V: IntoIterator |
| 9 | //~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 10 | //~^^ ERROR cannot find type `V` in this scope | |
| 11 | //~^ ERROR cannot find type `V` in this scope | |
| 11 | 12 | { |
| 12 | 13 | } |
| 13 | 14 |
tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr+10-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | error[E0412]: cannot find type `V` in this scope |
| 2 | --> $DIR/binder-defaults-112547.rs:8:4 | |
| 2 | --> $DIR/binder-defaults-112547.rs:10:4 | |
| 3 | 3 | | |
| 4 | 4 | LL | }> V: IntoIterator |
| 5 | 5 | | ^ not found in this scope |
| ... | ... | @@ -9,6 +9,12 @@ help: you might be missing a type parameter |
| 9 | 9 | LL | pub fn bar<V>() |
| 10 | 10 | | +++ |
| 11 | 11 | |
| 12 | error: late-bound const parameters cannot be used currently | |
| 13 | --> $DIR/binder-defaults-112547.rs:6:15 | |
| 14 | | | |
| 15 | LL | for<const N: usize = { | |
| 16 | | ^ | |
| 17 | ||
| 12 | 18 | warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes |
| 13 | 19 | --> $DIR/binder-defaults-112547.rs:1:12 |
| 14 | 20 | | |
| ... | ... | @@ -23,10 +29,12 @@ error: defaults for generic parameters are not allowed in `for<...>` binders |
| 23 | 29 | | |
| 24 | 30 | LL | for<const N: usize = { |
| 25 | 31 | | _________^ |
| 32 | LL | | | |
| 33 | LL | | | |
| 26 | 34 | LL | | (||1usize)() |
| 27 | 35 | LL | | }> V: IntoIterator |
| 28 | 36 | | |_^ |
| 29 | 37 | |
| 30 | error: aborting due to 2 previous errors; 1 warning emitted | |
| 38 | error: aborting due to 3 previous errors; 1 warning emitted | |
| 31 | 39 | |
| 32 | 40 | For more information about this error, try `rustc --explain E0412`. |
tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs+3-2| ... | ... | @@ -5,8 +5,9 @@ |
| 5 | 5 | fn fun() |
| 6 | 6 | where |
| 7 | 7 | for<T = (), const N: usize = 1> ():, |
| 8 | //~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 9 | //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 8 | //~^ ERROR late-bound const parameters cannot be used currently | |
| 9 | //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 10 | //~| ERROR defaults for generic parameters are not allowed in `for<...>` binders | |
| 10 | 11 | {} |
| 11 | 12 | |
| 12 | 13 | fn main() {} |
tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr+7-1| ... | ... | @@ -1,3 +1,9 @@ |
| 1 | error: late-bound const parameters cannot be used currently | |
| 2 | --> $DIR/binder-defaults-119489.rs:7:23 | |
| 3 | | | |
| 4 | LL | for<T = (), const N: usize = 1> ():, | |
| 5 | | ^ | |
| 6 | ||
| 1 | 7 | warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes |
| 2 | 8 | --> $DIR/binder-defaults-119489.rs:1:12 |
| 3 | 9 | | |
| ... | ... | @@ -27,5 +33,5 @@ error: defaults for generic parameters are not allowed in `for<...>` binders |
| 27 | 33 | LL | for<T = (), const N: usize = 1> ():, |
| 28 | 34 | | ^^^^^^^^^^^^^^^^^^ |
| 29 | 35 | |
| 30 | error: aborting due to 2 previous errors; 2 warnings emitted | |
| 36 | error: aborting due to 3 previous errors; 2 warnings emitted | |
| 31 | 37 |
tests/ui/traits/non_lifetime_binders/late-const-param-wf.rs created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | #![feature(non_lifetime_binders)] | |
| 2 | //~^ WARN the feature `non_lifetime_binders` is incomplete | |
| 3 | ||
| 4 | fn b() | |
| 5 | where | |
| 6 | for<const C: usize> [(); C]: Copy, | |
| 7 | //~^ ERROR late-bound const parameters cannot be used currently | |
| 8 | { | |
| 9 | } | |
| 10 | ||
| 11 | fn main() {} |
tests/ui/traits/non_lifetime_binders/late-const-param-wf.stderr created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | error: late-bound const parameters cannot be used currently | |
| 2 | --> $DIR/late-const-param-wf.rs:6:15 | |
| 3 | | | |
| 4 | LL | for<const C: usize> [(); C]: Copy, | |
| 5 | | ^ | |
| 6 | ||
| 7 | warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes | |
| 8 | --> $DIR/late-const-param-wf.rs:1:12 | |
| 9 | | | |
| 10 | LL | #![feature(non_lifetime_binders)] | |
| 11 | | ^^^^^^^^^^^^^^^^^^^^ | |
| 12 | | | |
| 13 | = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information | |
| 14 | = note: `#[warn(incomplete_features)]` on by default | |
| 15 | ||
| 16 | error: aborting due to 1 previous error; 1 warning emitted | |
| 17 |