Rollup merge of #132227 - compiler-errors:better-const-span, r=Nadrieril

Pass constness with span into lower_poly_trait_ref

Gives us a span to point at for ~const/const on non-const traits.

Split from #132209. r? Nadrieril
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-10-28 13:36:20 +08:00 committed by GitHub
commit a9ee1d025b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 241 additions and 254 deletions

View file

@ -168,13 +168,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
match hir_bound { match hir_bound {
hir::GenericBound::Trait(poly_trait_ref) => { hir::GenericBound::Trait(poly_trait_ref) => {
let hir::TraitBoundModifiers { constness, polarity } = poly_trait_ref.modifiers; let hir::TraitBoundModifiers { constness, polarity } = poly_trait_ref.modifiers;
// FIXME: We could pass these directly into `lower_poly_trait_ref`
// so that we could use these spans in diagnostics within that function...
let constness = match constness {
hir::BoundConstness::Never => None,
hir::BoundConstness::Always(_) => Some(ty::BoundConstness::Const),
hir::BoundConstness::Maybe(_) => Some(ty::BoundConstness::ConstIfConst),
};
let polarity = match polarity { let polarity = match polarity {
rustc_ast::BoundPolarity::Positive => ty::PredicatePolarity::Positive, rustc_ast::BoundPolarity::Positive => ty::PredicatePolarity::Positive,
rustc_ast::BoundPolarity::Negative(_) => ty::PredicatePolarity::Negative, rustc_ast::BoundPolarity::Negative(_) => ty::PredicatePolarity::Negative,

View file

@ -50,7 +50,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
} = self.lower_poly_trait_ref( } = self.lower_poly_trait_ref(
&trait_bound.trait_ref, &trait_bound.trait_ref,
trait_bound.span, trait_bound.span,
None, hir::BoundConstness::Never,
ty::PredicatePolarity::Positive, ty::PredicatePolarity::Positive,
dummy_self, dummy_self,
&mut bounds, &mut bounds,

View file

@ -658,7 +658,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
&self, &self,
trait_ref: &hir::TraitRef<'tcx>, trait_ref: &hir::TraitRef<'tcx>,
span: Span, span: Span,
constness: Option<ty::BoundConstness>, constness: hir::BoundConstness,
polarity: ty::PredicatePolarity, polarity: ty::PredicatePolarity,
self_ty: Ty<'tcx>, self_ty: Ty<'tcx>,
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
@ -681,11 +681,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
Some(self_ty), Some(self_ty),
); );
if let Some(constness) = 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)
{ {
self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait { self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait {
span: trait_ref.path.span, span,
modifier: constness.as_str(), modifier: constness.as_str(),
}); });
} }
@ -708,7 +708,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity); bounds.push_trait_bound(tcx, poly_trait_ref, span, polarity);
match constness { match constness {
Some(ty::BoundConstness::Const) => { hir::BoundConstness::Always(span) => {
if polarity == ty::PredicatePolarity::Positive { if polarity == ty::PredicatePolarity::Positive {
bounds.push_const_bound( bounds.push_const_bound(
tcx, tcx,
@ -718,13 +718,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
); );
} }
} }
Some(ty::BoundConstness::ConstIfConst) => { hir::BoundConstness::Maybe(_) => {
// We don't emit a const bound here, since that would mean that we // We don't emit a const bound here, since that would mean that we
// unconditionally need to prove a `HostEffect` predicate, even when // unconditionally need to prove a `HostEffect` predicate, even when
// the predicates are being instantiated in a non-const context. This // the predicates are being instantiated in a non-const context. This
// is instead handled in the `const_conditions` query. // is instead handled in the `const_conditions` query.
} }
None => {} hir::BoundConstness::Never => {}
} }
} }
// On the flip side, when filtering `ConstIfConst` bounds, we only need to convert // On the flip side, when filtering `ConstIfConst` bounds, we only need to convert
@ -734,12 +734,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// here because we only call this on self bounds, and deal with the recursive case // here because we only call this on self bounds, and deal with the recursive case
// in `lower_assoc_item_constraint`. // in `lower_assoc_item_constraint`.
PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => match constness { PredicateFilter::ConstIfConst | PredicateFilter::SelfConstIfConst => match constness {
Some(ty::BoundConstness::ConstIfConst) => { hir::BoundConstness::Maybe(span) => {
if polarity == ty::PredicatePolarity::Positive { if polarity == ty::PredicatePolarity::Positive {
bounds.push_const_bound(tcx, poly_trait_ref, ty::HostPolarity::Maybe, span); bounds.push_const_bound(tcx, poly_trait_ref, ty::HostPolarity::Maybe, span);
} }
} }
None | Some(ty::BoundConstness::Const) => {} hir::BoundConstness::Always(_) | hir::BoundConstness::Never => {}
}, },
} }

View file

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22 --> $DIR/const-block-const-bound.rs:8:15
| |
LL | const fn f<T: ~const Destruct>(x: T) {} LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-block-const-bound.rs:8:22 --> $DIR/const-block-const-bound.rs:8:15
| |
LL | const fn f<T: ~const Destruct>(x: T) {} LL | const fn f<T: ~const Destruct>(x: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -11,19 +11,19 @@ LL | #![feature(const_cmp)]
| ^^^^^^^^^ | ^^^^^^^^^
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:13:15 --> $DIR/fn_trait_refs.rs:13:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
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:13:31 --> $DIR/fn_trait_refs.rs:13:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
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:13:15 --> $DIR/fn_trait_refs.rs:13:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
@ -31,7 +31,7 @@ LL | T: ~const Fn<()> + ~const Destruct,
= 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:13:15 --> $DIR/fn_trait_refs.rs:13:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
@ -39,85 +39,85 @@ LL | T: ~const Fn<()> + ~const Destruct,
= 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:13:31 --> $DIR/fn_trait_refs.rs:13:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= 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:20:15 --> $DIR/fn_trait_refs.rs:20:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
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:20:34 --> $DIR/fn_trait_refs.rs:20:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
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:20:15 --> $DIR/fn_trait_refs.rs:20:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= 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:20:15 --> $DIR/fn_trait_refs.rs:20:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= 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:20:34 --> $DIR/fn_trait_refs.rs:20:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= 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:27:15 --> $DIR/fn_trait_refs.rs:27:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^ | ^^^^^^
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:27:15 --> $DIR/fn_trait_refs.rs:27:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^ | ^^^^^^
| |
= 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:27:15 --> $DIR/fn_trait_refs.rs:27:8
| |
LL | T: ~const FnOnce<()>, LL | T: ~const FnOnce<()>,
| ^^^^^^^^^^ | ^^^^^^
| |
= 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:34:15 --> $DIR/fn_trait_refs.rs:34:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
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:34:31 --> $DIR/fn_trait_refs.rs:34:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
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:34:15 --> $DIR/fn_trait_refs.rs:34:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
@ -125,7 +125,7 @@ LL | T: ~const Fn<()> + ~const Destruct,
= 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:34:15 --> $DIR/fn_trait_refs.rs:34:8
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^ | ^^^^^^
@ -133,46 +133,46 @@ LL | T: ~const Fn<()> + ~const Destruct,
= 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:34:31 --> $DIR/fn_trait_refs.rs:34:24
| |
LL | T: ~const Fn<()> + ~const Destruct, LL | T: ~const Fn<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= 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:48:15 --> $DIR/fn_trait_refs.rs:48:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
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:48:34 --> $DIR/fn_trait_refs.rs:48:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
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:48:15 --> $DIR/fn_trait_refs.rs:48:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= 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:48:15 --> $DIR/fn_trait_refs.rs:48:8
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^^ | ^^^^^^
| |
= 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:48:34 --> $DIR/fn_trait_refs.rs:48:27
| |
LL | T: ~const FnMut<()> + ~const Destruct, LL | T: ~const FnMut<()> + ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,14 +1,14 @@
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:39 --> $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 {
| ^^^^^^^^^^^^^ | ^^^^^^
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:39 --> $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 {
| ^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,28 +1,28 @@
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:42 --> $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) {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
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:69 --> $DIR/normalize-tait-in-const.rs:26:62
| |
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) {
| ^^^^^^^^ | ^^^^^^
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:42 --> $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) {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
| |
= 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/normalize-tait-in-const.rs:26:69 --> $DIR/normalize-tait-in-const.rs:26:62
| |
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) {
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,42 +1,42 @@
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:16 --> $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 {
| ^^^^^^^ | ^^^^^^
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:16 --> $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 {
| ^^^^^^^ | ^^^^^^
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:16 --> $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 {
| ^^^^^^^ | ^^^^^^
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:16 --> $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 {
| ^^^^^^^ | ^^^^^^
| |
= 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:16 --> $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 {
| ^^^^^^^ | ^^^^^^
| |
= 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:16 --> $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 {
| ^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -17,7 +17,7 @@ note: required by a bound in `Foo::Bar`
--> $DIR/assoc-type.rs:32:15 --> $DIR/assoc-type.rs:32:15
| |
LL | type Bar: ~const Add; LL | type Bar: ~const Add;
| ^^^^^^^^^^ required by this bound in `Foo::Bar` | ^^^^^^ required by this bound in `Foo::Bar`
error: aborting due to 1 previous error; 1 warning emitted error: aborting due to 1 previous error; 1 warning emitted

View file

@ -1,14 +1,14 @@
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:16 --> $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 {
| ^^^^^^^^^ | ^^^^^^
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:16 --> $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 {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -17,30 +17,30 @@ LL | impl const PartialEq for S {
= 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
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:32 --> $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 {
| ^^^^^^^^^ | ^^^^^^
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:32 --> $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 {
| ^^^^^^^^^ | ^^^^^^
| |
= 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:40 --> $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 {
| ^^^^^^^^^ | ^^^^^^
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:40 --> $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 {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -17,30 +17,30 @@ LL | impl const PartialEq for S {
= 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
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:44 --> $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 {
| ^^^^^^^^^ | ^^^^^^
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:44 --> $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 {
| ^^^^^^^^^ | ^^^^^^
| |
= 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:37 --> $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 {
| ^^^^^^^^^ | ^^^^^^
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:37 --> $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 {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -17,16 +17,16 @@ LL | impl const PartialEq for S {
= 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
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:32 --> $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 {
| ^^^^^^^^^ | ^^^^^^
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:32 --> $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 {
| ^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -13,24 +13,24 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
= help: use `-Znext-solver` to enable = help: use `-Znext-solver` to enable
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:28 --> $DIR/const-bounds-non-const-trait.rs:6:21
| |
LL | const fn perform<T: ~const NonConst>() {} LL | const fn perform<T: ~const 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:28 --> $DIR/const-bounds-non-const-trait.rs:6:21
| |
LL | const fn perform<T: ~const NonConst>() {} LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^^^ | ^^^^^^
| |
= 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-bounds-non-const-trait.rs:10:21 --> $DIR/const-bounds-non-const-trait.rs:10:15
| |
LL | fn operate<T: const NonConst>() {} LL | fn operate<T: const NonConst>() {}
| ^^^^^^^^ | ^^^^^
error: aborting due to 4 previous errors; 1 warning emitted error: aborting due to 4 previous errors; 1 warning emitted

View file

@ -1,14 +1,14 @@
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:32 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
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:32 --> $DIR/const-closure-parse-not-item.rs:7:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,14 +1,14 @@
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:39 --> $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 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
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:39 --> $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 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,14 +1,14 @@
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:39 --> $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 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
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:39 --> $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 {
| ^^^^^^^^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,56 +1,56 @@
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:19 --> $DIR/const-closures.rs:8:12
| |
LL | F: ~const FnOnce() -> u8, LL | F: ~const FnOnce() -> u8,
| ^^^^^^^^^^^^^^ | ^^^^^^
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:19 --> $DIR/const-closures.rs:9:12
| |
LL | F: ~const FnMut() -> u8, LL | F: ~const FnMut() -> u8,
| ^^^^^^^^^^^^^ | ^^^^^^
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:19 --> $DIR/const-closures.rs:10:12
| |
LL | F: ~const Fn() -> u8, LL | F: ~const Fn() -> u8,
| ^^^^^^^^^^ | ^^^^^^
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:19 --> $DIR/const-closures.rs:8:12
| |
LL | F: ~const FnOnce() -> u8, LL | F: ~const FnOnce() -> u8,
| ^^^^^^^^^^^^^^ | ^^^^^^
| |
= 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:19 --> $DIR/const-closures.rs:9:12
| |
LL | F: ~const FnMut() -> u8, LL | F: ~const FnMut() -> u8,
| ^^^^^^^^^^^^^ | ^^^^^^
| |
= 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:19 --> $DIR/const-closures.rs:10:12
| |
LL | F: ~const Fn() -> u8, LL | F: ~const Fn() -> u8,
| ^^^^^^^^^^ | ^^^^^^
| |
= 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:27 --> $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 {
| ^^^^^^^^^^ | ^^^^^^
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:27 --> $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 {
| ^^^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,42 +1,42 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:9:68 --> $DIR/const-drop-bound.rs:9:61
| |
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct { LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:9:68 --> $DIR/const-drop-bound.rs:9:61
| |
LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct { LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
| ^^^^^^^^ | ^^^^^^
| |
= 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-drop-bound.rs:20:15 --> $DIR/const-drop-bound.rs:20:8
| |
LL | T: ~const Destruct, LL | T: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:21:15 --> $DIR/const-drop-bound.rs:21:8
| |
LL | E: ~const Destruct, LL | E: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-bound.rs:20:15 --> $DIR/const-drop-bound.rs:20:8
| |
LL | T: ~const Destruct, LL | T: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= 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-drop-bound.rs:21:15 --> $DIR/const-drop-bound.rs:21:8
| |
LL | E: ~const Destruct, LL | E: ~const Destruct,
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -8,16 +8,16 @@ LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
= 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
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail-2.rs:20:26 --> $DIR/const-drop-fail-2.rs:20:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail-2.rs:20:26 --> $DIR/const-drop-fail-2.rs:20:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -8,16 +8,16 @@ LL | impl const Drop for ConstImplWithDropGlue {
= 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
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -8,16 +8,16 @@ LL | impl const Drop for ConstImplWithDropGlue {
= 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
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop-fail.rs:23:26 --> $DIR/const-drop-fail.rs:23:19
| |
LL | const fn check<T: ~const Destruct>(_: T) {} LL | const fn check<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -35,16 +35,16 @@ LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> {
= 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
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -35,16 +35,16 @@ LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> {
= 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
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-drop.rs:18:22 --> $DIR/const-drop.rs:18:15
| |
LL | const fn a<T: ~const Destruct>(_: T) {} LL | const fn a<T: ~const Destruct>(_: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -23,12 +23,6 @@ LL | #[derive_const(PartialEq)]
= 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
--> $DIR/derive-const-with-params.rs:7:16
|
LL | #[derive_const(PartialEq)]
| ^^^^^^^^^
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
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

@ -23,16 +23,16 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
= help: use `-Znext-solver` to enable = help: use `-Znext-solver` to enable
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:32 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
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:32 --> $DIR/ice-112822-expected-type-for-param.rs:3:25
| |
LL | const fn test() -> impl ~const Fn() { LL | const fn test() -> impl ~const Fn() {
| ^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -37,10 +37,10 @@ LL | impl<T> const Foo for T where T: const Specialize {}
= 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
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:14:40 --> $DIR/spec-effectvar-ice.rs:14:34
| |
LL | impl<T> const Foo for T where T: const Specialize {} LL | impl<T> const Foo for T where T: const Specialize {}
| ^^^^^^^^^^ | ^^^^^
error: specialization impl does not specialize any associated items error: specialization impl does not specialize any associated items
--> $DIR/spec-effectvar-ice.rs:14:1 --> $DIR/spec-effectvar-ice.rs:14:1

View file

@ -4,16 +4,16 @@ error: using `#![feature(effects)]` without enabling next trait solver globally
= help: use `-Znext-solver` to enable = help: use `-Znext-solver` to enable
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:34 --> $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()>() {}
| ^^^^ | ^^^^^^
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:34 --> $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()>() {}
| ^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,14 +1,14 @@
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/issue-92111.rs:20:22 --> $DIR/issue-92111.rs:20:15
| |
LL | const fn a<T: ~const Destruct>(t: T) {} LL | const fn a<T: ~const Destruct>(t: T) {}
| ^^^^^^^^ | ^^^^^^
error: `~const` can only be applied to `#[const_trait]` traits error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/issue-92111.rs:20:22 --> $DIR/issue-92111.rs:20:15
| |
LL | const fn a<T: ~const Destruct>(t: T) {} LL | const fn a<T: ~const Destruct>(t: T) {}
| ^^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -17,7 +17,7 @@ note: required by a bound in `Foo::Assoc`
--> $DIR/item-bound-entailment-fails.rs:6:20 --> $DIR/item-bound-entailment-fails.rs:6:20
| |
LL | type Assoc<T>: ~const Bar LL | type Assoc<T>: ~const Bar
| ^^^^^^^^^^ required by this bound in `Foo::Assoc` | ^^^^^^ required by this bound in `Foo::Assoc`
error[E0277]: the trait bound `T: ~const Bar` is not satisfied error[E0277]: the trait bound `T: ~const Bar` is not satisfied
--> $DIR/item-bound-entailment-fails.rs:25:21 --> $DIR/item-bound-entailment-fails.rs:25:21
@ -29,7 +29,7 @@ note: required by a bound in `Foo::Assoc`
--> $DIR/item-bound-entailment-fails.rs:6:20 --> $DIR/item-bound-entailment-fails.rs:6:20
| |
LL | type Assoc<T>: ~const Bar LL | type Assoc<T>: ~const Bar
| ^^^^^^^^^^ required by this bound in `Foo::Assoc` | ^^^^^^ required by this bound in `Foo::Assoc`
error: aborting due to 2 previous errors; 1 warning emitted error: aborting due to 2 previous errors; 1 warning emitted

View file

@ -1,14 +1,14 @@
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:51 --> $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> {
| ^^^^^^^ | ^^^^^^
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:51 --> $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> {
| ^^^^^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -14,7 +14,7 @@ LL | type Bar<T> where T: ~const Bar;
| ----------- definition of `Bar` from trait | ----------- definition of `Bar` from trait
... ...
LL | type Bar<T> = () where T: const Bar; LL | type Bar<T> = () where T: const Bar;
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:18:26 --> $DIR/predicate-entailment-fails.rs:18:26
@ -23,7 +23,7 @@ LL | fn foo<T>() where T: ~const Bar;
| -------------------------------- definition of `foo` from trait | -------------------------------- definition of `foo` from trait
... ...
LL | fn foo<T>() where T: const Bar {} LL | fn foo<T>() where T: const Bar {}
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:29:31 --> $DIR/predicate-entailment-fails.rs:29:31
@ -32,7 +32,7 @@ LL | type Bar<T> where T: Bar;
| ----------- definition of `Bar` from trait | ----------- definition of `Bar` from trait
... ...
LL | type Bar<T> = () where T: const Bar; LL | type Bar<T> = () where T: const Bar;
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:32:26 --> $DIR/predicate-entailment-fails.rs:32:26
@ -41,7 +41,7 @@ LL | fn foo<T>() where T: Bar;
| ------------------------- definition of `foo` from trait | ------------------------- definition of `foo` from trait
... ...
LL | fn foo<T>() where T: const Bar {} LL | fn foo<T>() where T: const Bar {}
| ^^^^^^^^^ impl has extra requirement `T: const Bar` | ^^^^^ impl has extra requirement `T: const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:36:31 --> $DIR/predicate-entailment-fails.rs:36:31
@ -50,7 +50,7 @@ LL | type Bar<T> where T: Bar;
| ----------- definition of `Bar` from trait | ----------- definition of `Bar` from trait
... ...
LL | type Bar<T> = () where T: ~const Bar; LL | type Bar<T> = () where T: ~const Bar;
| ^^^^^^^^^^ impl has extra requirement `T: ~const Bar` | ^^^^^^ impl has extra requirement `T: ~const Bar`
error[E0276]: impl has stricter requirements than trait error[E0276]: impl has stricter requirements than trait
--> $DIR/predicate-entailment-fails.rs:39:26 --> $DIR/predicate-entailment-fails.rs:39:26
@ -59,7 +59,7 @@ LL | fn foo<T>() where T: Bar;
| ------------------------- definition of `foo` from trait | ------------------------- definition of `foo` from trait
... ...
LL | fn foo<T>() where T: ~const Bar {} LL | fn foo<T>() where T: ~const Bar {}
| ^^^^^^^^^^ impl has extra requirement `T: ~const Bar` | ^^^^^^ impl has extra requirement `T: ~const Bar`
error: aborting due to 6 previous errors; 1 warning emitted error: aborting due to 6 previous errors; 1 warning emitted

View file

@ -11,24 +11,24 @@ 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-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
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-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,38 +1,38 @@
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:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
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-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-2.rs:12:19 --> $DIR/super-traits-fail-2.rs:12:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -11,38 +11,38 @@ 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:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
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:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-3.rs:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
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:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -1,38 +1,38 @@
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:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
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:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= 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/super-traits-fail-3.rs:14:19 --> $DIR/super-traits-fail-3.rs:14:12
| |
LL | trait Bar: ~const Foo {} LL | trait Bar: ~const Foo {}
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -11,16 +11,16 @@ 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:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
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:22:24 --> $DIR/super-traits-fail-3.rs:22:17
| |
LL | const fn foo<T: ~const Bar>(x: &T) { LL | const fn foo<T: ~const Bar>(x: &T) {
| ^^^ | ^^^^^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View file

@ -28,7 +28,7 @@ note: required by a bound in `require`
--> $DIR/unsatisfied-const-trait-bound.rs:8:15 --> $DIR/unsatisfied-const-trait-bound.rs:8:15
| |
LL | fn require<T: const Trait>() {} LL | fn require<T: const Trait>() {}
| ^^^^^^^^^^^ required by this bound in `require` | ^^^^^ required by this bound in `require`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors