mirror of https://github.com/rust-lang/rust.git
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
This commit is contained in:
commit
ee0fd6caf7
|
@ -50,7 +50,6 @@ build/
|
|||
/target
|
||||
/src/bootstrap/target
|
||||
/src/tools/x/target
|
||||
/inc-fat/
|
||||
# Created by default with `src/ci/docker/run.sh`
|
||||
/obj/
|
||||
/rustc-ice*
|
||||
|
|
|
@ -120,6 +120,9 @@ ast_passes_fn_without_body =
|
|||
ast_passes_forbidden_bound =
|
||||
bounds cannot be used in this context
|
||||
|
||||
ast_passes_forbidden_const_param =
|
||||
late-bound const parameters cannot be used currently
|
||||
|
||||
ast_passes_forbidden_default =
|
||||
`default` is only allowed on items in trait impls
|
||||
.label = `default` because of this
|
||||
|
|
|
@ -69,6 +69,13 @@ pub struct ForbiddenBound {
|
|||
pub spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_forbidden_const_param)]
|
||||
pub struct ForbiddenConstParam {
|
||||
#[primary_span]
|
||||
pub const_param_spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(ast_passes_fn_param_too_many)]
|
||||
pub struct FnParamTooMany {
|
||||
|
|
|
@ -162,6 +162,22 @@ impl<'a> PostExpansionVisitor<'a> {
|
|||
crate::fluent_generated::ast_passes_forbidden_non_lifetime_param
|
||||
);
|
||||
|
||||
// FIXME(non_lifetime_binders): Const bound params are pretty broken.
|
||||
// Let's keep users from using this feature accidentally.
|
||||
if self.features.non_lifetime_binders {
|
||||
let const_param_spans: Vec<_> = params
|
||||
.iter()
|
||||
.filter_map(|param| match param.kind {
|
||||
ast::GenericParamKind::Const { .. } => Some(param.ident.span),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
if !const_param_spans.is_empty() {
|
||||
self.sess.dcx().emit_err(errors::ForbiddenConstParam { const_param_spans });
|
||||
}
|
||||
}
|
||||
|
||||
for param in params {
|
||||
if !param.bounds.is_empty() {
|
||||
let spans: Vec<_> = param.bounds.iter().map(|b| b.span()).collect();
|
||||
|
|
|
@ -2094,11 +2094,7 @@ pub fn deny_non_region_late_bound(
|
|||
format!("late-bound {what} parameter not allowed on {where_}"),
|
||||
);
|
||||
|
||||
let guar = if tcx.features().non_lifetime_binders && first {
|
||||
diag.emit()
|
||||
} else {
|
||||
diag.delay_as_bug()
|
||||
};
|
||||
let guar = diag.emit_unless(!tcx.features().non_lifetime_binders || !first);
|
||||
|
||||
first = false;
|
||||
*arg = ResolvedArg::Error(guar);
|
||||
|
|
|
@ -16,8 +16,8 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
|
|||
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
|
||||
use rustc_pattern_analysis::errors::Uncovered;
|
||||
use rustc_pattern_analysis::rustc::{
|
||||
Constructor, DeconstructedPat, MatchArm, RustcPatCtxt as PatCtxt, Usefulness, UsefulnessReport,
|
||||
WitnessPat,
|
||||
Constructor, DeconstructedPat, MatchArm, RevealedTy, RustcPatCtxt as PatCtxt, Usefulness,
|
||||
UsefulnessReport, WitnessPat,
|
||||
};
|
||||
use rustc_session::lint::builtin::{
|
||||
BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS,
|
||||
|
@ -998,27 +998,31 @@ fn report_non_exhaustive_match<'p, 'tcx>(
|
|||
err.note(format!("the matched value is of type `{}`", scrut_ty));
|
||||
|
||||
if !is_empty_match {
|
||||
let mut non_exhaustive_tys = FxIndexSet::default();
|
||||
let mut special_tys = FxIndexSet::default();
|
||||
// Look at the first witness.
|
||||
collect_non_exhaustive_tys(cx, &witnesses[0], &mut non_exhaustive_tys);
|
||||
collect_special_tys(cx, &witnesses[0], &mut special_tys);
|
||||
|
||||
for ty in non_exhaustive_tys {
|
||||
for ty in special_tys {
|
||||
if ty.is_ptr_sized_integral() {
|
||||
if ty == cx.tcx.types.usize {
|
||||
if ty.inner() == cx.tcx.types.usize {
|
||||
err.note(format!(
|
||||
"`{ty}` does not have a fixed maximum value, so half-open ranges are necessary to match \
|
||||
exhaustively",
|
||||
));
|
||||
} else if ty == cx.tcx.types.isize {
|
||||
} else if ty.inner() == cx.tcx.types.isize {
|
||||
err.note(format!(
|
||||
"`{ty}` does not have fixed minimum and maximum values, so half-open ranges are necessary to match \
|
||||
exhaustively",
|
||||
));
|
||||
}
|
||||
} else if ty == cx.tcx.types.str_ {
|
||||
} else if ty.inner() == cx.tcx.types.str_ {
|
||||
err.note("`&str` cannot be matched exhaustively, so a wildcard `_` is necessary");
|
||||
} else if cx.is_foreign_non_exhaustive_enum(cx.reveal_opaque_ty(ty)) {
|
||||
} else if cx.is_foreign_non_exhaustive_enum(ty) {
|
||||
err.note(format!("`{ty}` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively"));
|
||||
} else if cx.is_uninhabited(ty.inner()) && cx.tcx.features().min_exhaustive_patterns {
|
||||
// The type is uninhabited yet there is a witness: we must be in the `MaybeInvalid`
|
||||
// case.
|
||||
err.note(format!("`{ty}` is uninhabited but is not being matched by value, so a wildcard `_` is required"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1168,22 +1172,22 @@ fn joined_uncovered_patterns<'p, 'tcx>(
|
|||
}
|
||||
}
|
||||
|
||||
fn collect_non_exhaustive_tys<'tcx>(
|
||||
/// Collect types that require specific explanations when they show up in witnesses.
|
||||
fn collect_special_tys<'tcx>(
|
||||
cx: &PatCtxt<'_, 'tcx>,
|
||||
pat: &WitnessPat<'_, 'tcx>,
|
||||
non_exhaustive_tys: &mut FxIndexSet<Ty<'tcx>>,
|
||||
special_tys: &mut FxIndexSet<RevealedTy<'tcx>>,
|
||||
) {
|
||||
if matches!(pat.ctor(), Constructor::NonExhaustive) {
|
||||
non_exhaustive_tys.insert(pat.ty().inner());
|
||||
if matches!(pat.ctor(), Constructor::NonExhaustive | Constructor::Never) {
|
||||
special_tys.insert(*pat.ty());
|
||||
}
|
||||
if let Constructor::IntRange(range) = pat.ctor() {
|
||||
if cx.is_range_beyond_boundaries(range, *pat.ty()) {
|
||||
// The range denotes the values before `isize::MIN` or the values after `usize::MAX`/`isize::MAX`.
|
||||
non_exhaustive_tys.insert(pat.ty().inner());
|
||||
special_tys.insert(*pat.ty());
|
||||
}
|
||||
}
|
||||
pat.iter_fields()
|
||||
.for_each(|field_pat| collect_non_exhaustive_tys(cx, field_pat, non_exhaustive_tys))
|
||||
pat.iter_fields().for_each(|field_pat| collect_special_tys(cx, field_pat, special_tys))
|
||||
}
|
||||
|
||||
fn report_adt_defined_here<'tcx>(
|
||||
|
|
|
@ -40,9 +40,15 @@ pub type WitnessPat<'p, 'tcx> = crate::pat::WitnessPat<RustcPatCtxt<'p, 'tcx>>;
|
|||
///
|
||||
/// Use `.inner()` or deref to get to the `Ty<'tcx>`.
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct RevealedTy<'tcx>(Ty<'tcx>);
|
||||
|
||||
impl<'tcx> fmt::Display for RevealedTy<'tcx> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.0.fmt(fmt)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> fmt::Debug for RevealedTy<'tcx> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.0.fmt(fmt)
|
||||
|
|
|
@ -2763,7 +2763,11 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
let res = match kind {
|
||||
RibKind::Item(..) | RibKind::AssocItem => Res::Def(def_kind, def_id.to_def_id()),
|
||||
RibKind::Normal => {
|
||||
if self.r.tcx.features().non_lifetime_binders {
|
||||
// FIXME(non_lifetime_binders): Stop special-casing
|
||||
// const params to error out here.
|
||||
if self.r.tcx.features().non_lifetime_binders
|
||||
&& matches!(param.kind, GenericParamKind::Type { .. })
|
||||
{
|
||||
Res::Def(def_kind, def_id.to_def_id())
|
||||
} else {
|
||||
Res::Err
|
||||
|
|
|
@ -4,7 +4,6 @@ use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
|
|||
use crate::mem;
|
||||
use crate::net::{Shutdown, SocketAddr};
|
||||
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use crate::str;
|
||||
use crate::sys::fd::FileDesc;
|
||||
use crate::sys::pal::unix::IsMinusOne;
|
||||
use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr};
|
||||
|
@ -47,7 +46,9 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
|
|||
|
||||
#[cfg(not(target_os = "espidf"))]
|
||||
let detail = unsafe {
|
||||
str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap().to_owned()
|
||||
// We can't always expect a UTF-8 environment. When we don't get that luxury,
|
||||
// it's better to give a low-quality error message than none at all.
|
||||
CStr::from_ptr(libc::gai_strerror(err)).to_string_lossy()
|
||||
};
|
||||
|
||||
#[cfg(target_os = "espidf")]
|
||||
|
|
|
@ -831,6 +831,10 @@ pre, .rustdoc.src .example-wrap {
|
|||
background: var(--table-alt-row-background-color);
|
||||
}
|
||||
|
||||
.docblock .stab, .docblock-short .stab {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* "where ..." clauses with block display are also smaller */
|
||||
div.where {
|
||||
white-space: pre-wrap;
|
||||
|
@ -953,6 +957,7 @@ table,
|
|||
display: table;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.item-table > li {
|
||||
display: table-row;
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
//@ known-bug: #127009
|
||||
|
||||
#![feature(non_lifetime_binders)]
|
||||
|
||||
fn b()
|
||||
where
|
||||
for<const C: usize> [(); C]: Copy,
|
||||
{
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -2,7 +2,7 @@
|
|||
go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
|
||||
set-window-size: (800, 1000)
|
||||
// "scrollWidth" should be superior than "clientWidth".
|
||||
assert-property: ("body", {"scrollWidth": 1047, "clientWidth": 800})
|
||||
assert-property: ("body", {"scrollWidth": 1114, "clientWidth": 800})
|
||||
|
||||
// Both properties should be equal (ie, no scroll on the code block).
|
||||
assert-property: (".example-wrap .rust", {"scrollWidth": 933, "clientWidth": 933})
|
||||
assert-property: (".example-wrap .rust", {"scrollWidth": 1000, "clientWidth": 1000})
|
||||
|
|
|
@ -20,10 +20,10 @@ Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated
|
|||
Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
|
||||
Also, stop using `bar` as it's <span class="stab deprecated" title="">deprecated</span>.
|
||||
|
||||
Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
|
||||
</span>.
|
||||
Finally, you can use `quz` only on <span class="stab portability"><code>Unix or x86-64</code>
|
||||
</span>.
|
||||
Finally, you can use `quz` only on <span class="stab portability" data-span="1"><code>Unix or x86-64
|
||||
</code></span>.
|
||||
Finally, you can use `quz` only on <span class="stab portability" data-span="2"><code>Unix or x86-64
|
||||
</code></span>.
|
||||
*/
|
||||
|
||||
use std::convert::AsRef;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// This test ensure that `stab` elements if used in doc blocks are not breaking the text layout.
|
||||
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||
// We make the window wide enough for the two stabs who are looking into to be on the same line.
|
||||
set-window-size: (1100, 600)
|
||||
compare-elements-position: (
|
||||
".top-doc .docblock span[data-span='1']",
|
||||
".top-doc .docblock span[data-span='2']",
|
||||
["y"],
|
||||
)
|
|
@ -3,5 +3,6 @@
|
|||
|
||||
fn main() {
|
||||
for<const N: i32> || -> () {};
|
||||
//~^ ERROR late-bound const parameter not allowed on closures
|
||||
//~^ ERROR late-bound const parameters cannot be used currently
|
||||
//~| ERROR late-bound const parameter not allowed on closures
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: late-bound const parameters cannot be used currently
|
||||
--> $DIR/const-bound.rs:5:15
|
||||
|
|
||||
LL | for<const N: i32> || -> () {};
|
||||
| ^
|
||||
|
||||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/const-bound.rs:1:37
|
||||
|
|
||||
|
@ -13,5 +19,5 @@ error: late-bound const parameter not allowed on closures
|
|||
LL | for<const N: i32> || -> () {};
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
pub fn foo()
|
||||
where
|
||||
for<const N: usize = { const fn bar() {} bar(); 1 }> ():,
|
||||
//~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~^ ERROR late-bound const parameters cannot be used currently
|
||||
//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
{}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
error: late-bound const parameters cannot be used currently
|
||||
--> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:15
|
||||
|
|
||||
LL | for<const N: usize = { const fn bar() {} bar(); 1 }> ():,
|
||||
| ^
|
||||
|
||||
error: defaults for generic parameters are not allowed in `for<...>` binders
|
||||
--> $DIR/no-entry-found-for-key-ice-gce-nlb-113133.rs:9:9
|
||||
|
|
||||
LL | for<const N: usize = { const fn bar() {} bar(); 1 }> ():,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
// that compilation is successful.
|
||||
|
||||
//@ check-pass
|
||||
//@ compile-flags: --test -C debuginfo=2 -C lto=fat -C incremental=inc-fat
|
||||
//@ compile-flags: --test -C debuginfo=2 -C lto=fat
|
||||
//@ incremental
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ note: `Option<Void>` defined here
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `Option<Void>`
|
||||
= note: `Void` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ None => {},
|
||||
|
@ -349,6 +350,7 @@ LL | match slice_never {
|
|||
| ^^^^^^^^^^^ pattern `&[_, ..]` not covered
|
||||
|
|
||||
= note: the matched value is of type `&[!]`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ [] => {},
|
||||
|
@ -484,6 +486,7 @@ note: `Option<!>` defined here
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `&Option<!>`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ &None => {},
|
||||
|
@ -502,6 +505,7 @@ note: `Option<!>` defined here
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `Option<!>`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ None => {},
|
||||
|
@ -520,6 +524,7 @@ note: `Result<!, !>` defined here
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `Result<!, !>`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ Ok(_) => {},
|
||||
|
@ -538,6 +543,7 @@ note: `Result<!, !>` defined here
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `Result<!, !>`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ Ok(_a) => {},
|
||||
|
@ -589,6 +595,7 @@ LL | match ref_never {
|
|||
| ^^^^^^^^^ pattern `&_` not covered
|
||||
|
|
||||
= note: the matched value is of type `&!`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
= note: references are always considered inhabited
|
||||
= note: match arms with guards don't count towards exhaustivity
|
||||
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
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `Result<!, !>`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ Err(_) => {},
|
||||
|
@ -627,6 +635,7 @@ note: `Option<Result<!, !>>` defined here
|
|||
|
|
||||
= note: not covered
|
||||
= note: the matched value is of type `Option<Result<!, !>>`
|
||||
= note: `Result<!, !>` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ None => {},
|
||||
|
|
|
@ -5,6 +5,7 @@ LL | match nevers {
|
|||
| ^^^^^^ pattern `&[_, ..]` not covered
|
||||
|
|
||||
= note: the matched value is of type `&[!]`
|
||||
= note: `!` is uninhabited but is not being matched by value, so a wildcard `_` is required
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ &[] => (),
|
||||
|
|
|
@ -18,7 +18,8 @@ trait TraitC {}
|
|||
fn foo<T>()
|
||||
where
|
||||
for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>,
|
||||
//~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~^ ERROR late-bound const parameters cannot be used currently
|
||||
//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~| ERROR `impl Trait` is not allowed in bounds
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: late-bound const parameters cannot be used currently
|
||||
--> $DIR/bad-suggestion-on-missing-assoc.rs:20:15
|
||||
|
|
||||
LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>,
|
||||
| ^
|
||||
|
||||
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/bad-suggestion-on-missing-assoc.rs:1:12
|
||||
|
|
||||
|
@ -29,6 +35,6 @@ LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl Trai
|
|||
|
|
||||
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
|
||||
|
||||
error: aborting due to 2 previous errors; 2 warnings emitted
|
||||
error: aborting due to 3 previous errors; 2 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0562`.
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
pub fn bar()
|
||||
where
|
||||
for<const N: usize = {
|
||||
//~^ ERROR late-bound const parameters cannot be used currently
|
||||
//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
(||1usize)()
|
||||
}> V: IntoIterator
|
||||
//~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~^^ ERROR cannot find type `V` in this scope
|
||||
//~^ ERROR cannot find type `V` in this scope
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0412]: cannot find type `V` in this scope
|
||||
--> $DIR/binder-defaults-112547.rs:8:4
|
||||
--> $DIR/binder-defaults-112547.rs:10:4
|
||||
|
|
||||
LL | }> V: IntoIterator
|
||||
| ^ not found in this scope
|
||||
|
@ -9,6 +9,12 @@ help: you might be missing a type parameter
|
|||
LL | pub fn bar<V>()
|
||||
| +++
|
||||
|
||||
error: late-bound const parameters cannot be used currently
|
||||
--> $DIR/binder-defaults-112547.rs:6:15
|
||||
|
|
||||
LL | for<const N: usize = {
|
||||
| ^
|
||||
|
||||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/binder-defaults-112547.rs:1:12
|
||||
|
|
||||
|
@ -23,10 +29,12 @@ error: defaults for generic parameters are not allowed in `for<...>` binders
|
|||
|
|
||||
LL | for<const N: usize = {
|
||||
| _________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | (||1usize)()
|
||||
LL | | }> V: IntoIterator
|
||||
| |_^
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
fn fun()
|
||||
where
|
||||
for<T = (), const N: usize = 1> ():,
|
||||
//~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~^ ERROR late-bound const parameters cannot be used currently
|
||||
//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders
|
||||
{}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
error: late-bound const parameters cannot be used currently
|
||||
--> $DIR/binder-defaults-119489.rs:7:23
|
||||
|
|
||||
LL | for<T = (), const N: usize = 1> ():,
|
||||
| ^
|
||||
|
||||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/binder-defaults-119489.rs:1:12
|
||||
|
|
||||
|
@ -27,5 +33,5 @@ error: defaults for generic parameters are not allowed in `for<...>` binders
|
|||
LL | for<T = (), const N: usize = 1> ():,
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 2 warnings emitted
|
||||
error: aborting due to 3 previous errors; 2 warnings emitted
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#![feature(non_lifetime_binders)]
|
||||
//~^ WARN the feature `non_lifetime_binders` is incomplete
|
||||
|
||||
fn b()
|
||||
where
|
||||
for<const C: usize> [(); C]: Copy,
|
||||
//~^ ERROR late-bound const parameters cannot be used currently
|
||||
{
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,17 @@
|
|||
error: late-bound const parameters cannot be used currently
|
||||
--> $DIR/late-const-param-wf.rs:6:15
|
||||
|
|
||||
LL | for<const C: usize> [(); C]: Copy,
|
||||
| ^
|
||||
|
||||
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/late-const-param-wf.rs:1:12
|
||||
|
|
||||
LL | #![feature(non_lifetime_binders)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error: aborting due to 1 previous error; 1 warning emitted
|
||||
|
Loading…
Reference in New Issue