@@ -1066,10 +1066,9 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
1066
1066
constructor : & Constructor < ' tcx > ,
1067
1067
ty : Ty < ' tcx > ,
1068
1068
) -> Self {
1069
- debug ! ( "Fields::wildcards({:#?}, {:?})" , constructor, ty) ;
1070
1069
let wildcard_from_ty = |ty| & * cx. pattern_arena . alloc ( Pat :: wildcard_from_ty ( ty) ) ;
1071
1070
1072
- match constructor {
1071
+ let ret = match constructor {
1073
1072
Single | Variant ( _) => match ty. kind {
1074
1073
ty:: Tuple ( ref fs) => {
1075
1074
Fields :: wildcards_from_tys ( cx, fs. into_iter ( ) . map ( |ty| ty. expect_ty ( ) ) )
@@ -1129,7 +1128,9 @@ impl<'p, 'tcx> Fields<'p, 'tcx> {
1129
1128
_ => bug ! ( "bad slice pattern {:?} {:?}" , constructor, ty) ,
1130
1129
} ,
1131
1130
ConstantValue ( ..) | FloatRange ( ..) | IntRange ( ..) | NonExhaustive => Fields :: empty ( ) ,
1132
- }
1131
+ } ;
1132
+ debug ! ( "Fields::wildcards({:?}, {:?}) = {:#?}" , constructor, ty, ret) ;
1133
+ ret
1133
1134
}
1134
1135
1135
1136
fn len ( & self ) -> usize {
@@ -1870,7 +1871,7 @@ crate fn is_useful<'p, 'tcx>(
1870
1871
1871
1872
debug ! ( "is_useful_expand_first_col: pcx={:#?}, expanding {:#?}" , pcx, v. head( ) ) ;
1872
1873
1873
- if let Some ( constructor) = pat_constructor ( cx. tcx , cx. param_env , v. head ( ) ) {
1874
+ let ret = if let Some ( constructor) = pat_constructor ( cx. tcx , cx. param_env , v. head ( ) ) {
1874
1875
debug ! ( "is_useful - expanding constructor: {:#?}" , constructor) ;
1875
1876
split_grouped_constructors (
1876
1877
cx. tcx ,
@@ -1901,11 +1902,11 @@ crate fn is_useful<'p, 'tcx>(
1901
1902
1902
1903
let used_ctors: Vec < Constructor < ' _ > > =
1903
1904
matrix. heads ( ) . filter_map ( |p| pat_constructor ( cx. tcx , cx. param_env , p) ) . collect ( ) ;
1904
- debug ! ( "used_ctors = {:#?}" , used_ctors) ;
1905
+ debug ! ( "is_useful_used_ctors = {:#?}" , used_ctors) ;
1905
1906
// `all_ctors` are all the constructors for the given type, which
1906
1907
// should all be represented (or caught with the wild pattern `_`).
1907
1908
let all_ctors = all_constructors ( cx, pcx) ;
1908
- debug ! ( "all_ctors = {:#?}" , all_ctors) ;
1909
+ debug ! ( "is_useful_all_ctors = {:#?}" , all_ctors) ;
1909
1910
1910
1911
// `missing_ctors` is the set of constructors from the same type as the
1911
1912
// first column of `matrix` that are matched only by wildcard patterns
@@ -1920,7 +1921,7 @@ crate fn is_useful<'p, 'tcx>(
1920
1921
// can be big.
1921
1922
let missing_ctors = MissingConstructors :: new ( all_ctors, used_ctors) ;
1922
1923
1923
- debug ! ( "missing_ctors .empty()={:#?}" , missing_ctors. is_empty( ) , ) ;
1924
+ debug ! ( "is_useful_missing_ctors .empty()={:#?}" , missing_ctors. is_empty( ) , ) ;
1924
1925
1925
1926
if missing_ctors. is_empty ( ) {
1926
1927
let ( all_ctors, _) = missing_ctors. into_inner ( ) ;
@@ -1988,7 +1989,9 @@ crate fn is_useful<'p, 'tcx>(
1988
1989
usefulness. apply_missing_ctors ( cx, pcx. ty , & missing_ctors)
1989
1990
}
1990
1991
}
1991
- }
1992
+ } ;
1993
+ debug ! ( "is_useful::returns({:#?}, {:#?}) = {:?}" , matrix, v, ret) ;
1994
+ ret
1992
1995
}
1993
1996
1994
1997
/// A shorthand for the `U(S(c, P), S(c, q))` operation from the paper. I.e., `is_useful` applied
@@ -2647,7 +2650,10 @@ fn specialize_one_pattern<'p, 'tcx>(
2647
2650
2648
2651
PatKind :: Or { .. } => bug ! ( "Or-pattern should have been expanded earlier on." ) ,
2649
2652
} ;
2650
- debug ! ( "specialize({:#?}, {:#?}) = {:#?}" , pat, ctor_wild_subpatterns, result) ;
2653
+ debug ! (
2654
+ "specialize({:#?}, {:#?}, {:#?}) = {:#?}" ,
2655
+ pat, constructor, ctor_wild_subpatterns, result
2656
+ ) ;
2651
2657
2652
2658
result
2653
2659
}
0 commit comments