File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,12 @@ impl<'a> ParamsInScope<'a> {
25
25
26
26
fn crawl ( in_scope : & ParamsInScope , ty : & Type , found : & mut bool ) {
27
27
if let Type :: Path ( ty) = ty {
28
- if ty. qself . is_none ( ) {
29
- if let Some ( ident) = ty. path . get_ident ( ) {
30
- if in_scope. names . contains ( ident) {
31
- * found = true ;
32
- }
28
+ if let Some ( qself) = & ty. qself {
29
+ crawl ( in_scope, & qself. ty , found) ;
30
+ } else {
31
+ let front = ty. path . segments . first ( ) . unwrap ( ) ;
32
+ if front. arguments . is_none ( ) && in_scope. names . contains ( & front. ident ) {
33
+ * found = true ;
33
34
}
34
35
}
35
36
for segment in & ty. path . segments {
Original file line number Diff line number Diff line change 1
1
#![ allow( clippy:: needless_late_init, clippy:: uninlined_format_args) ]
2
2
3
3
use core:: fmt:: { self , Debug , Display } ;
4
+ use core:: str:: FromStr ;
4
5
use thiserror:: Error ;
5
6
6
7
pub struct NoFormat ;
@@ -160,6 +161,24 @@ pub struct StructFromGeneric<E> {
160
161
#[ error( transparent) ]
161
162
pub struct StructTransparentGeneric < E > ( pub E ) ;
162
163
164
+ // Should expand to:
165
+ //
166
+ // impl<T: FromStr> Display for AssociatedTypeError<T>
167
+ // where
168
+ // T::Err: Display;
169
+ //
170
+ // impl<T: FromStr> Error for AssociatedTypeError<T>
171
+ // where
172
+ // Self: Debug + Display;
173
+ //
174
+ #[ derive( Error , Debug ) ]
175
+ pub enum AssociatedTypeError < T : FromStr > {
176
+ #[ error( "couldn't parse matrix" ) ]
177
+ Other ,
178
+ #[ error( "couldn't parse entry: {0}" ) ]
179
+ EntryParseError ( T :: Err ) ,
180
+ }
181
+
163
182
// Regression test for https://github.com/dtolnay/thiserror/issues/345
164
183
#[ test]
165
184
fn test_no_bound_on_named_fmt ( ) {
You can’t perform that action at this time.
0 commit comments