mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 12:36:47 +00:00
improve diagnostics and bless tests
This commit is contained in:
parent
442617c046
commit
73b3ce26ec
@ -145,6 +145,15 @@ resolve_param_in_ty_of_const_param =
|
||||
the type of const parameters must not depend on other generic parameters
|
||||
.label = the type must not depend on the parameter `{$name}`
|
||||
|
||||
resolve_type_param_in_ty_of_const_param =
|
||||
type parameters may not be used in the type of const parameters
|
||||
|
||||
resolve_const_param_in_ty_of_const_param =
|
||||
const parameters may not be used in the type of const parameters
|
||||
|
||||
resolve_lifetime_param_in_ty_of_const_param =
|
||||
lifetime parameters may not be used in the type of const parameters
|
||||
|
||||
resolve_self_in_generic_param_default =
|
||||
generic parameters cannot use `Self` in their defaults
|
||||
.label = `Self` in generic parameter default
|
||||
@ -156,12 +165,15 @@ resolve_param_in_non_trivial_anon_const =
|
||||
resolve_param_in_non_trivial_anon_const_help =
|
||||
use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
resolve_param_in_non_trivial_anon_const_sub_type =
|
||||
resolve_type_param_in_non_trivial_anon_const =
|
||||
type parameters may not be used in const expressions
|
||||
|
||||
resolve_param_in_non_trivial_anon_const_sub_non_type =
|
||||
resolve_const_param_in_non_trivial_anon_const =
|
||||
const parameters may only be used as standalone arguments, i.e. `{$name}`
|
||||
|
||||
resolve_lifetime_param_in_non_trivial_anon_const =
|
||||
lifetime parameters may not be used in const expressions
|
||||
|
||||
resolve_unreachable_label =
|
||||
use of unreachable label `{$name}`
|
||||
.label = unreachable label `{$name}`
|
||||
@ -233,3 +245,16 @@ resolve_macro_use_extern_crate_self = `#[macro_use]` is not supported on `extern
|
||||
|
||||
resolve_accessible_unsure = not sure whether the path is accessible or not
|
||||
.note = the type may have associated items, but we are currently not checking them
|
||||
|
||||
resolve_param_in_enum_discriminant =
|
||||
generic parameters may not be used in enum discriminant values
|
||||
.label = cannot perform const operation using `{$name}`
|
||||
|
||||
resolve_type_param_in_enum_discriminant =
|
||||
type parameters may not be used in enum discriminant values
|
||||
|
||||
resolve_const_param_in_enum_discriminant =
|
||||
const parameters may not be used in enum discriminant values
|
||||
|
||||
resolve_lifetime_param_in_enum_discriminant =
|
||||
lifetime parameters may not be used in enum discriminant values
|
||||
|
@ -864,18 +864,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
ResolutionError::ForwardDeclaredGenericParam => {
|
||||
self.tcx.sess.create_err(errs::ForwardDeclaredGenericParam { span })
|
||||
}
|
||||
ResolutionError::ParamInTyOfConstParam(name) => {
|
||||
self.tcx.sess.create_err(errs::ParamInTyOfConstParam { span, name })
|
||||
}
|
||||
ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => {
|
||||
ResolutionError::ParamInTyOfConstParam { name, param_kind: is_type } => self
|
||||
.tcx
|
||||
.sess
|
||||
.create_err(errs::ParamInTyOfConstParam { span, name, param_kind: is_type }),
|
||||
ResolutionError::ParamInNonTrivialAnonConst { name, param_kind: is_type } => {
|
||||
self.tcx.sess.create_err(errs::ParamInNonTrivialAnonConst {
|
||||
span,
|
||||
name,
|
||||
sub_is_type: if is_type {
|
||||
errs::ParamInNonTrivialAnonConstIsType::AType
|
||||
} else {
|
||||
errs::ParamInNonTrivialAnonConstIsType::NotAType { name }
|
||||
},
|
||||
param_kind: is_type,
|
||||
help: self
|
||||
.tcx
|
||||
.sess
|
||||
@ -883,6 +880,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
.then_some(errs::ParamInNonTrivialAnonConstHelp),
|
||||
})
|
||||
}
|
||||
ResolutionError::ParamInEnumDiscriminant { name, param_kind: is_type } => self
|
||||
.tcx
|
||||
.sess
|
||||
.create_err(errs::ParamInEnumDiscriminant { span, name, param_kind: is_type }),
|
||||
ResolutionError::SelfInGenericParamDefault => {
|
||||
self.tcx.sess.create_err(errs::SelfInGenericParamDefault { span })
|
||||
}
|
||||
|
@ -326,6 +326,18 @@ pub(crate) struct ParamInTyOfConstParam {
|
||||
#[label]
|
||||
pub(crate) span: Span,
|
||||
pub(crate) name: Symbol,
|
||||
#[subdiagnostic]
|
||||
pub(crate) param_kind: Option<ParamKindInTyOfConstParam>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum ParamKindInTyOfConstParam {
|
||||
#[note(resolve_type_param_in_ty_of_const_param)]
|
||||
Type,
|
||||
#[note(resolve_const_param_in_ty_of_const_param)]
|
||||
Const,
|
||||
#[note(resolve_lifetime_param_in_ty_of_const_param)]
|
||||
Lifetime,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
@ -344,7 +356,7 @@ pub(crate) struct ParamInNonTrivialAnonConst {
|
||||
pub(crate) span: Span,
|
||||
pub(crate) name: Symbol,
|
||||
#[subdiagnostic]
|
||||
pub(crate) sub_is_type: ParamInNonTrivialAnonConstIsType,
|
||||
pub(crate) param_kind: ParamKindInNonTrivialAnonConst,
|
||||
#[subdiagnostic]
|
||||
pub(crate) help: Option<ParamInNonTrivialAnonConstHelp>,
|
||||
}
|
||||
@ -354,11 +366,13 @@ pub(crate) struct ParamInNonTrivialAnonConst {
|
||||
pub(crate) struct ParamInNonTrivialAnonConstHelp;
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum ParamInNonTrivialAnonConstIsType {
|
||||
#[note(resolve_param_in_non_trivial_anon_const_sub_type)]
|
||||
AType,
|
||||
#[help(resolve_param_in_non_trivial_anon_const_sub_non_type)]
|
||||
NotAType { name: Symbol },
|
||||
pub(crate) enum ParamKindInNonTrivialAnonConst {
|
||||
#[note(resolve_type_param_in_non_trivial_anon_const)]
|
||||
Type,
|
||||
#[help(resolve_const_param_in_non_trivial_anon_const)]
|
||||
Const { name: Symbol },
|
||||
#[note(resolve_lifetime_param_in_non_trivial_anon_const)]
|
||||
Lifetime,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
@ -539,3 +553,24 @@ pub(crate) struct CfgAccessibleUnsure {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_param_in_enum_discriminant)]
|
||||
pub(crate) struct ParamInEnumDiscriminant {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub(crate) span: Span,
|
||||
pub(crate) name: Symbol,
|
||||
#[subdiagnostic]
|
||||
pub(crate) param_kind: ParamKindInEnumDiscriminant,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum ParamKindInEnumDiscriminant {
|
||||
#[note(resolve_type_param_in_enum_discriminant)]
|
||||
Type,
|
||||
#[note(resolve_const_param_in_enum_discriminant)]
|
||||
Const,
|
||||
#[note(resolve_lifetime_param_in_enum_discriminant)]
|
||||
Lifetime,
|
||||
}
|
||||
|
@ -13,8 +13,10 @@ use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::ptr;
|
||||
|
||||
use crate::errors::{ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst};
|
||||
use crate::late::{
|
||||
ConstantHasGenerics, ConstantItemKind, HasGenericParams, PathSource, Rib, RibKind,
|
||||
ConstantHasGenerics, ConstantItemKind, HasGenericParams, NoConstantGenericsReason, PathSource,
|
||||
Rib, RibKind,
|
||||
};
|
||||
use crate::macros::{sub_namespace_match, MacroRulesScope};
|
||||
use crate::{errors, AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy, Finalize};
|
||||
@ -1153,7 +1155,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
}
|
||||
RibKind::ConstParamTy => {
|
||||
if let Some(span) = finalize {
|
||||
self.report_error(span, ParamInTyOfConstParam(rib_ident.name));
|
||||
self.report_error(
|
||||
span,
|
||||
ParamInTyOfConstParam {
|
||||
name: rib_ident.name,
|
||||
param_kind: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
return Res::Err;
|
||||
}
|
||||
@ -1206,13 +1214,22 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
}
|
||||
} else {
|
||||
if let Some(span) = finalize {
|
||||
self.report_error(
|
||||
span,
|
||||
ResolutionError::ParamInNonTrivialAnonConst {
|
||||
name: rib_ident.name,
|
||||
is_type: true,
|
||||
},
|
||||
);
|
||||
let error = match cause {
|
||||
NoConstantGenericsReason::IsEnumDiscriminant => {
|
||||
ResolutionError::ParamInEnumDiscriminant {
|
||||
name: rib_ident.name,
|
||||
param_kind: ParamKindInEnumDiscriminant::Type,
|
||||
}
|
||||
}
|
||||
NoConstantGenericsReason::NonTrivialConstArg => {
|
||||
ResolutionError::ParamInNonTrivialAnonConst {
|
||||
name: rib_ident.name,
|
||||
param_kind:
|
||||
ParamKindInNonTrivialAnonConst::Type,
|
||||
}
|
||||
}
|
||||
};
|
||||
self.report_error(span, error);
|
||||
self.tcx.sess.delay_span_bug(span, CG_BUG_STR);
|
||||
}
|
||||
|
||||
@ -1229,7 +1246,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
if let Some(span) = finalize {
|
||||
self.report_error(
|
||||
span,
|
||||
ResolutionError::ParamInTyOfConstParam(rib_ident.name),
|
||||
ResolutionError::ParamInTyOfConstParam {
|
||||
name: rib_ident.name,
|
||||
param_kind: Some(errors::ParamKindInTyOfConstParam::Type),
|
||||
},
|
||||
);
|
||||
}
|
||||
return Res::Err;
|
||||
@ -1262,14 +1282,23 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
RibKind::ConstantItem(trivial, _) => {
|
||||
if let ConstantHasGenerics::No(cause) = trivial {
|
||||
if let Some(span) = finalize {
|
||||
self.report_error(
|
||||
span,
|
||||
ResolutionError::ParamInNonTrivialAnonConst {
|
||||
name: rib_ident.name,
|
||||
is_type: false,
|
||||
},
|
||||
);
|
||||
self.tcx.sess.delay_span_bug(span, CG_BUG_STR);
|
||||
let error = match cause {
|
||||
NoConstantGenericsReason::IsEnumDiscriminant => {
|
||||
ResolutionError::ParamInEnumDiscriminant {
|
||||
name: rib_ident.name,
|
||||
param_kind: ParamKindInEnumDiscriminant::Const,
|
||||
}
|
||||
}
|
||||
NoConstantGenericsReason::NonTrivialConstArg => {
|
||||
ResolutionError::ParamInNonTrivialAnonConst {
|
||||
name: rib_ident.name,
|
||||
param_kind: ParamKindInNonTrivialAnonConst::Const {
|
||||
name: rib_ident.name,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
self.report_error(span, error);
|
||||
}
|
||||
|
||||
return Res::Err;
|
||||
@ -1283,7 +1312,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
if let Some(span) = finalize {
|
||||
self.report_error(
|
||||
span,
|
||||
ResolutionError::ParamInTyOfConstParam(rib_ident.name),
|
||||
ResolutionError::ParamInTyOfConstParam {
|
||||
name: rib_ident.name,
|
||||
param_kind: Some(errors::ParamKindInTyOfConstParam::Const),
|
||||
},
|
||||
);
|
||||
}
|
||||
return Res::Err;
|
||||
|
@ -1529,7 +1529,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
match rib.kind {
|
||||
LifetimeRibKind::Item => break,
|
||||
LifetimeRibKind::ConstParamTy => {
|
||||
self.emit_non_static_lt_in_const_generic_error(lifetime);
|
||||
self.emit_non_static_lt_in_const_param_ty_error(lifetime);
|
||||
self.record_lifetime_res(
|
||||
lifetime.id,
|
||||
LifetimeRes::Error,
|
||||
@ -1538,7 +1538,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
return;
|
||||
}
|
||||
LifetimeRibKind::ConcreteAnonConst(cause) => {
|
||||
self.maybe_emit_forbidden_non_static_lifetime_error(lifetime);
|
||||
self.emit_forbidden_non_static_lifetime_error(cause, lifetime);
|
||||
self.record_lifetime_res(
|
||||
lifetime.id,
|
||||
LifetimeRes::Error,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::diagnostics::{ImportSuggestion, LabelSuggestion, TypoSuggestion};
|
||||
use crate::late::{AliasPossibility, LateResolutionVisitor, RibKind};
|
||||
use crate::late::{LifetimeBinderKind, LifetimeRes, LifetimeRibKind, LifetimeUseSet};
|
||||
use crate::path_names_to_string;
|
||||
use crate::{errors, path_names_to_string};
|
||||
use crate::{Module, ModuleKind, ModuleOrUniformRoot};
|
||||
use crate::{PathResult, PathSource, Segment};
|
||||
|
||||
@ -22,7 +22,6 @@ use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
||||
use rustc_hir::PrimTy;
|
||||
use rustc_session::lint;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::edition::Edition;
|
||||
@ -35,6 +34,8 @@ use std::ops::Deref;
|
||||
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
use super::NoConstantGenericsReason;
|
||||
|
||||
type Res = def::Res<ast::NodeId>;
|
||||
|
||||
/// A field or associated item from self type suggested in case of resolution failure.
|
||||
@ -2316,37 +2317,56 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn emit_non_static_lt_in_const_generic_error(&self, lifetime_ref: &ast::Lifetime) {
|
||||
struct_span_err!(
|
||||
self.r.tcx.sess,
|
||||
lifetime_ref.ident.span,
|
||||
E0771,
|
||||
"use of non-static lifetime `{}` in const generic",
|
||||
lifetime_ref.ident
|
||||
)
|
||||
.note(
|
||||
"for more information, see issue #74052 \
|
||||
<https://github.com/rust-lang/rust/issues/74052>",
|
||||
)
|
||||
.emit();
|
||||
pub(crate) fn emit_non_static_lt_in_const_param_ty_error(&self, lifetime_ref: &ast::Lifetime) {
|
||||
self.r
|
||||
.tcx
|
||||
.sess
|
||||
.create_err(errors::ParamInTyOfConstParam {
|
||||
span: lifetime_ref.ident.span,
|
||||
name: lifetime_ref.ident.name,
|
||||
param_kind: Some(errors::ParamKindInTyOfConstParam::Lifetime),
|
||||
})
|
||||
.emit();
|
||||
}
|
||||
|
||||
/// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`.
|
||||
/// This function will emit an error if `generic_const_exprs` is not enabled, the body identified by
|
||||
/// `body_id` is an anonymous constant and `lifetime_ref` is non-static.
|
||||
pub(crate) fn maybe_emit_forbidden_non_static_lifetime_error(
|
||||
pub(crate) fn emit_forbidden_non_static_lifetime_error(
|
||||
&self,
|
||||
cause: NoConstantGenericsReason,
|
||||
lifetime_ref: &ast::Lifetime,
|
||||
) {
|
||||
let feature_active = self.r.tcx.sess.features_untracked().generic_const_exprs;
|
||||
if !feature_active {
|
||||
feature_err(
|
||||
&self.r.tcx.sess.parse_sess,
|
||||
sym::generic_const_exprs,
|
||||
lifetime_ref.ident.span,
|
||||
"a non-static lifetime is not allowed in a `const`",
|
||||
)
|
||||
.emit();
|
||||
match cause {
|
||||
NoConstantGenericsReason::IsEnumDiscriminant => {
|
||||
self.r
|
||||
.tcx
|
||||
.sess
|
||||
.create_err(errors::ParamInEnumDiscriminant {
|
||||
span: lifetime_ref.ident.span,
|
||||
name: lifetime_ref.ident.name,
|
||||
param_kind: errors::ParamKindInEnumDiscriminant::Lifetime,
|
||||
})
|
||||
.emit();
|
||||
}
|
||||
NoConstantGenericsReason::NonTrivialConstArg => {
|
||||
assert!(!self.r.tcx.features().generic_const_exprs);
|
||||
self.r
|
||||
.tcx
|
||||
.sess
|
||||
.create_err(errors::ParamInNonTrivialAnonConst {
|
||||
span: lifetime_ref.ident.span,
|
||||
name: lifetime_ref.ident.name,
|
||||
param_kind: errors::ParamKindInNonTrivialAnonConst::Lifetime,
|
||||
help: self
|
||||
.r
|
||||
.tcx
|
||||
.sess
|
||||
.is_nightly_build()
|
||||
.then_some(errors::ParamInNonTrivialAnonConstHelp),
|
||||
})
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,9 @@
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
use errors::{
|
||||
ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst, ParamKindInTyOfConstParam,
|
||||
};
|
||||
use rustc_arena::{DroplessArena, TypedArena};
|
||||
use rustc_ast::node_id::NodeMap;
|
||||
use rustc_ast::{self as ast, attr, NodeId, CRATE_NODE_ID};
|
||||
@ -223,11 +226,15 @@ enum ResolutionError<'a> {
|
||||
/// Error E0128: generic parameters with a default cannot use forward-declared identifiers.
|
||||
ForwardDeclaredGenericParam,
|
||||
/// ERROR E0770: the type of const parameters must not depend on other generic parameters.
|
||||
ParamInTyOfConstParam(Symbol),
|
||||
ParamInTyOfConstParam { name: Symbol, param_kind: Option<ParamKindInTyOfConstParam> },
|
||||
/// generic parameters must not be used inside const evaluations.
|
||||
///
|
||||
/// This error is only emitted when using `min_const_generics`.
|
||||
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
|
||||
ParamInNonTrivialAnonConst { name: Symbol, param_kind: ParamKindInNonTrivialAnonConst },
|
||||
/// generic parameters must not be used inside enum discriminants.
|
||||
///
|
||||
/// This error is emitted even with `generic_const_exprs`.
|
||||
ParamInEnumDiscriminant { name: Symbol, param_kind: ParamKindInEnumDiscriminant },
|
||||
/// Error E0735: generic parameters with a default cannot use `Self`
|
||||
SelfInGenericParamDefault,
|
||||
/// Error E0767: use of unreachable label
|
||||
|
13
tests/ui/const-generics/assoc_const_as_type_argument.rs
Normal file
13
tests/ui/const-generics/assoc_const_as_type_argument.rs
Normal file
@ -0,0 +1,13 @@
|
||||
trait Trait {
|
||||
const ASSOC: usize;
|
||||
}
|
||||
|
||||
fn bar<const N: usize>() {}
|
||||
|
||||
fn foo<T: Trait>() {
|
||||
bar::<<T as Trait>::ASSOC>();
|
||||
//~^ ERROR: expected associated type, found associated constant `Trait::ASSOC`
|
||||
//~| ERROR: unresolved item provided when a constant was expected
|
||||
}
|
||||
|
||||
fn main() {}
|
21
tests/ui/const-generics/assoc_const_as_type_argument.stderr
Normal file
21
tests/ui/const-generics/assoc_const_as_type_argument.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
error[E0575]: expected associated type, found associated constant `Trait::ASSOC`
|
||||
--> $DIR/assoc_const_as_type_argument.rs:8:11
|
||||
|
|
||||
LL | bar::<<T as Trait>::ASSOC>();
|
||||
| ^^^^^^^^^^^^^^^^^^^ not a associated type
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/assoc_const_as_type_argument.rs:8:11
|
||||
|
|
||||
LL | bar::<<T as Trait>::ASSOC>();
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: if this generic argument was intended as a const parameter, surround it with braces
|
||||
|
|
||||
LL | bar::<{ <T as Trait>::ASSOC }>();
|
||||
| + +
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0575, E0747.
|
||||
For more information about an error, try `rustc --explain E0575`.
|
@ -1,163 +0,0 @@
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:18:23
|
||||
|
|
||||
LL | let _: [u8; faz::<'a>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:21:23
|
||||
|
|
||||
LL | let _: [u8; faz::<'b>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:41:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'a>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:44:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'b>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:13:12
|
||||
|
|
||||
LL | let _: [u8; foo::<T>()];
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); foo::<T>()]:`
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:15:12
|
||||
|
|
||||
LL | let _: [u8; bar::<N>()];
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); bar::<N>()]:`
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:36:12
|
||||
|
|
||||
LL | let _: Foo<{ foo::<T>() }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); { foo::<T>() }]:`
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:38:12
|
||||
|
|
||||
LL | let _: Foo<{ bar::<N>() }>;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); { bar::<N>() }]:`
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:25:17
|
||||
|
|
||||
LL | let _ = [0; foo::<T>()];
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); foo::<T>()]:`
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:27:17
|
||||
|
|
||||
LL | let _ = [0; bar::<N>()];
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); bar::<N>()]:`
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:30:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'a>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:33:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'b>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:47:19
|
||||
|
|
||||
LL | let _ = Foo::<{ foo::<T>() }>;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); { foo::<T>() }]:`
|
||||
|
||||
error: unconstrained generic constant
|
||||
--> $DIR/const-arg-in-const-arg.rs:49:19
|
||||
|
|
||||
LL | let _ = Foo::<{ bar::<N>() }>;
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: try adding a `where` bound using this expression: `where [(); { bar::<N>() }]:`
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:52:27
|
||||
|
|
||||
LL | let _ = Foo::<{ faz::<'a>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:55:27
|
||||
|
|
||||
LL | let _ = Foo::<{ faz::<'b>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0794`.
|
@ -1,5 +1,5 @@
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:13:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:15:23
|
||||
|
|
||||
LL | let _: [u8; foo::<T>()];
|
||||
| ^ cannot perform const operation using `T`
|
||||
@ -8,7 +8,7 @@ LL | let _: [u8; foo::<T>()];
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:15:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:16:23
|
||||
|
|
||||
LL | let _: [u8; bar::<N>()];
|
||||
| ^ cannot perform const operation using `N`
|
||||
@ -16,44 +16,44 @@ LL | let _: [u8; bar::<N>()];
|
||||
= help: const parameters may only be used as standalone arguments, i.e. `N`
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:18:23
|
||||
|
|
||||
LL | let _: [u8; faz::<'a>(&())];
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:20:23
|
||||
|
|
||||
LL | let _: [u8; baz::<'a>(&())];
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:21:23
|
||||
|
|
||||
LL | let _: [u8; faz::<'b>(&())];
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:23:23
|
||||
|
|
||||
LL | let _: [u8; baz::<'b>(&())];
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:27:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:26:23
|
||||
|
|
||||
LL | let _ = [0; bar::<N>()];
|
||||
| ^ cannot perform const operation using `N`
|
||||
@ -61,44 +61,44 @@ LL | let _ = [0; bar::<N>()];
|
||||
= help: const parameters may only be used as standalone arguments, i.e. `N`
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:30:23
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:28:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'a>(&())];
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:32:23
|
||||
|
|
||||
LL | let _ = [0; baz::<'a>(&())];
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:33:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'b>(&())];
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:35:23
|
||||
|
|
||||
LL | let _ = [0; baz::<'b>(&())];
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:36:24
|
||||
--> $DIR/const-arg-in-const-arg.rs:30:23
|
||||
|
|
||||
LL | let _ = [0; baz::<'a>(&())];
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:31:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'b>(&())];
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:33:23
|
||||
|
|
||||
LL | let _ = [0; baz::<'b>(&())];
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:34:24
|
||||
|
|
||||
LL | let _: Foo<{ foo::<T>() }>;
|
||||
| ^ cannot perform const operation using `T`
|
||||
@ -107,7 +107,7 @@ LL | let _: Foo<{ foo::<T>() }>;
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:38:24
|
||||
--> $DIR/const-arg-in-const-arg.rs:35:24
|
||||
|
|
||||
LL | let _: Foo<{ bar::<N>() }>;
|
||||
| ^ cannot perform const operation using `N`
|
||||
@ -115,44 +115,44 @@ LL | let _: Foo<{ bar::<N>() }>;
|
||||
= help: const parameters may only be used as standalone arguments, i.e. `N`
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:41:24
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:37:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'a>(&()) }>;
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:43:24
|
||||
|
|
||||
LL | let _: Foo<{ baz::<'a>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:44:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'b>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:46:24
|
||||
|
|
||||
LL | let _: Foo<{ baz::<'b>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:47:27
|
||||
--> $DIR/const-arg-in-const-arg.rs:39:24
|
||||
|
|
||||
LL | let _: Foo<{ baz::<'a>(&()) }>;
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:40:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'b>(&()) }>;
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:42:24
|
||||
|
|
||||
LL | let _: Foo<{ baz::<'b>(&()) }>;
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:43:27
|
||||
|
|
||||
LL | let _ = Foo::<{ foo::<T>() }>;
|
||||
| ^ cannot perform const operation using `T`
|
||||
@ -161,7 +161,7 @@ LL | let _ = Foo::<{ foo::<T>() }>;
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:49:27
|
||||
--> $DIR/const-arg-in-const-arg.rs:44:27
|
||||
|
|
||||
LL | let _ = Foo::<{ bar::<N>() }>;
|
||||
| ^ cannot perform const operation using `N`
|
||||
@ -169,44 +169,44 @@ LL | let _ = Foo::<{ bar::<N>() }>;
|
||||
= help: const parameters may only be used as standalone arguments, i.e. `N`
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:52:27
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:46:27
|
||||
|
|
||||
LL | let _ = Foo::<{ faz::<'a>(&()) }>;
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:54:27
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:48:27
|
||||
|
|
||||
LL | let _ = Foo::<{ baz::<'a>(&()) }>;
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:55:27
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:49:27
|
||||
|
|
||||
LL | let _ = Foo::<{ faz::<'b>(&()) }>;
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
--> $DIR/const-arg-in-const-arg.rs:57:27
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-arg-in-const-arg.rs:51:27
|
||||
|
|
||||
LL | let _ = Foo::<{ baz::<'b>(&()) }>;
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'b`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/const-arg-in-const-arg.rs:15:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:16:23
|
||||
|
|
||||
LL | let _: [u8; bar::<N>()];
|
||||
| ^
|
||||
@ -223,7 +223,7 @@ LL | let _: [u8; faz::<'a>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
@ -235,13 +235,13 @@ LL | let _: [u8; faz::<'b>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/const-arg-in-const-arg.rs:38:24
|
||||
--> $DIR/const-arg-in-const-arg.rs:35:24
|
||||
|
|
||||
LL | let _: Foo<{ bar::<N>() }>;
|
||||
| ^
|
||||
@ -252,25 +252,25 @@ LL | let _: Foo<{ bar::<{ N }>() }>;
|
||||
| + +
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:41:24
|
||||
--> $DIR/const-arg-in-const-arg.rs:37:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'a>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:44:24
|
||||
--> $DIR/const-arg-in-const-arg.rs:40:24
|
||||
|
|
||||
LL | let _: Foo<{ faz::<'b>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
@ -284,7 +284,7 @@ LL | let _ = [0; foo::<T>()];
|
||||
= note: this may fail depending on what value the parameter takes
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/const-arg-in-const-arg.rs:27:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:26:23
|
||||
|
|
||||
LL | let _ = [0; bar::<N>()];
|
||||
| ^
|
||||
@ -295,31 +295,31 @@ LL | let _ = [0; bar::<{ N }>()];
|
||||
| + +
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:30:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:28:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'a>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:33:23
|
||||
--> $DIR/const-arg-in-const-arg.rs:31:23
|
||||
|
|
||||
LL | let _ = [0; faz::<'b>(&())];
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0747]: unresolved item provided when a constant was expected
|
||||
--> $DIR/const-arg-in-const-arg.rs:49:27
|
||||
--> $DIR/const-arg-in-const-arg.rs:44:27
|
||||
|
|
||||
LL | let _ = Foo::<{ bar::<N>() }>;
|
||||
| ^
|
||||
@ -330,30 +330,30 @@ LL | let _ = Foo::<{ bar::<{ N }>() }>;
|
||||
| + +
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:52:27
|
||||
--> $DIR/const-arg-in-const-arg.rs:46:27
|
||||
|
|
||||
LL | let _ = Foo::<{ faz::<'a>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
|
||||
--> $DIR/const-arg-in-const-arg.rs:55:27
|
||||
--> $DIR/const-arg-in-const-arg.rs:49:27
|
||||
|
|
||||
LL | let _ = Foo::<{ faz::<'b>(&()) }>;
|
||||
| ^^
|
||||
|
|
||||
note: the late bound lifetime parameter is introduced here
|
||||
--> $DIR/const-arg-in-const-arg.rs:8:14
|
||||
--> $DIR/const-arg-in-const-arg.rs:10:14
|
||||
|
|
||||
LL | const fn faz<'a>(_: &'a ()) -> usize { 13 }
|
||||
| ^^
|
||||
|
||||
error: aborting due to 36 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0658, E0747, E0794.
|
||||
For more information about an error, try `rustc --explain E0658`.
|
||||
Some errors have detailed explanations: E0747, E0794.
|
||||
For more information about an error, try `rustc --explain E0747`.
|
||||
|
@ -1,4 +1,6 @@
|
||||
// revisions: full min
|
||||
// revisions: min
|
||||
// we use a single revision because t his shoudl have a `full` revision
|
||||
// but right now that ICEs and I(@BoxyUwU) could not get stderr normalization to work
|
||||
|
||||
#![cfg_attr(full, feature(generic_const_exprs))]
|
||||
#![cfg_attr(full, allow(incomplete_features))]
|
||||
@ -11,50 +13,42 @@ const fn baz<'a>(_: &'a ()) -> usize where &'a (): Sized { 13 }
|
||||
struct Foo<const N: usize>;
|
||||
fn test<'a, 'b, T, const N: usize>() where &'b (): Sized {
|
||||
let _: [u8; foo::<T>()]; //[min]~ ERROR generic parameters may not
|
||||
//[full]~^ ERROR unconstrained generic constant
|
||||
let _: [u8; bar::<N>()]; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR unresolved item provided when a constant was expected
|
||||
//[full]~^^ ERROR unconstrained generic constant
|
||||
let _: [u8; faz::<'a>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _: [u8; baz::<'a>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
let _: [u8; faz::<'b>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _: [u8; baz::<'b>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
let _: [u8; faz::<'a>(&())]; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _: [u8; baz::<'a>(&())]; //[min]~ ERROR generic parameters may not
|
||||
let _: [u8; faz::<'b>(&())]; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _: [u8; baz::<'b>(&())]; //[min]~ ERROR generic parameters may not
|
||||
|
||||
let _ = [0; foo::<T>()]; //[min]~ ERROR constant expression depends on a generic parameter
|
||||
//[full]~^ ERROR unconstrained generic constant
|
||||
let _ = [0; bar::<N>()]; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR unresolved item provided when a constant was expected
|
||||
//[full]~^^ ERROR unconstrained generic constant
|
||||
let _ = [0; faz::<'a>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _ = [0; baz::<'a>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
let _ = [0; faz::<'b>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _ = [0; baz::<'b>(&())]; //[min]~ ERROR a non-static lifetime
|
||||
let _ = [0; faz::<'a>(&())]; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _ = [0; baz::<'a>(&())]; //[min]~ ERROR generic parameters may not
|
||||
let _ = [0; faz::<'b>(&())]; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _ = [0; baz::<'b>(&())]; //[min]~ ERROR generic parameters may not
|
||||
let _: Foo<{ foo::<T>() }>; //[min]~ ERROR generic parameters may not
|
||||
//[full]~^ ERROR unconstrained generic constant
|
||||
let _: Foo<{ bar::<N>() }>; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR unresolved item provided when a constant was expected
|
||||
//[full]~^^ ERROR unconstrained generic constant
|
||||
let _: Foo<{ faz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _: Foo<{ baz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
let _: Foo<{ faz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _: Foo<{ baz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
let _: Foo<{ faz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _: Foo<{ baz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
let _: Foo<{ faz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _: Foo<{ baz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
let _ = Foo::<{ foo::<T>() }>; //[min]~ ERROR generic parameters may not
|
||||
//[full]~^ ERROR unconstrained generic constant
|
||||
let _ = Foo::<{ bar::<N>() }>; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR unresolved item provided when a constant was expected
|
||||
//[full]~^^ ERROR unconstrained generic constant
|
||||
let _ = Foo::<{ faz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _ = Foo::<{ baz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
let _ = Foo::<{ faz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
//~^ ERROR cannot specify lifetime arguments
|
||||
let _ = Foo::<{ baz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime
|
||||
let _ = Foo::<{ faz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _ = Foo::<{ baz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
let _ = Foo::<{ faz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
//[min]~^ ERROR cannot specify lifetime arguments
|
||||
let _ = Foo::<{ baz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,12 +1,11 @@
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/const-argument-non-static-lifetime.rs:14:17
|
||||
|
|
||||
LL | let _: &'a ();
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
@ -11,7 +11,7 @@ fn test<const N: usize>() {}
|
||||
|
||||
fn wow<'a>() -> &'a () {
|
||||
test::<{
|
||||
let _: &'a (); //[min]~ ERROR a non-static lifetime
|
||||
let _: &'a (); //[min]~ ERROR generic parameters may not be used in const operations
|
||||
3
|
||||
}>();
|
||||
&()
|
||||
|
@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/const-param-type-depends-on-const-param.rs:15:40
|
||||
|
|
||||
LL | pub struct SelfDependent<const N: [u8; N]>;
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/const-param-type-depends-on-const-param.rs:15:40
|
||||
|
|
||||
LL | pub struct SelfDependent<const N: [u8; N]>;
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error: `[u8; N]` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/const-param-type-depends-on-const-param.rs:11:47
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | struct B<T, const N: T>(PhantomData<[T; N]>);
|
||||
| ^ the type must not depend on the parameter `T`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
| ^ the type must not depend on the parameter `T`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0392]: parameter `T` is never used
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:11:22
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub struct Dependent<T, const X: T>([(); X]);
|
||||
| ^ the type must not depend on the parameter `T`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0392]: parameter `T` is never used
|
||||
--> $DIR/const-param-type-depends-on-type-param.rs:11:22
|
||||
|
@ -1,7 +1,7 @@
|
||||
fn bug<'a>()
|
||||
where
|
||||
[(); { //~ ERROR mismatched types
|
||||
let _: &'a (); //~ ERROR a non-static lifetime is not allowed in a `const`
|
||||
let _: &'a (); //~ ERROR generic parameters may not be used in const operations
|
||||
}]:
|
||||
{}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/issue-74713.rs:4:17
|
||||
|
|
||||
LL | let _: &'a ();
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-74713.rs:3:10
|
||||
@ -18,5 +18,4 @@ LL | | }]:
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0658.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
@ -0,0 +1,12 @@
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
fn foo() -> [(); {
|
||||
let a: &'a ();
|
||||
//~^ ERROR: use of undeclared lifetime name `'a`
|
||||
10_usize
|
||||
}] {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,11 @@
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/unresolved_lifetimes_error.rs:5:13
|
||||
|
|
||||
LL | fn foo() -> [(); {
|
||||
| - help: consider introducing lifetime `'a` here: `<'a>`
|
||||
LL | let a: &'a ();
|
||||
| ^^ undeclared lifetime
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0261`.
|
@ -2,7 +2,7 @@
|
||||
|
||||
struct Foo<'a> //~ ERROR parameter `'a` is never used [E0392]
|
||||
{
|
||||
_a: [u8; std::mem::size_of::<&'a mut u8>()] //~ ERROR a non-static lifetime is not allowed in a `const`
|
||||
_a: [u8; std::mem::size_of::<&'a mut u8>()] //~ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/issue-46511.rs:5:35
|
||||
|
|
||||
LL | _a: [u8; std::mem::size_of::<&'a mut u8>()]
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0392]: parameter `'a` is never used
|
||||
--> $DIR/issue-46511.rs:3:12
|
||||
@ -17,5 +17,4 @@ LL | struct Foo<'a>
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0392, E0658.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
For more information about this error, try `rustc --explain E0392`.
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-56445-1.rs:9:26
|
||||
|
|
||||
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
| ^^
|
||||
| ^^ the type must not depend on the parameter `'a`
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
= note: lifetime parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0771`.
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
|
@ -1,10 +1,10 @@
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-56445-1.rs:9:26
|
||||
|
|
||||
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
| ^^
|
||||
| ^^ the type must not depend on the parameter `'a`
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
= note: lifetime parameters may not be used in the type of const parameters
|
||||
|
||||
error: `&str` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/issue-56445-1.rs:9:25
|
||||
@ -17,4 +17,4 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0771`.
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
|
@ -7,7 +7,7 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
//~^ ERROR: use of non-static lifetime `'a` in const generic
|
||||
//~^ ERROR: the type of const parameters must not depend on other generic parameters
|
||||
//[min]~| ERROR: `&str` is forbidden as the type of a const generic parameter
|
||||
|
||||
impl Bug<'_, ""> {}
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | fn foo<const N: usize, const A: [u8; N]>() {}
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | fn foo<const N: usize, const A: [u8; N]>() {}
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error: `[u8; N]` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/issue-62878.rs:5:33
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
|
||||
| ^^^ the type must not depend on the parameter `LEN`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
|
||||
| ^^^ the type must not depend on the parameter `LEN`
|
||||
|
|
||||
= note: const parameters may not be used in the type of const parameters
|
||||
|
||||
error: `[u8; LEN]` is forbidden as the type of a const generic parameter
|
||||
--> $DIR/issue-71169.rs:5:38
|
||||
|
@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
|
||||
| ^^^^ the type must not depend on the parameter `Args`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-71381.rs:23:40
|
||||
|
|
||||
LL | const FN: unsafe extern "C" fn(Args),
|
||||
| ^^^^ the type must not depend on the parameter `Args`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0741]: using function pointers as const generic parameters is forbidden
|
||||
--> $DIR/issue-71381.rs:14:61
|
||||
|
@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub fn call_me<Args: Sized, const IDX: usize, const FN: unsafe extern "C" fn(Args)>(&self) {
|
||||
| ^^^^ the type must not depend on the parameter `Args`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-71381.rs:23:40
|
||||
|
|
||||
LL | const FN: unsafe extern "C" fn(Args),
|
||||
| ^^^^ the type must not depend on the parameter `Args`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: using function pointers as const generic parameters is forbidden
|
||||
--> $DIR/issue-71381.rs:14:61
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
|
||||
| ^ the type must not depend on the parameter `A`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0741]: using function pointers as const generic parameters is forbidden
|
||||
--> $DIR/issue-71611.rs:5:21
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | fn func<A, const F: fn(inner: A)>(outer: A) {
|
||||
| ^ the type must not depend on the parameter `A`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: using function pointers as const generic parameters is forbidden
|
||||
--> $DIR/issue-71611.rs:5:21
|
||||
|
@ -1,11 +0,0 @@
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
trait MyTrait<T> {}
|
||||
|
||||
fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
|
||||
//~^ ERROR overly complex generic constant
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,11 +0,0 @@
|
||||
error: overly complex generic constant
|
||||
--> $DIR/issue-77357.rs:6:46
|
||||
|
|
||||
LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constants
|
||||
|
|
||||
= help: consider moving this anonymous constant into a `const` function
|
||||
= note: this operation may be supported in the future
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,14 +0,0 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
fn bug<'a>()
|
||||
where
|
||||
for<'b> [(); {
|
||||
let x: &'b ();
|
||||
0
|
||||
}]:
|
||||
{}
|
||||
|
||||
fn main() {}
|
@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T)
|
||||
| ^ the type must not depend on the parameter `T`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/issue-88997.rs:8:54
|
||||
|
|
||||
LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T)
|
||||
| ^ the type must not depend on the parameter `T`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
||||
|
|
||||
LL | pub struct Foo<T, const H: T>(T)
|
||||
| ^ the type must not depend on the parameter `T`
|
||||
|
|
||||
= note: type parameters may not be used in the type of const parameters
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,4 +1,22 @@
|
||||
// run-pass
|
||||
// failure-status: 101
|
||||
// known-bug: unknown
|
||||
// error-pattern:internal compiler error
|
||||
// normalize-stderr-test "internal compiler error.*" -> ""
|
||||
// normalize-stderr-test "DefId\([^)]*\)" -> "..."
|
||||
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
|
||||
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
|
||||
// normalize-stderr-test "thread.*panicked.*\n" -> ""
|
||||
// normalize-stderr-test "stack backtrace:\n" -> ""
|
||||
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
|
||||
// normalize-stderr-test "\s at .*\n" -> ""
|
||||
// normalize-stderr-test ".*note: Some details.*\n" -> ""
|
||||
// normalize-stderr-test "\n\n[ ]*\n" -> ""
|
||||
// normalize-stderr-test "compiler/.*: projection" -> "projection"
|
||||
// this should run-pass
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
|
13
tests/ui/const-generics/late-bound-vars/in_closure.stderr
Normal file
13
tests/ui/const-generics/late-bound-vars/in_closure.stderr
Normal file
@ -0,0 +1,13 @@
|
||||
error: query stack during panic:
|
||||
#0 [mir_borrowck] borrow-checking `test::{closure#0}::{constant#1}`
|
||||
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}::{constant#1}`
|
||||
#2 [mir_for_ctfe] caching mir of `test::{closure#0}::{constant#1}` for CTFE
|
||||
#3 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
|
||||
#4 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}`
|
||||
#5 [eval_to_valtree] evaluating type-level constant
|
||||
#6 [typeck] type-checking `test`
|
||||
#7 [used_trait_imports] finding used_trait_imports `test`
|
||||
#8 [analysis] running analysis passes on this crate
|
||||
end of query stack
|
||||
error: aborting due to previous error
|
||||
|
@ -1,4 +1,21 @@
|
||||
// run-pass
|
||||
// failure-status: 101
|
||||
// known-bug: unknown
|
||||
// error-pattern:internal compiler error
|
||||
// normalize-stderr-test "internal compiler error.*" -> ""
|
||||
// normalize-stderr-test "DefId\([^)]*\)" -> "..."
|
||||
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
|
||||
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
|
||||
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
|
||||
// normalize-stderr-test "thread.*panicked.*\n" -> ""
|
||||
// normalize-stderr-test "stack backtrace:\n" -> ""
|
||||
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
|
||||
// normalize-stderr-test "\s at .*\n" -> ""
|
||||
// normalize-stderr-test ".*note: Some details.*\n" -> ""
|
||||
// normalize-stderr-test "\n\n[ ]*\n" -> ""
|
||||
// normalize-stderr-test "compiler/.*: projection" -> "projection"
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
|
13
tests/ui/const-generics/late-bound-vars/simple.stderr
Normal file
13
tests/ui/const-generics/late-bound-vars/simple.stderr
Normal file
@ -0,0 +1,13 @@
|
||||
error: query stack during panic:
|
||||
#0 [mir_borrowck] borrow-checking `test::{constant#1}`
|
||||
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{constant#1}`
|
||||
#2 [mir_for_ctfe] caching mir of `test::{constant#1}` for CTFE
|
||||
#3 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
|
||||
#4 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}`
|
||||
#5 [eval_to_valtree] evaluating type-level constant
|
||||
#6 [typeck] type-checking `test`
|
||||
#7 [used_trait_imports] finding used_trait_imports `test`
|
||||
#8 [analysis] running analysis passes on this crate
|
||||
end of query stack
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ fn test<const N: usize>() {}
|
||||
|
||||
fn issue_75323_and_74447_1<'a>() -> &'a () {
|
||||
test::<{ let _: &'a (); 3 },>();
|
||||
//~^ ERROR a non-static lifetime is not allowed in a `const`
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
&()
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ fn issue_75323_and_74447_3() {
|
||||
|
||||
fn issue_73375<'a>() {
|
||||
[(); (|_: &'a u8| (), 0).1];
|
||||
//~^ ERROR a non-static lifetime is not allowed in a `const`
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,21 +1,20 @@
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/forbid-non-static-lifetimes.rs:7:22
|
||||
|
|
||||
LL | test::<{ let _: &'a (); 3 },>();
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/forbid-non-static-lifetimes.rs:21:16
|
||||
|
|
||||
LL | [(); (|_: &'a u8| (), 0).1];
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
@ -2,7 +2,7 @@ struct Foo<
|
||||
'a,
|
||||
const N: usize = {
|
||||
let x: &'a ();
|
||||
//~^ ERROR use of non-static lifetime `'a` in const generic
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
3
|
||||
},
|
||||
>(&'a ());
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/outer-lifetime-in-const-generic-default.rs:4:17
|
||||
|
|
||||
LL | let x: &'a ();
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0771`.
|
||||
|
@ -0,0 +1,34 @@
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:7:15
|
||||
|
|
||||
LL | Variant = N,
|
||||
| ^ cannot perform const operation using `N`
|
||||
|
|
||||
= note: const parameters may not be used in enum discriminant values
|
||||
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:12:17
|
||||
|
|
||||
LL | Variant = { N + 1 },
|
||||
| ^ cannot perform const operation using `N`
|
||||
|
|
||||
= note: const parameters may not be used in enum discriminant values
|
||||
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:18:37
|
||||
|
|
||||
LL | Variant = { std::mem::size_of::<T>() as isize },
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:25:17
|
||||
|
|
||||
LL | let a: &'a ();
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: lifetime parameters may not be used in enum discriminant values
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
@ -0,0 +1,34 @@
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:7:15
|
||||
|
|
||||
LL | Variant = N,
|
||||
| ^ cannot perform const operation using `N`
|
||||
|
|
||||
= note: const parameters may not be used in enum discriminant values
|
||||
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:12:17
|
||||
|
|
||||
LL | Variant = { N + 1 },
|
||||
| ^ cannot perform const operation using `N`
|
||||
|
|
||||
= note: const parameters may not be used in enum discriminant values
|
||||
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:18:37
|
||||
|
|
||||
LL | Variant = { std::mem::size_of::<T>() as isize },
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/variant-discrimiant-no-generics.rs:25:17
|
||||
|
|
||||
LL | let a: &'a ();
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: lifetime parameters may not be used in enum discriminant values
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
32
tests/ui/const-generics/variant-discrimiant-no-generics.rs
Normal file
32
tests/ui/const-generics/variant-discrimiant-no-generics.rs
Normal file
@ -0,0 +1,32 @@
|
||||
// revisions: full min
|
||||
|
||||
#![cfg_attr(full, feature(generic_const_exprs))]
|
||||
#![cfg_attr(full, allow(incomplete_features))]
|
||||
|
||||
enum Foo<const N: isize> {
|
||||
Variant = N,
|
||||
//~^ ERROR: generic parameters may not be used in enum discriminant values
|
||||
}
|
||||
|
||||
enum Owo<const N: isize> {
|
||||
Variant = { N + 1 },
|
||||
//~^ ERROR: generic parameters may not be used in enum discriminant values
|
||||
}
|
||||
|
||||
#[repr(isize)]
|
||||
enum Bar<T> {
|
||||
Variant = { std::mem::size_of::<T>() as isize },
|
||||
Other(T), //~^ ERROR: generic parameters may not be used in enum discriminant values
|
||||
}
|
||||
|
||||
#[repr(isize)]
|
||||
enum UwU<'a> {
|
||||
Variant = {
|
||||
let a: &'a ();
|
||||
//~^ ERROR: generic parameters may not be used in enum discriminant values
|
||||
10_isize
|
||||
},
|
||||
Other(&'a ()),
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -7,7 +7,7 @@ use core::intrinsics::discriminant_value;
|
||||
enum MyWeirdOption<T> {
|
||||
None = 0,
|
||||
Some(T) = std::mem::size_of::<T>(),
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
//~^ ERROR generic parameters may not be used in enum discriminant values
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: generic parameters may not be used in const operations
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/issue-70453-generics-in-discr-ice-2.rs:9:35
|
||||
|
|
||||
LL | Some(T) = std::mem::size_of::<T>(),
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,7 +8,7 @@ enum MyWeirdOption<T> {
|
||||
//~^ ERROR parameter `T` is never used
|
||||
None = 0,
|
||||
Some = std::mem::size_of::<T>(),
|
||||
//~^ ERROR generic parameters may not be used in const operations
|
||||
//~^ ERROR generic parameters may not be used in enum discriminant values
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: generic parameters may not be used in const operations
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/issue-70453-generics-in-discr-ice.rs:10:32
|
||||
|
|
||||
LL | Some = std::mem::size_of::<T>(),
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error[E0392]: parameter `T` is never used
|
||||
--> $DIR/issue-70453-generics-in-discr-ice.rs:7:20
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: generic parameters may not be used in const operations
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/issue-70453-polymorphic-ctfe.rs:9:41
|
||||
|
|
||||
LL | Some(T) = core::mem::size_of::<*mut T>(),
|
||||
| ^ cannot perform const operation using `T`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: generic parameters may not be used in const operations
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/issue-67945-1.rs:3:16
|
||||
|
|
||||
LL | let x: S = 0;
|
||||
| ^ cannot perform const operation using `S`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error[E0392]: parameter `S` is never used
|
||||
--> $DIR/issue-67945-1.rs:1:10
|
||||
|
@ -1,11 +1,10 @@
|
||||
error: generic parameters may not be used in const operations
|
||||
error: generic parameters may not be used in enum discriminant values
|
||||
--> $DIR/issue-67945-2.rs:4:28
|
||||
|
|
||||
LL | Var = type_ascribe!(0, S),
|
||||
| ^ cannot perform const operation using `S`
|
||||
|
|
||||
= note: type parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
= note: type parameters may not be used in enum discriminant values
|
||||
|
||||
error[E0392]: parameter `S` is never used
|
||||
--> $DIR/issue-67945-2.rs:3:10
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![feature(adt_const_params)]
|
||||
//~^ WARN the feature `adt_const_params` is incomplete
|
||||
|
||||
fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0771
|
||||
fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0770
|
||||
|
||||
fn main() {
|
||||
function_with_str::<"Hello, world!">()
|
||||
|
@ -1,10 +1,10 @@
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/E0771.rs:4:41
|
||||
|
|
||||
LL | fn function_with_str<'a, const STRING: &'a str>() {}
|
||||
| ^^
|
||||
| ^^ the type must not depend on the parameter `'a`
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
= note: lifetime parameters may not be used in the type of const parameters
|
||||
|
||||
warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/E0771.rs:1:12
|
||||
@ -17,4 +17,4 @@ LL | #![feature(adt_const_params)]
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0771`.
|
||||
For more information about this error, try `rustc --explain E0770`.
|
||||
|
@ -13,7 +13,7 @@ const fn foo<T>() -> usize {
|
||||
}
|
||||
|
||||
struct Bar<'a> { //~ ERROR: parameter `'a` is never used
|
||||
beta: [(); foo::<&'a ()>()], //~ ERROR: a non-static lifetime is not allowed in a `const`
|
||||
beta: [(); foo::<&'a ()>()], //~ ERROR: generic parameters may not be used in const operations
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,11 +1,11 @@
|
||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||
error: generic parameters may not be used in const operations
|
||||
--> $DIR/issue-64173-unused-lifetimes.rs:16:23
|
||||
|
|
||||
LL | beta: [(); foo::<&'a ()>()],
|
||||
| ^^
|
||||
| ^^ cannot perform const operation using `'a`
|
||||
|
|
||||
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||
= note: lifetime parameters may not be used in const expressions
|
||||
= help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
|
||||
|
||||
error: generic `Self` types are currently not permitted in anonymous constants
|
||||
--> $DIR/issue-64173-unused-lifetimes.rs:4:28
|
||||
@ -31,5 +31,4 @@ LL | struct Bar<'a> {
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0392, E0658.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
For more information about this error, try `rustc --explain E0392`.
|
||||
|
@ -27,7 +27,7 @@ fn d<const C: S>() {}
|
||||
|
||||
trait Foo<'a> {}
|
||||
struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||
//~^ ERROR use of non-static lifetime `'a` in const generic
|
||||
//~^ ERROR the type of const parameters must not depend on other generic parameters
|
||||
//~| ERROR `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter
|
||||
|
||||
fn main() {}
|
||||
|
@ -9,13 +9,13 @@ help: consider introducing a named lifetime parameter
|
||||
LL | fn d<'a, const C: S<'a>>() {}
|
||||
| +++ ++++
|
||||
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
error[E0770]: the type of const parameters must not depend on other generic parameters
|
||||
--> $DIR/unusual-rib-combinations.rs:29:22
|
||||
|
|
||||
LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||
| ^^
|
||||
| ^^ the type must not depend on the parameter `'a`
|
||||
|
|
||||
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
|
||||
= note: lifetime parameters may not be used in the type of const parameters
|
||||
|
||||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
|
||||
--> $DIR/unusual-rib-combinations.rs:7:16
|
||||
@ -74,5 +74,5 @@ LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>;
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0214, E0308, E0771.
|
||||
Some errors have detailed explanations: E0106, E0214, E0308, E0770.
|
||||
For more information about an error, try `rustc --explain E0106`.
|
||||
|
Loading…
Reference in New Issue
Block a user