Skip to content

Commit

Permalink
Print constness in TraitPredPrintModifiersAndPath
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Dec 9, 2023
1 parent 7467c3a commit afa35e9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

Expand Down Expand Up @@ -2919,7 +2923,6 @@ define_print_and_forward_display! {
p!("~const ");
}
}
// FIXME(effects) print `~const` here
if let ty::ImplPolarity::Negative = self.polarity {
p!("!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 `()`

Expand Down

0 comments on commit afa35e9

Please sign in to comment.