authorbors <bors@rust-lang.org> 2024-07-22 03:31:16 UTC
committerbors <bors@rust-lang.org> 2024-07-22 03:31:16 UTC
logee0fd6caf770e8b3baa403b4da3ef0c7e274dc21
tree51ba530f78f3619f36a9fc858102ef074270302b
parent0f8534e79e4cfbda7421017047d1f5021235b0ac
parentfdef1d959202b3269430fff1ac0b5e9dde746b3d

Auto merge of #128048 - workingjubilee:rollup-gehtjxd, r=workingjubilee

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: rollup

29 files changed, 172 insertions(+), 57 deletions(-)

.gitignore-1
......@@ -50,7 +50,6 @@ build/
5050/target
5151/src/bootstrap/target
5252/src/tools/x/target
53/inc-fat/
5453# Created by default with `src/ci/docker/run.sh`
5554/obj/
5655/rustc-ice*
compiler/rustc_ast_passes/messages.ftl+3
......@@ -120,6 +120,9 @@ ast_passes_fn_without_body =
120120ast_passes_forbidden_bound =
121121 bounds cannot be used in this context
122122
123ast_passes_forbidden_const_param =
124 late-bound const parameters cannot be used currently
125
123126ast_passes_forbidden_default =
124127 `default` is only allowed on items in trait impls
125128 .label = `default` because of this
compiler/rustc_ast_passes/src/errors.rs+7
......@@ -69,6 +69,13 @@ pub struct ForbiddenBound {
6969 pub spans: Vec<Span>,
7070}
7171
72#[derive(Diagnostic)]
73#[diag(ast_passes_forbidden_const_param)]
74pub struct ForbiddenConstParam {
75 #[primary_span]
76 pub const_param_spans: Vec<Span>,
77}
78
7279#[derive(Diagnostic)]
7380#[diag(ast_passes_fn_param_too_many)]
7481pub struct FnParamTooMany {
compiler/rustc_ast_passes/src/feature_gate.rs+16
......@@ -162,6 +162,22 @@ impl<'a> PostExpansionVisitor<'a> {
162162 crate::fluent_generated::ast_passes_forbidden_non_lifetime_param
163163 );
164164
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
165181 for param in params {
166182 if !param.bounds.is_empty() {
167183 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(
20942094 format!("late-bound {what} parameter not allowed on {where_}"),
20952095 );
20962096
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);
21022098
21032099 first = false;
21042100 *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;
1616use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
1717use rustc_pattern_analysis::errors::Uncovered;
1818use 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,
2121};
2222use rustc_session::lint::builtin::{
2323 BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS,
......@@ -998,27 +998,31 @@ fn report_non_exhaustive_match<'p, 'tcx>(
998998 err.note(format!("the matched value is of type `{}`", scrut_ty));
999999
10001000 if !is_empty_match {
1001 let mut non_exhaustive_tys = FxIndexSet::default();
1001 let mut special_tys = FxIndexSet::default();
10021002 // 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);
10041004
1005 for ty in non_exhaustive_tys {
1005 for ty in special_tys {
10061006 if ty.is_ptr_sized_integral() {
1007 if ty == cx.tcx.types.usize {
1007 if ty.inner() == cx.tcx.types.usize {
10081008 err.note(format!(
10091009 "`{ty}` does not have a fixed maximum value, so half-open ranges are necessary to match \
10101010 exhaustively",
10111011 ));
1012 } else if ty == cx.tcx.types.isize {
1012 } else if ty.inner() == cx.tcx.types.isize {
10131013 err.note(format!(
10141014 "`{ty}` does not have fixed minimum and maximum values, so half-open ranges are necessary to match \
10151015 exhaustively",
10161016 ));
10171017 }
1018 } else if ty == cx.tcx.types.str_ {
1018 } else if ty.inner() == cx.tcx.types.str_ {
10191019 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) {
10211021 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"));
10221026 }
10231027 }
10241028 }
......@@ -1168,22 +1172,22 @@ fn joined_uncovered_patterns<'p, 'tcx>(
11681172 }
11691173}
11701174
1171fn collect_non_exhaustive_tys<'tcx>(
1175/// Collect types that require specific explanations when they show up in witnesses.
1176fn collect_special_tys<'tcx>(
11721177 cx: &PatCtxt<'_, 'tcx>,
11731178 pat: &WitnessPat<'_, 'tcx>,
1174 non_exhaustive_tys: &mut FxIndexSet<Ty<'tcx>>,
1179 special_tys: &mut FxIndexSet<RevealedTy<'tcx>>,
11751180) {
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());
11781183 }
11791184 if let Constructor::IntRange(range) = pat.ctor() {
11801185 if cx.is_range_beyond_boundaries(range, *pat.ty()) {
11811186 // 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());
11831188 }
11841189 }
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))
11871191}
11881192
11891193fn 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>>;
4040///
4141/// Use `.inner()` or deref to get to the `Ty<'tcx>`.
4242#[repr(transparent)]
43#[derive(Clone, Copy)]
43#[derive(Clone, Copy, PartialEq, Eq, Hash)]
4444pub struct RevealedTy<'tcx>(Ty<'tcx>);
4545
46impl<'tcx> fmt::Display for RevealedTy<'tcx> {
47 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
48 self.0.fmt(fmt)
49 }
50}
51
4652impl<'tcx> fmt::Debug for RevealedTy<'tcx> {
4753 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
4854 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> {
27632763 let res = match kind {
27642764 RibKind::Item(..) | RibKind::AssocItem => Res::Def(def_kind, def_id.to_def_id()),
27652765 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 {
27672771 Res::Def(def_kind, def_id.to_def_id())
27682772 } else {
27692773 Res::Err
library/std/src/sys/pal/unix/net.rs+3-2
......@@ -4,7 +4,6 @@ use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
44use crate::mem;
55use crate::net::{Shutdown, SocketAddr};
66use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
7use crate::str;
87use crate::sys::fd::FileDesc;
98use crate::sys::pal::unix::IsMinusOne;
109use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr};
......@@ -47,7 +46,9 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
4746
4847 #[cfg(not(target_os = "espidf"))]
4948 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()
5152 };
5253
5354 #[cfg(target_os = "espidf")]
src/librustdoc/html/static/css/rustdoc.css+5
......@@ -831,6 +831,10 @@ pre, .rustdoc.src .example-wrap {
831831 background: var(--table-alt-row-background-color);
832832}
833833
834.docblock .stab, .docblock-short .stab {
835 display: inline-block;
836}
837
834838/* "where ..." clauses with block display are also smaller */
835839div.where {
836840 white-space: pre-wrap;
......@@ -953,6 +957,7 @@ table,
953957 display: table;
954958 padding: 0;
955959 margin: 0;
960 width: 100%;
956961}
957962.item-table > li {
958963 display: table-row;
tests/crashes/127009.rs deleted-11
......@@ -1,11 +0,0 @@
1//@ known-bug: #127009
2
3#![feature(non_lifetime_binders)]
4
5fn b()
6where
7 for<const C: usize> [(); C]: Copy,
8{
9}
10
11fn main() {}
tests/rustdoc-gui/source-code-page-code-scroll.goml+2-2
......@@ -2,7 +2,7 @@
22go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
33set-window-size: (800, 1000)
44// "scrollWidth" should be superior than "clientWidth".
5assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800})
5assert-property: ("body", {"scrollWidth": 1114, "clientWidth": 800})
66
77// Both properties should be equal (ie, no scroll on the code block).
8assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933})
8assert-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
2020Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
2121Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
2222
23Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
24</span>.
25Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
26</span>.
23Finally, you can use `quz` only on <span class="stab portability" data-span="1"><code>Unix or x86-64
24</code></span>.
25Finally, you can use `quz` only on <span class="stab portability" data-span="2"><code>Unix or x86-64
26</code></span>.
2727*/
2828
2929use 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.
2go-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.
4set-window-size: (1100, 600)
5compare-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 @@
33
44fn main() {
55 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
78}
tests/ui/closures/binder/const-bound.stderr+7-1
......@@ -1,3 +1,9 @@
1error: late-bound const parameters cannot be used currently
2 --> $DIR/const-bound.rs:5:15
3 |
4LL | for<const N: i32> || -> () {};
5 | ^
6
17warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
28 --> $DIR/const-bound.rs:1:37
39 |
......@@ -13,5 +19,5 @@ error: late-bound const parameter not allowed on closures
1319LL | for<const N: i32> || -> () {};
1420 | ^^^^^^^^^^^^
1521
16error: aborting due to 1 previous error; 1 warning emitted
22error: aborting due to 2 previous errors; 1 warning emitted
1723
tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.rs+2-1
......@@ -7,7 +7,8 @@
77pub fn foo()
88where
99 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
1112{}
1213
1314fn main() {}
tests/ui/const-generics/generic_const_exprs/no-entry-found-for-key-ice-gce-nlb-113133.stderr+7-1
......@@ -1,8 +1,14 @@
1error: late-bound const parameters cannot be used currently
2 --> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:15
3 |
4LL | for<const N: usize = { const fn bar() {} bar(); 1 }> ():,
5 | ^
6
17error: defaults for generic parameters are not allowed in `for<...>` binders
28 --> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:9
39 |
410LL | for<const N: usize = { const fn bar() {} bar(); 1 }> ():,
511 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
612
7error: aborting due to 1 previous error
13error: aborting due to 2 previous errors
814
tests/ui/lto/debuginfo-lto-alloc.rs+2-1
......@@ -9,7 +9,8 @@
99// that compilation is successful.
1010
1111//@ 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
1314
1415extern crate alloc;
1516
tests/ui/pattern/usefulness/empty-types.min_exh_pats.stderr+9
......@@ -204,6 +204,7 @@ note: `Option<Void>` defined here
204204 |
205205 = note: not covered
206206 = 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
207208help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
208209 |
209210LL ~ None => {},
......@@ -349,6 +350,7 @@ LL | match slice_never {
349350 | ^^^^^^^^^^^ pattern `&[_, ..]` not covered
350351 |
351352 = note: the matched value is of type `&[!]`
353 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
352354help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
353355 |
354356LL ~ [] => {},
......@@ -484,6 +486,7 @@ note: `Option<!>` defined here
484486 |
485487 = note: not covered
486488 = note: the matched value is of type `&Option<!>`
489 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
487490help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
488491 |
489492LL ~ &None => {},
......@@ -502,6 +505,7 @@ note: `Option<!>` defined here
502505 |
503506 = note: not covered
504507 = note: the matched value is of type `Option<!>`
508 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
505509help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
506510 |
507511LL ~ None => {},
......@@ -520,6 +524,7 @@ note: `Result<!, !>` defined here
520524 |
521525 = note: not covered
522526 = note: the matched value is of type `Result<!, !>`
527 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
523528help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
524529 |
525530LL ~ Ok(_) => {},
......@@ -538,6 +543,7 @@ note: `Result<!, !>` defined here
538543 |
539544 = note: not covered
540545 = note: the matched value is of type `Result<!, !>`
546 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
541547help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
542548 |
543549LL ~ Ok(_a) => {},
......@@ -589,6 +595,7 @@ LL | match ref_never {
589595 | ^^^^^^^^^ pattern `&_` not covered
590596 |
591597 = note: the matched value is of type `&!`
598 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
592599 = note: references are always considered inhabited
593600 = note: match arms with guards don't count towards exhaustivity
594601help: 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
609616 |
610617 = note: not covered
611618 = note: the matched value is of type `Result<!, !>`
619 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
612620help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
613621 |
614622LL ~ Err(_) => {},
......@@ -627,6 +635,7 @@ note: `Option<Result<!, !>>` defined here
627635 |
628636 = note: not covered
629637 = 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
630639help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
631640 |
632641LL ~ None => {},
tests/ui/pattern/usefulness/slice_of_empty.min_exhaustive_patterns.stderr+1
......@@ -5,6 +5,7 @@ LL | match nevers {
55 | ^^^^^^ pattern `&[_, ..]` not covered
66 |
77 = note: the matched value is of type `&[!]`
8 = note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
89help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
910 |
1011LL ~ &[] => (),
tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.rs+2-1
......@@ -18,7 +18,8 @@ trait TraitC {}
1818fn foo<T>()
1919where
2020 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
2223 //~| ERROR `impl Trait` is not allowed in bounds
2324{
2425}
tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.stderr+7-1
......@@ -1,3 +1,9 @@
1error: late-bound const parameters cannot be used currently
2 --> $DIR/bad-suggestion-on-missing-assoc.rs:20:15
3 |
4LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>,
5 | ^
6
17warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
28 --> $DIR/bad-suggestion-on-missing-assoc.rs:1:12
39 |
......@@ -29,6 +35,6 @@ LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl Trai
2935 |
3036 = note: `impl Trait` is only allowed in arguments and return types of functions and methods
3137
32error: aborting due to 2 previous errors; 2 warnings emitted
38error: aborting due to 3 previous errors; 2 warnings emitted
3339
3440For 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 @@
44pub fn bar()
55where
66 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
79 (||1usize)()
810}> 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
1112{
1213}
1314
tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr+10-2
......@@ -1,5 +1,5 @@
11error[E0412]: cannot find type `V` in this scope
2 --> $DIR/binder-defaults-112547.rs:8:4
2 --> $DIR/binder-defaults-112547.rs:10:4
33 |
44LL | }> V: IntoIterator
55 | ^ not found in this scope
......@@ -9,6 +9,12 @@ help: you might be missing a type parameter
99LL | pub fn bar<V>()
1010 | +++
1111
12error: late-bound const parameters cannot be used currently
13 --> $DIR/binder-defaults-112547.rs:6:15
14 |
15LL | for<const N: usize = {
16 | ^
17
1218warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
1319 --> $DIR/binder-defaults-112547.rs:1:12
1420 |
......@@ -23,10 +29,12 @@ error: defaults for generic parameters are not allowed in `for<...>` binders
2329 |
2430LL | for<const N: usize = {
2531 | _________^
32LL | |
33LL | |
2634LL | | (||1usize)()
2735LL | | }> V: IntoIterator
2836 | |_^
2937
30error: aborting due to 2 previous errors; 1 warning emitted
38error: aborting due to 3 previous errors; 1 warning emitted
3139
3240For 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 @@
55fn fun()
66where
77 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
1011{}
1112
1213fn main() {}
tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr+7-1
......@@ -1,3 +1,9 @@
1error: late-bound const parameters cannot be used currently
2 --> $DIR/binder-defaults-119489.rs:7:23
3 |
4LL | for<T = (), const N: usize = 1> ():,
5 | ^
6
17warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
28 --> $DIR/binder-defaults-119489.rs:1:12
39 |
......@@ -27,5 +33,5 @@ error: defaults for generic parameters are not allowed in `for<...>` binders
2733LL | for<T = (), const N: usize = 1> ():,
2834 | ^^^^^^^^^^^^^^^^^^
2935
30error: aborting due to 2 previous errors; 2 warnings emitted
36error: aborting due to 3 previous errors; 2 warnings emitted
3137
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
4fn b()
5where
6 for<const C: usize> [(); C]: Copy,
7 //~^ ERROR late-bound const parameters cannot be used currently
8{
9}
10
11fn main() {}
tests/ui/traits/non_lifetime_binders/late-const-param-wf.stderr created+17
......@@ -0,0 +1,17 @@
1error: late-bound const parameters cannot be used currently
2 --> $DIR/late-const-param-wf.rs:6:15
3 |
4LL | for<const C: usize> [(); C]: Copy,
5 | ^
6
7warning: 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 |
10LL | #![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
16error: aborting due to 1 previous error; 1 warning emitted
17