Print constness in TraitPredPrintModifiersAndPath

This commit is contained in:
Michael Goulet 2023-12-09 17:55:07 +00:00
parent 7467c3a45c
commit afa35e90ef
6 changed files with 11 additions and 8 deletions

View File

@ -2880,11 +2880,15 @@ define_print_and_forward_display! {
}
TraitPredPrintModifiersAndPath<'tcx> {
// FIXME(effects) print `~const` here
if let Some(idx) = cx.tcx().generics_of(self.0.trait_ref.def_id).host_effect_index
{
if self.0.trait_ref.args.const_at(idx) != cx.tcx().consts.true_ {
p!("~const ");
}
}
if let ty::ImplPolarity::Negative = self.0.polarity {
p!("!")
}
p!(print(self.0.trait_ref.print_only_trait_path()));
}
@ -2919,7 +2923,6 @@ define_print_and_forward_display! {
p!("~const ");
}
}
// FIXME(effects) print `~const` here
if let ty::ImplPolarity::Negative = self.polarity {
p!("!");
}

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
--> $DIR/call-const-trait-method-fail.rs:25:5
|
LL | a.plus(b)
| ^ the trait `Plus` is not implemented for `u32`
| ^ the trait `~const Plus` is not implemented for `u32`
|
= help: the trait `Plus` is implemented for `u32`

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `S: ~const Foo` is not satisfied
--> $DIR/call-generic-method-nonconst.rs:23:34
|
LL | pub const EQ: bool = equals_self(&S);
| ----------- ^^ the trait `Foo` is not implemented for `S`
| ----------- ^^ the trait `~const Foo` is not implemented for `S`
| |
| required by a bound introduced by this call
|

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satis
--> $DIR/const-default-method-bodies.rs:24:18
|
LL | NonConstImpl.a();
| ^ the trait `ConstDefaultFn` is not implemented for `NonConstImpl`
| ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl`
|
= help: the trait `ConstDefaultFn` is implemented for `NonConstImpl`

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrai
--> $DIR/cross-crate.rs:17:14
|
LL | NonConst.func();
| ^^^^ the trait `cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
| ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst`
|
= help: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied
--> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12
|
LL | ().a()
| ^ the trait `Tr` is not implemented for `()`
| ^ the trait `~const Tr` is not implemented for `()`
|
= help: the trait `Tr` is implemented for `()`