Auto merge of #134137 - fmease:rollup-u1p7swx, r=fmease

Rollup of 9 pull requests

Successful merges:

 - #133583 (Fix type (exit → exist))
 - #134042 (Add the `power8-crypto` target feature)
 - #134094 (Tweak wording of non-const traits used as const bounds)
 - #134100 (Remove rustc_const_stable attribute on const NOOP)
 - #134103 (Don't ICE when encountering never in range pattern)
 - #134113 (run-make: Fix `assert_stderr_not_contains_regex`)
 - #134115 (rustc_target: ppc64 target string fixes for LLVM 20)
 - #134116 (stabilize const_nonnull_new)
 - #134120 (Remove Felix from ping groups and review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-12-11 05:31:46 +00:00
commit 5a6036a180
73 changed files with 1176 additions and 214 deletions

View file

@ -159,6 +159,11 @@ pub(crate) unsafe fn create_module<'ll>(
// See https://github.com/llvm/llvm-project/pull/112084 // See https://github.com/llvm/llvm-project/pull/112084
target_data_layout = target_data_layout.replace("-i128:128", ""); target_data_layout = target_data_layout.replace("-i128:128", "");
} }
if sess.target.arch.starts_with("powerpc64") {
// LLVM 20 updates the powerpc64 layout to correctly align 128 bit integers to 128 bit.
// See https://github.com/llvm/llvm-project/pull/118004
target_data_layout = target_data_layout.replace("-i128:128", "");
}
} }
// Ensure the data-layout values hardcoded remain the defaults. // Ensure the data-layout values hardcoded remain the defaults.

View file

@ -230,6 +230,8 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
"aarch64" "aarch64"
} else if sess.target.arch == "sparc64" { } else if sess.target.arch == "sparc64" {
"sparc" "sparc"
} else if sess.target.arch == "powerpc64" {
"powerpc"
} else { } else {
&*sess.target.arch &*sess.target.arch
}; };
@ -289,6 +291,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
// https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26 // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26
("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")), ("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")),
("sparc", "v8plus") if get_version().0 < 19 => None, ("sparc", "v8plus") if get_version().0 < 19 => None,
("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")),
(_, s) => Some(LLVMFeature::new(s)), (_, s) => Some(LLVMFeature::new(s)),
} }
} }

View file

@ -96,12 +96,14 @@ hir_analysis_coercion_between_struct_same_note = expected coercion between the s
hir_analysis_coercion_between_struct_single_note = expected a single field to be coerced, none found hir_analysis_coercion_between_struct_single_note = expected a single field to be coerced, none found
hir_analysis_const_bound_for_non_const_trait = hir_analysis_const_bound_for_non_const_trait = `{$modifier}` can only be applied to `#[const_trait]` traits
`{$modifier}` can only be applied to `#[const_trait]` traits .label = can't be applied to `{$trait_name}`
.note = `{$trait_name}` can't be used with `{$modifier}` because it isn't annotated with `#[const_trait]`
.suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations
hir_analysis_const_impl_for_non_const_trait = hir_analysis_const_impl_for_non_const_trait = const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]`
const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]` .label = this trait is not `const`
.suggestion = mark `{$trait_name}` as const .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations
.note = marking a trait with `#[const_trait]` ensures all default method bodies are `const` .note = marking a trait with `#[const_trait]` ensures all default method bodies are `const`
.adding = adding a non-const method body in the future would be a breaking change .adding = adding a non-const method body in the future would be a breaking change

View file

@ -1638,11 +1638,23 @@ fn check_impl_constness(
} }
let trait_name = tcx.item_name(trait_def_id).to_string(); let trait_name = tcx.item_name(trait_def_id).to_string();
let (local_trait_span, suggestion_pre) =
match (trait_def_id.is_local(), tcx.sess.is_nightly_build()) {
(true, true) => (
Some(tcx.def_span(trait_def_id).shrink_to_lo()),
if tcx.features().const_trait_impl() {
""
} else {
"enable `#![feature(const_trait_impl)]` in your crate and "
},
),
(false, _) | (_, false) => (None, ""),
};
Some(tcx.dcx().emit_err(errors::ConstImplForNonConstTrait { Some(tcx.dcx().emit_err(errors::ConstImplForNonConstTrait {
trait_ref_span: hir_trait_ref.path.span, trait_ref_span: hir_trait_ref.path.span,
trait_name, trait_name,
local_trait_span: local_trait_span,
trait_def_id.as_local().map(|_| tcx.def_span(trait_def_id).shrink_to_lo()), suggestion_pre,
marking: (), marking: (),
adding: (), adding: (),
})) }))

View file

@ -530,10 +530,16 @@ pub(crate) struct GenericArgsOnOverriddenImpl {
#[diag(hir_analysis_const_impl_for_non_const_trait)] #[diag(hir_analysis_const_impl_for_non_const_trait)]
pub(crate) struct ConstImplForNonConstTrait { pub(crate) struct ConstImplForNonConstTrait {
#[primary_span] #[primary_span]
#[label]
pub trait_ref_span: Span, pub trait_ref_span: Span,
pub trait_name: String, pub trait_name: String,
#[suggestion(applicability = "machine-applicable", code = "#[const_trait]")] #[suggestion(
applicability = "machine-applicable",
code = "#[const_trait] ",
style = "verbose"
)]
pub local_trait_span: Option<Span>, pub local_trait_span: Option<Span>,
pub suggestion_pre: &'static str,
#[note] #[note]
pub marking: (), pub marking: (),
#[note(hir_analysis_adding)] #[note(hir_analysis_adding)]
@ -544,8 +550,19 @@ pub(crate) struct ConstImplForNonConstTrait {
#[diag(hir_analysis_const_bound_for_non_const_trait)] #[diag(hir_analysis_const_bound_for_non_const_trait)]
pub(crate) struct ConstBoundForNonConstTrait { pub(crate) struct ConstBoundForNonConstTrait {
#[primary_span] #[primary_span]
#[label]
pub span: Span, pub span: Span,
pub modifier: &'static str, pub modifier: &'static str,
#[note]
pub def_span: Option<Span>,
pub suggestion_pre: &'static str,
#[suggestion(
applicability = "machine-applicable",
code = "#[const_trait] ",
style = "verbose"
)]
pub suggestion: Option<Span>,
pub trait_name: String,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]

View file

@ -737,9 +737,26 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
if let hir::BoundConstness::Always(span) | hir::BoundConstness::Maybe(span) = constness if let hir::BoundConstness::Always(span) | hir::BoundConstness::Maybe(span) = constness
&& !self.tcx().is_const_trait(trait_def_id) && !self.tcx().is_const_trait(trait_def_id)
{ {
let (def_span, suggestion, suggestion_pre) =
match (trait_def_id.is_local(), self.tcx().sess.is_nightly_build()) {
(true, true) => (
None,
Some(tcx.def_span(trait_def_id).shrink_to_lo()),
if self.tcx().features().const_trait_impl() {
""
} else {
"enable `#![feature(const_trait_impl)]` in your crate and "
},
),
(false, _) | (_, false) => (Some(tcx.def_span(trait_def_id)), None, ""),
};
self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait { self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait {
span, span,
modifier: constness.as_str(), modifier: constness.as_str(),
def_span,
trait_name: self.tcx().def_path_str(trait_def_id),
suggestion_pre,
suggestion,
}); });
} }

View file

@ -403,6 +403,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}) })
| hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(..), .. }) => true, | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(..), .. }) => true,
hir::Node::Pat(_) => {
self.dcx().span_delayed_bug(expr.span, "place expr not allowed in pattern");
true
}
// These nodes do not have direct sub-exprs. // These nodes do not have direct sub-exprs.
hir::Node::Param(_) hir::Node::Param(_)
| hir::Node::Item(_) | hir::Node::Item(_)
@ -415,7 +420,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
| hir::Node::Ty(_) | hir::Node::Ty(_)
| hir::Node::AssocItemConstraint(_) | hir::Node::AssocItemConstraint(_)
| hir::Node::TraitRef(_) | hir::Node::TraitRef(_)
| hir::Node::Pat(_)
| hir::Node::PatField(_) | hir::Node::PatField(_)
| hir::Node::LetStmt(_) | hir::Node::LetStmt(_)
| hir::Node::Synthetic | hir::Node::Synthetic

View file

@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
std: None, // ? std: None, // ?
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "E-m:a-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(), data_layout: "E-m:a-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: base, options: base,
} }

View file

@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "E-m:e-Fn32-i64:64-n32:64".into(), data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base }, options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
} }

View file

@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(), data_layout: "E-m:e-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base }, options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
} }

View file

@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "E-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(), data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base }, options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
} }

View file

@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "E-m:e-Fn32-i64:64-n32:64".into(), data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base }, options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
} }

View file

@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(), data_layout: "E-m:e-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { endian: Endian::Big, ..base }, options: TargetOptions { endian: Endian::Big, ..base },
} }

View file

@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-Fn32-i64:64-n32:64".into(), data_layout: "e-m:e-Fn32-i64:64-i128:128-n32:64".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { mcount: "_mcount".into(), ..base }, options: TargetOptions { mcount: "_mcount".into(), ..base },
} }

View file

@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(), data_layout: "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { mcount: "_mcount".into(), ..base }, options: TargetOptions { mcount: "_mcount".into(), ..base },
} }

View file

@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
std: Some(true), std: Some(true),
}, },
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(), data_layout: "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
arch: "powerpc64".into(), arch: "powerpc64".into(),
options: TargetOptions { mcount: "_mcount".into(), ..base }, options: TargetOptions { mcount: "_mcount".into(), ..base },
} }

View file

@ -412,6 +412,7 @@ const POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("partword-atomics", Unstable(sym::powerpc_target_feature), &[]), ("partword-atomics", Unstable(sym::powerpc_target_feature), &[]),
("power10-vector", Unstable(sym::powerpc_target_feature), &["power9-vector"]), ("power10-vector", Unstable(sym::powerpc_target_feature), &["power9-vector"]),
("power8-altivec", Unstable(sym::powerpc_target_feature), &["altivec"]), ("power8-altivec", Unstable(sym::powerpc_target_feature), &["altivec"]),
("power8-crypto", Unstable(sym::powerpc_target_feature), &["power8-altivec"]),
("power8-vector", Unstable(sym::powerpc_target_feature), &["vsx", "power8-altivec"]), ("power8-vector", Unstable(sym::powerpc_target_feature), &["vsx", "power8-altivec"]),
("power9-altivec", Unstable(sym::powerpc_target_feature), &["power8-altivec"]), ("power9-altivec", Unstable(sym::powerpc_target_feature), &["power8-altivec"]),
("power9-vector", Unstable(sym::powerpc_target_feature), &["power8-vector", "power9-altivec"]), ("power9-vector", Unstable(sym::powerpc_target_feature), &["power8-vector", "power9-altivec"]),

View file

@ -217,7 +217,7 @@ impl<T: ?Sized> NonNull<T> {
/// } /// }
/// ``` /// ```
#[stable(feature = "nonnull", since = "1.25.0")] #[stable(feature = "nonnull", since = "1.25.0")]
#[rustc_const_unstable(feature = "const_nonnull_new", issue = "93235")] #[rustc_const_stable(feature = "const_nonnull_new", since = "CURRENT_RUSTC_VERSION")]
#[inline] #[inline]
pub const fn new(ptr: *mut T) -> Option<Self> { pub const fn new(ptr: *mut T) -> Option<Self> {
if !ptr.is_null() { if !ptr.is_null() {

View file

@ -92,8 +92,6 @@ impl<T: ?Sized> Unique<T> {
/// Creates a new `Unique` if `ptr` is non-null. /// Creates a new `Unique` if `ptr` is non-null.
#[inline] #[inline]
// rustc_const_unstable attribute can be removed when `const_nonnull_new` is stable
#[rustc_const_unstable(feature = "ptr_internals", issue = "none")]
pub const fn new(ptr: *mut T) -> Option<Self> { pub const fn new(ptr: *mut T) -> Option<Self> {
if let Some(pointer) = NonNull::new(ptr) { if let Some(pointer) = NonNull::new(ptr) {
Some(Unique { pointer, _marker: PhantomData }) Some(Unique { pointer, _marker: PhantomData })

View file

@ -61,7 +61,6 @@ impl RawWaker {
} }
#[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")] #[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
const NOOP: RawWaker = { const NOOP: RawWaker = {
const VTABLE: RawWakerVTable = RawWakerVTable::new( const VTABLE: RawWakerVTable = RawWakerVTable::new(
// Cloning just returns a new no-op raw waker // Cloning just returns a new no-op raw waker

View file

@ -15,7 +15,6 @@
#![feature(clone_to_uninit)] #![feature(clone_to_uninit)]
#![feature(const_black_box)] #![feature(const_black_box)]
#![feature(const_eval_select)] #![feature(const_eval_select)]
#![feature(const_nonnull_new)]
#![feature(const_swap)] #![feature(const_swap)]
#![feature(const_trait_impl)] #![feature(const_trait_impl)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]

View file

@ -329,7 +329,7 @@ impl CompletedProcess {
/// Checks that `stderr` does not contain the regex pattern `unexpected`. /// Checks that `stderr` does not contain the regex pattern `unexpected`.
#[track_caller] #[track_caller]
pub fn assert_stderr_not_contains_regex<S: AsRef<str>>(&self, unexpected: S) -> &Self { pub fn assert_stderr_not_contains_regex<S: AsRef<str>>(&self, unexpected: S) -> &Self {
assert_not_contains_regex(&self.stdout_utf8(), unexpected); assert_not_contains_regex(&self.stderr_utf8(), unexpected);
self self
} }

View file

@ -0,0 +1,66 @@
error: `~const` is not allowed here
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> const-super-trait.rs:7:1
|
LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:9:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:9:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> const-super-trait.rs:10:7
|
LL | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -0,0 +1,45 @@
error: `~const` is not allowed here
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> const-super-trait.rs:7:1
|
LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:7:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:9:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> const-super-trait.rs:10:7
|
LL | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0015`.

View file

@ -0,0 +1,64 @@
error: `~const` is not allowed here
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^
|
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
error[E0658]: const trait impls are experimental
--> const-super-trait.rs:9:17
|
9 | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> const-super-trait.rs:3:1
|
3 | trait Foo {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:9:17
|
9 | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> const-super-trait.rs:10:7
|
10 | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -0,0 +1,54 @@
error: `~const` is not allowed here
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^
|
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0554]: `#![feature]` may not be used on the NIGHTLY release channel
--> const-super-trait.rs:1:30
|
1 | #![cfg_attr(feature_enabled, feature(const_trait_impl))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:7:12
|
7 | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> const-super-trait.rs:3:1
|
3 | trait Foo {
| ^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> const-super-trait.rs:9:17
|
9 | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> const-super-trait.rs:7:1
|
7 | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> const-super-trait.rs:10:7
|
10 | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0015, E0554.
For more information about an error, try `rustc --explain E0015`.

View file

@ -0,0 +1,13 @@
#![cfg_attr(feature_enabled, feature(const_trait_impl))]
trait Foo {
fn a(&self);
}
trait Bar: ~const Foo {}
const fn foo<T: ~const Bar>(x: &T) {
x.a();
}
fn main() {}

View file

@ -0,0 +1,59 @@
// Test output of const super trait errors in both stable and nightly.
// We don't want to provide suggestions on stable that only make sense in nightly.
use run_make_support::{diff, rustc};
fn main() {
let out = rustc()
.input("const-super-trait.rs")
.env("RUSTC_BOOTSTRAP", "-1")
.cfg("feature_enabled")
.run_fail()
.assert_stderr_not_contains(
"as `#[const_trait]` to allow it to have `const` implementations",
)
.stderr_utf8();
diff()
.expected_file("const-super-trait-stable-enabled.stderr")
.normalize(
"may not be used on the .* release channel",
"may not be used on the NIGHTLY release channel",
)
.actual_text("(rustc)", &out)
.run();
let out = rustc()
.input("const-super-trait.rs")
.cfg("feature_enabled")
.ui_testing()
.run_fail()
.assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark")
.assert_stderr_contains("as `#[const_trait]` to allow it to have `const` implementations")
.stderr_utf8();
diff()
.expected_file("const-super-trait-nightly-enabled.stderr")
.actual_text("(rustc)", &out)
.run();
let out = rustc()
.input("const-super-trait.rs")
.env("RUSTC_BOOTSTRAP", "-1")
.run_fail()
.assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark")
.assert_stderr_not_contains(
"as `#[const_trait]` to allow it to have `const` implementations",
)
.stderr_utf8();
diff()
.expected_file("const-super-trait-stable-disabled.stderr")
.actual_text("(rustc)", &out)
.run();
let out = rustc()
.input("const-super-trait.rs")
.ui_testing()
.run_fail()
.assert_stderr_contains("enable `#![feature(const_trait_impl)]` in your crate and mark")
.stderr_utf8();
diff()
.expected_file("const-super-trait-nightly-disabled.stderr")
.actual_text("(rustc)", &out)
.run();
}

View file

@ -153,6 +153,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`popcnt` `popcnt`
`power10-vector` `power10-vector`
`power8-altivec` `power8-altivec`
`power8-crypto`
`power8-vector` `power8-vector`
`power9-altivec` `power9-altivec`
`power9-vector` `power9-vector`

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
--> $DIR/const-try.rs:15:12 --> $DIR/const-try.rs:15:12
| |
LL | impl const FromResidual<Error> for TryMe { LL | impl const FromResidual<Error> for TryMe {
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -11,7 +11,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
--> $DIR/const-try.rs:22:12 --> $DIR/const-try.rs:22:12
| |
LL | impl const Try for TryMe { LL | impl const Try for TryMe {
| ^^^ | ^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -14,110 +14,145 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:14:8 --> $DIR/fn_trait_refs.rs:14:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:14:8 --> $DIR/fn_trait_refs.rs:14:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:14:8 --> $DIR/fn_trait_refs.rs:14:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:21:8 --> $DIR/fn_trait_refs.rs:21:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
|
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:21:8 --> $DIR/fn_trait_refs.rs:21:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
| |
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:21:8 --> $DIR/fn_trait_refs.rs:21:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
| |
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:28:8 --> $DIR/fn_trait_refs.rs:28:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
|
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:28:8 --> $DIR/fn_trait_refs.rs:28:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
| |
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:28:8 --> $DIR/fn_trait_refs.rs:28:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
| |
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:35:8 --> $DIR/fn_trait_refs.rs:35:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:35:8 --> $DIR/fn_trait_refs.rs:35:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:35:8 --> $DIR/fn_trait_refs.rs:35:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:49:8 --> $DIR/fn_trait_refs.rs:49:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
|
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:49:8 --> $DIR/fn_trait_refs.rs:49:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
| |
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/fn_trait_refs.rs:49:8 --> $DIR/fn_trait_refs.rs:49:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
| |
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
--> $DIR/rustc-impl-const-stability.rs:15:12 --> $DIR/rustc-impl-const-stability.rs:15:12
| |
LL | impl const Default for Data { LL | impl const Default for Data {
| ^^^^^^^ | ^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/unstable-const-fn-in-libcore.rs:19:32 --> $DIR/unstable-const-fn-in-libcore.rs:19:32
| |
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
|
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/unstable-const-fn-in-libcore.rs:19:32 --> $DIR/unstable-const-fn-in-libcore.rs:19:32
| |
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
| |
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const closure in constant functions error[E0015]: cannot call non-const closure in constant functions

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:26:35 --> $DIR/normalize-tait-in-const.rs:26:35
| |
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/normalize-tait-in-const.rs:26:35 --> $DIR/normalize-tait-in-const.rs:26:35
| |
LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied

View file

@ -0,0 +1,16 @@
// Regression test for <https://github.com/rust-lang/rust/issues/133947>.
// Make sure we don't ICE when there's `!` in a range pattern.
//
// This shouldn't be allowed anyways, but we only deny it during MIR
// building, so make sure we handle it semi-gracefully during typeck.
#![feature(never_type)]
fn main() {
let x: !;
match 1 {
0..x => {}
//~^ ERROR only `char` and numeric types are allowed in range patterns
}
}

View file

@ -0,0 +1,11 @@
error[E0029]: only `char` and numeric types are allowed in range patterns
--> $DIR/never-in-range-pat.rs:13:12
|
LL | 0..x => {}
| - ^ this is of type `!` but it should be `char` or numeric
| |
| this is of type `{integer}`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0029`.

View file

@ -1,7 +1,7 @@
// Tests that failing to run dlltool will raise an error. // Tests that failing to run dlltool will raise an error.
//@ needs-dlltool //@ needs-dlltool
//@ compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exit.exe //@ compile-flags: --crate-type lib --emit link -Cdlltool=does_not_exist.exe
#[link(name = "foo", kind = "raw-dylib")] #[link(name = "foo", kind = "raw-dylib")]
extern "C" { extern "C" {
fn f(x: i32); fn f(x: i32);

View file

@ -1,4 +1,4 @@
error: Error calling dlltool 'does_not_exit.exe': program not found error: Error calling dlltool 'does_not_exist.exe': program not found
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -2,42 +2,57 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:34:9 --> $DIR/const_trait_impl.rs:34:9
| |
LL | impl<T: ~const Default> const A for T { LL | impl<T: ~const Default> const A for T {
| ^^^^^^ | ^^^^^^ can't be applied to `Default`
|
note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/default.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:40:9 --> $DIR/const_trait_impl.rs:40:9
| |
LL | impl<T: ~const Default + ~const Sup> const A for T { LL | impl<T: ~const Default + ~const Sup> const A for T {
| ^^^^^^ | ^^^^^^ can't be applied to `Default`
|
note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/default.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:46:9 --> $DIR/const_trait_impl.rs:46:9
| |
LL | impl<T: ~const Default + ~const Sub> const A for T { LL | impl<T: ~const Default + ~const Sub> const A for T {
| ^^^^^^ | ^^^^^^ can't be applied to `Default`
|
note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/default.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:40:9 --> $DIR/const_trait_impl.rs:40:9
| |
LL | impl<T: ~const Default + ~const Sup> const A for T { LL | impl<T: ~const Default + ~const Sup> const A for T {
| ^^^^^^ | ^^^^^^ can't be applied to `Default`
| |
note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/default.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:34:9 --> $DIR/const_trait_impl.rs:34:9
| |
LL | impl<T: ~const Default> const A for T { LL | impl<T: ~const Default> const A for T {
| ^^^^^^ | ^^^^^^ can't be applied to `Default`
| |
note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/default.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const_trait_impl.rs:46:9 --> $DIR/const_trait_impl.rs:46:9
| |
LL | impl<T: ~const Default + ~const Sub> const A for T { LL | impl<T: ~const Default + ~const Sub> const A for T {
| ^^^^^^ | ^^^^^^ can't be applied to `Default`
| |
note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/default.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/call-const-trait-method-pass.rs:15:12 --> $DIR/call-const-trait-method-pass.rs:15:12
| |
LL | impl const PartialEq for Int { LL | impl const PartialEq for Int {
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-in-impl.rs:10:9 --> $DIR/call-generic-in-impl.rs:10:9
| |
LL | impl<T: ~const PartialEq> const MyPartialEq for T { LL | impl<T: ~const PartialEq> const MyPartialEq for T {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-in-impl.rs:10:9 --> $DIR/call-generic-in-impl.rs:10:9
| |
LL | impl<T: ~const PartialEq> const MyPartialEq for T { LL | impl<T: ~const PartialEq> const MyPartialEq for T {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
| |
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const fn `<T as PartialEq>::eq` in constant functions error[E0015]: cannot call non-const fn `<T as PartialEq>::eq` in constant functions

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/call-generic-method-chain.rs:11:12 --> $DIR/call-generic-method-chain.rs:11:12
| |
LL | impl const PartialEq for S { LL | impl const PartialEq for S {
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:20:25 --> $DIR/call-generic-method-chain.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:20:25 --> $DIR/call-generic-method-chain.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
| |
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:24:33 --> $DIR/call-generic-method-chain.rs:24:33
| |
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-chain.rs:24:33 --> $DIR/call-generic-method-chain.rs:24:33
| |
LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
| |
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const operator in constant functions error[E0015]: cannot call non-const operator in constant functions

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/call-generic-method-dup-bound.rs:9:12 --> $DIR/call-generic-method-dup-bound.rs:9:12
| |
LL | impl const PartialEq for S { LL | impl const PartialEq for S {
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:20:37 --> $DIR/call-generic-method-dup-bound.rs:20:37
| |
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:20:37 --> $DIR/call-generic-method-dup-bound.rs:20:37
| |
LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
| |
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:27:30 --> $DIR/call-generic-method-dup-bound.rs:27:30
| |
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-dup-bound.rs:27:30 --> $DIR/call-generic-method-dup-bound.rs:27:30
| |
LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
| |
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const operator in constant functions error[E0015]: cannot call non-const operator in constant functions

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/call-generic-method-pass.rs:11:12 --> $DIR/call-generic-method-pass.rs:11:12
| |
LL | impl const PartialEq for S { LL | impl const PartialEq for S {
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -11,14 +11,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:20:25 --> $DIR/call-generic-method-pass.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/call-generic-method-pass.rs:20:25 --> $DIR/call-generic-method-pass.rs:20:25
| |
LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
| ^^^^^^ | ^^^^^^ can't be applied to `PartialEq`
| |
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const operator in constant functions error[E0015]: cannot call non-const operator in constant functions

View file

@ -2,21 +2,35 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:21 --> $DIR/const-bounds-non-const-trait.rs:6:21
| |
LL | const fn perform<T: ~const NonConst>() {} LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^ | ^^^^^^ can't be applied to `NonConst`
|
help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait NonConst {}
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:21 --> $DIR/const-bounds-non-const-trait.rs:6:21
| |
LL | const fn perform<T: ~const NonConst>() {} LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^ | ^^^^^^ can't be applied to `NonConst`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait NonConst {}
| ++++++++++++++
error: `const` can only be applied to `#[const_trait]` traits error: `const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:10:15 --> $DIR/const-bounds-non-const-trait.rs:10:15
| |
LL | fn operate<T: const NonConst>() {} LL | fn operate<T: const NonConst>() {}
| ^^^^^ | ^^^^^ can't be applied to `NonConst`
|
help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait NonConst {}
| ++++++++++++++
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -2,22 +2,29 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-parse-not-item.rs:7:25 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-parse-not-item.rs:7:25 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-parse-not-item.rs:7:25 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method-fail.rs:14:32 --> $DIR/const-closure-trait-method-fail.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
|
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method-fail.rs:14:32 --> $DIR/const-closure-trait-method-fail.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
| |
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const closure in constant functions error[E0015]: cannot call non-const closure in constant functions

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method.rs:14:32 --> $DIR/const-closure-trait-method.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
|
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closure-trait-method.rs:14:32 --> $DIR/const-closure-trait-method.rs:14:32
| |
LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
| |
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const closure in constant functions error[E0015]: cannot call non-const closure in constant functions

View file

@ -2,56 +2,76 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:8:12 --> $DIR/const-closures.rs:8:12
| |
LL | F: ~const FnOnce() -> u8, LL | F: ~const FnOnce() -> u8,
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
|
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:9:12 --> $DIR/const-closures.rs:9:12
| |
LL | F: ~const FnMut() -> u8, LL | F: ~const FnMut() -> u8,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
|
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:10:12 --> $DIR/const-closures.rs:10:12
| |
LL | F: ~const Fn() -> u8, LL | F: ~const Fn() -> u8,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:8:12 --> $DIR/const-closures.rs:8:12
| |
LL | F: ~const FnOnce() -> u8, LL | F: ~const FnOnce() -> u8,
| ^^^^^^ | ^^^^^^ can't be applied to `FnOnce`
| |
note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:9:12 --> $DIR/const-closures.rs:9:12
| |
LL | F: ~const FnMut() -> u8, LL | F: ~const FnMut() -> u8,
| ^^^^^^ | ^^^^^^ can't be applied to `FnMut`
| |
note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:10:12 --> $DIR/const-closures.rs:10:12
| |
LL | F: ~const Fn() -> u8, LL | F: ~const Fn() -> u8,
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:23:20 --> $DIR/const-closures.rs:23:20
| |
LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-closures.rs:23:20 --> $DIR/const-closures.rs:23:20
| |
LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const closure in constant functions error[E0015]: cannot call non-const closure in constant functions

View file

@ -1,14 +1,15 @@
error: const `impl` for trait `A` which is not marked with `#[const_trait]` error: const `impl` for trait `A` which is not marked with `#[const_trait]`
--> $DIR/const-impl-requires-const-trait.rs:6:12 --> $DIR/const-impl-requires-const-trait.rs:6:12
| |
LL | pub trait A {}
| - help: mark `A` as const: `#[const_trait]`
LL |
LL | impl const A for () {} LL | impl const A for () {}
| ^ | ^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
help: mark `A` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] pub trait A {}
| ++++++++++++++
error: aborting due to 1 previous error error: aborting due to 1 previous error

View file

@ -11,7 +11,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
--> $DIR/derive-const-gate.rs:1:16 --> $DIR/derive-const-gate.rs:1:16
| |
LL | #[derive_const(Default)] LL | #[derive_const(Default)]
| ^^^^^^^ | ^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
--> $DIR/derive-const-non-const-type.rs:10:16 --> $DIR/derive-const-non-const-type.rs:10:16
| |
LL | #[derive_const(Default)] LL | #[derive_const(Default)]
| ^^^^^^^ | ^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -14,7 +14,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
--> $DIR/derive-const-use.rs:7:12 --> $DIR/derive-const-use.rs:7:12
| |
LL | impl const Default for A { LL | impl const Default for A {
| ^^^^^^^ | ^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -23,7 +23,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
--> $DIR/derive-const-use.rs:15:16 --> $DIR/derive-const-use.rs:15:16
| |
LL | #[derive_const(Default, PartialEq)] LL | #[derive_const(Default, PartialEq)]
| ^^^^^^^ | ^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -33,7 +33,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/derive-const-use.rs:11:12 --> $DIR/derive-const-use.rs:11:12
| |
LL | impl const PartialEq for A { LL | impl const PartialEq for A {
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -42,7 +42,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/derive-const-use.rs:15:25 --> $DIR/derive-const-use.rs:15:25
| |
LL | #[derive_const(Default, PartialEq)] LL | #[derive_const(Default, PartialEq)]
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -2,13 +2,16 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
--> $DIR/derive-const-with-params.rs:7:16 --> $DIR/derive-const-with-params.rs:7:16
| |
LL | #[derive_const(PartialEq)] LL | #[derive_const(PartialEq)]
| ^^^^^^^^^ | ^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
|
note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/cmp.rs:LL:COL
error[E0015]: cannot call non-const operator in constant functions error[E0015]: cannot call non-const operator in constant functions
--> $DIR/derive-const-with-params.rs:8:23 --> $DIR/derive-const-with-params.rs:8:23

View file

@ -12,22 +12,29 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-112822-expected-type-for-param.rs:3:25 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-112822-expected-type-for-param.rs:3:25 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-112822-expected-type-for-param.rs:3:25 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const operator in constant functions error[E0015]: cannot call non-const operator in constant functions

View file

@ -1,32 +1,39 @@
error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
--> $DIR/spec-effectvar-ice.rs:10:15 --> $DIR/spec-effectvar-ice.rs:10:15
| |
LL | trait Foo {}
| - help: mark `Foo` as const: `#[const_trait]`
LL |
LL | impl<T> const Foo for T {} LL | impl<T> const Foo for T {}
| ^^^ | ^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {}
| ++++++++++++++
error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
--> $DIR/spec-effectvar-ice.rs:13:15 --> $DIR/spec-effectvar-ice.rs:13:15
| |
LL | trait Foo {}
| - help: mark `Foo` as const: `#[const_trait]`
...
LL | impl<T> const Foo for T where T: const Specialize {} LL | impl<T> const Foo for T where T: const Specialize {}
| ^^^ | ^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {}
| ++++++++++++++
error: `const` can only be applied to `#[const_trait]` traits error: `const` can only be applied to `#[const_trait]` traits
--> $DIR/spec-effectvar-ice.rs:13:34 --> $DIR/spec-effectvar-ice.rs:13:34
| |
LL | impl<T> const Foo for T where T: const Specialize {} LL | impl<T> const Foo for T where T: const Specialize {}
| ^^^^^ | ^^^^^ can't be applied to `Specialize`
|
help: mark `Specialize` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Specialize {}
| ++++++++++++++
error: specialization impl does not specialize any associated items error: specialization impl does not specialize any associated items
--> $DIR/spec-effectvar-ice.rs:13:1 --> $DIR/spec-effectvar-ice.rs:13:1

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
--> $DIR/ice-119717-constant-lifetime.rs:6:15 --> $DIR/ice-119717-constant-lifetime.rs:6:15
| |
LL | impl<T> const FromResidual for T { LL | impl<T> const FromResidual for T {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-123664-unexpected-bound-var.rs:4:27 --> $DIR/ice-123664-unexpected-bound-var.rs:4:27
| |
LL | const fn with_positive<F: ~const Fn()>() {} LL | const fn with_positive<F: ~const Fn()>() {}
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
|
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/ice-123664-unexpected-bound-var.rs:4:27 --> $DIR/ice-123664-unexpected-bound-var.rs:4:27
| |
LL | const fn with_positive<F: ~const Fn()>() {} LL | const fn with_positive<F: ~const Fn()>() {}
| ^^^^^^ | ^^^^^^ can't be applied to `Fn`
| |
note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
--> $DIR/ice-126148-failed-to-normalize.rs:8:12 --> $DIR/ice-126148-failed-to-normalize.rs:8:12
| |
LL | impl const FromResidual<Error> for TryMe {} LL | impl const FromResidual<Error> for TryMe {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -19,7 +19,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
--> $DIR/ice-126148-failed-to-normalize.rs:12:12 --> $DIR/ice-126148-failed-to-normalize.rs:12:12
| |
LL | impl const Try for TryMe { LL | impl const Try for TryMe {
| ^^^ | ^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/non-const-op-in-closure-in-const.rs:10:44 --> $DIR/non-const-op-in-closure-in-const.rs:10:44
| |
LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { LL | impl<A, B> const Convert<B> for A where B: ~const From<A> {
| ^^^^^^ | ^^^^^^ can't be applied to `From`
|
note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/non-const-op-in-closure-in-const.rs:10:44 --> $DIR/non-const-op-in-closure-in-const.rs:10:44
| |
LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { LL | impl<A, B> const Convert<B> for A where B: ~const From<A> {
| ^^^^^^ | ^^^^^^ can't be applied to `From`
| |
note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]`
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const fn `<B as From<A>>::from` in constant functions error[E0015]: cannot call non-const fn `<B as From<A>>::from` in constant functions

View file

@ -14,23 +14,36 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
|
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-2.rs:20:7 --> $DIR/super-traits-fail-2.rs:20:7

View file

@ -2,39 +2,60 @@ error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
|
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-2.rs:11:12 --> $DIR/super-traits-fail-2.rs:11:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-2.rs:20:7 --> $DIR/super-traits-fail-2.rs:20:7

View file

@ -0,0 +1,102 @@
error: `~const` is not allowed here
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> $DIR/super-traits-fail-3.rs:23:1
|
LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:36:7
|
LL | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -0,0 +1,102 @@
error: `~const` is not allowed here
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> $DIR/super-traits-fail-3.rs:23:1
|
LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ can't be applied to `Bar`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:36:7
|
LL | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -1,49 +0,0 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:24:7
|
LL | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0015`.

View file

@ -0,0 +1,53 @@
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
--> $DIR/super-traits-fail-3.rs:15:37
|
LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)]
| ^^^^^^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
--> $DIR/super-traits-fail-3.rs:21:37
|
LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
| ^^^^^^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:36:5
|
LL | x.a();
| ^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,53 @@
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: const trait impls are experimental
--> $DIR/super-traits-fail-3.rs:32:17
|
LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
--> $DIR/super-traits-fail-3.rs:15:37
|
LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)]
| ^^^^^^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
--> $DIR/super-traits-fail-3.rs:21:37
|
LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
| ^^^^^^^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:36:5
|
LL | x.a();
| ^^^^^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,29 +1,42 @@
//@ compile-flags: -Znext-solver //@ compile-flags: -Znext-solver
#![feature(const_trait_impl)] #![cfg_attr(any(yyy, yyn, yny, ynn), feature(const_trait_impl))]
//@ revisions: yy yn ny nn //@ revisions: yyy yyn yny ynn nyy nyn nny nnn
//@[yy] check-pass //@[yyy] check-pass
/// yyy: feature enabled, Foo is const, Bar is const
/// yyn: feature enabled, Foo is const, Bar is not const
/// yny: feature enabled, Foo is not const, Bar is const
/// ynn: feature enabled, Foo is not const, Bar is not const
/// nyy: feature not enabled, Foo is const, Bar is const
/// nyn: feature not enabled, Foo is const, Bar is not const
/// nny: feature not enabled, Foo is not const, Bar is const
/// nnn: feature not enabled, Foo is not const, Bar is not const
#[cfg_attr(any(yy, yn), const_trait)] #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)]
//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future
trait Foo { trait Foo {
fn a(&self); fn a(&self);
} }
#[cfg_attr(any(yy, ny), const_trait)] #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future
trait Bar: ~const Foo {} trait Bar: ~const Foo {}
//[ny,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]` //[yny,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]`
//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` //[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]`
//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` //[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]`
//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]` //[yny]~^^^^ ERROR: `~const` can only be applied to `#[const_trait]`
//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]` //[yny]~| ERROR: `~const` can only be applied to `#[const_trait]`
//[yn,nn]~^^^^^^ ERROR: `~const` is not allowed here //[yyn,ynn,nny,nnn]~^^^^^^ ERROR: `~const` is not allowed here
//[nyy,nyn,nny,nnn]~^^^^^^^ ERROR: const trait impls are experimental
const fn foo<T: ~const Bar>(x: &T) { const fn foo<T: ~const Bar>(x: &T) {
//[yn,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]` //[yyn,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]`
//[yn,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` //[yyn,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]`
//[nyy,nyn,nny,nnn]~^^^ ERROR: const trait impls are experimental
x.a(); x.a();
//[yn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied //[yyn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied
//[nn,ny]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions //[ynn,yny,nny,nnn]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions
//[nyy,nyn]~^^^ ERROR: cannot call conditionally-const method `<T as Foo>::a` in constant functions
} }
fn main() {} fn main() {}

View file

@ -1,53 +1,75 @@
error: `~const` is not allowed here error: `~const` is not allowed here
--> $DIR/super-traits-fail-3.rs:13:12 --> $DIR/super-traits-fail-3.rs:23:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^
| |
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> $DIR/super-traits-fail-3.rs:13:1 --> $DIR/super-traits-fail-3.rs:23:1
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12 --> $DIR/super-traits-fail-3.rs:23:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
|
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12 --> $DIR/super-traits-fail-3.rs:23:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:13:12 --> $DIR/super-traits-fail-3.rs:23:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^ can't be applied to `Foo`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:21:17 --> $DIR/super-traits-fail-3.rs:32:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ | ^^^^^^ can't be applied to `Bar`
|
help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:21:17 --> $DIR/super-traits-fail-3.rs:32:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ | ^^^^^^ can't be applied to `Bar`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:24:7 --> $DIR/super-traits-fail-3.rs:36:7
| |
LL | x.a(); LL | x.a();
| ^^^ | ^^^

View file

@ -0,0 +1,70 @@
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:23:12
|
LL | trait Bar: ~const Foo {}
| ^^^^^^ can't be applied to `Foo`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Foo {
| ++++++++++++++
error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
--> $DIR/super-traits-fail-3.rs:36:7
|
LL | x.a();
| ^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0015`.

View file

@ -1,31 +1,40 @@
error: `~const` is not allowed here error: `~const` is not allowed here
--> $DIR/super-traits-fail-3.rs:13:12 --> $DIR/super-traits-fail-3.rs:23:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^ | ^^^^^^
| |
note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
--> $DIR/super-traits-fail-3.rs:13:1 --> $DIR/super-traits-fail-3.rs:23:1
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:21:17 --> $DIR/super-traits-fail-3.rs:32:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ | ^^^^^^ can't be applied to `Bar`
|
help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/super-traits-fail-3.rs:21:17 --> $DIR/super-traits-fail-3.rs:32:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^^^^ | ^^^^^^ can't be applied to `Bar`
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait Bar: ~const Foo {}
| ++++++++++++++
error[E0277]: the trait bound `T: ~const Foo` is not satisfied error[E0277]: the trait bound `T: ~const Foo` is not satisfied
--> $DIR/super-traits-fail-3.rs:24:7 --> $DIR/super-traits-fail-3.rs:36:7
| |
LL | x.a(); LL | x.a();
| ^ | ^

View file

@ -2,7 +2,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
--> $DIR/trait-default-body-stability.rs:19:12 --> $DIR/trait-default-body-stability.rs:19:12
| |
LL | impl const Try for T { LL | impl const Try for T {
| ^^^ | ^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change
@ -11,7 +11,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
--> $DIR/trait-default-body-stability.rs:34:12 --> $DIR/trait-default-body-stability.rs:34:12
| |
LL | impl const FromResidual for T { LL | impl const FromResidual for T {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^ this trait is not `const`
| |
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
= note: adding a non-const method body in the future would be a breaking change = note: adding a non-const method body in the future would be a breaking change

View file

@ -1014,7 +1014,6 @@ compiler = [
"@Noratrieb", "@Noratrieb",
"@oli-obk", "@oli-obk",
"@petrochenkov", "@petrochenkov",
"@pnkfelix",
"@SparrowLii", "@SparrowLii",
"@wesleywiser", "@wesleywiser",
] ]
@ -1107,7 +1106,6 @@ types = [
] ]
borrowck = [ borrowck = [
"@davidtwco", "@davidtwco",
"@pnkfelix",
"@matthewjasper" "@matthewjasper"
] ]
ast_lowering = [ ast_lowering = [