File tree Expand file tree Collapse file tree 4 files changed +15
-8
lines changed
rustc_const_eval/src/interpret
src/test/ui/const-generics/issues Expand file tree Collapse file tree 4 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 1313 T : TypeVisitable < ' tcx > ,
1414{
1515 debug ! ( "ensure_monomorphic_enough: ty={:?}" , ty) ;
16- if !( ty. needs_subst ( ) || ty. has_opaque_types ( ) ) {
16+ if !( ty. needs_subst ( ) || ty. has_opaque_types ( ) ) {
1717 return Ok ( ( ) ) ;
1818 }
1919
Original file line number Diff line number Diff line change @@ -279,7 +279,11 @@ fn resolve_associated_item<'tcx>(
279279
280280 // If the item does not have a value, then we cannot return an instance.
281281 if !leaf_def. item . defaultness ( tcx) . has_value ( ) {
282- return Ok ( None ) ;
282+ let guard = tcx. sess . delay_span_bug (
283+ tcx. def_span ( leaf_def. item . def_id ) ,
284+ "missing value for assoc item in impl" ,
285+ ) ;
286+ return Err ( guard) ;
283287 }
284288
285289 let substs = tcx. erase_regions ( substs) ;
Original file line number Diff line number Diff line change @@ -4,13 +4,12 @@ trait Trait {
44 const N : usize ;
55}
66
7- // FIXME: We should mention that `N` is missing
87impl const Trait for i32 { }
8+ //~^ ERROR not all trait items implemented, missing: `N`
99
1010fn f ( )
1111where
1212 [ ( ) ; <i32 as Trait >:: N ] : ,
13- //~^ ERROR unable to use constant with a hidden value in the type system
1413{ }
1514
1615fn main ( ) { }
Original file line number Diff line number Diff line change 1- error: unable to use constant with a hidden value in the type system
2- --> $DIR/issue-98629.rs:11:5
1+ error[E0046]: not all trait items implemented, missing: `N`
2+ --> $DIR/issue-98629.rs:7:1
33 |
4- LL | [(); <i32 as Trait>::N]:,
5- | ^^^^^^^^^^^^^^^^^^^^^^^
4+ LL | const N: usize;
5+ | -------------- `N` from trait
6+ ...
7+ LL | impl const Trait for i32 {}
8+ | ^^^^^^^^^^^^^^^^^^^^^^^^ missing `N` in implementation
69
710error: aborting due to previous error
811
12+ For more information about this error, try `rustc --explain E0046`.
You can’t perform that action at this time.
0 commit comments