File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -215,3 +215,61 @@ fn trait_items_with_duplicate_associated_type_names() {
215
215
the associated type name `Assoc` is defined multiple times"# ] ]
216
216
) ;
217
217
}
218
+
219
+ #[ test]
220
+ fn crate_with_duplicate_item_names ( ) {
221
+ crate :: assert_err!(
222
+ [
223
+ crate core {
224
+ struct A { }
225
+
226
+ enum A { }
227
+ }
228
+ ]
229
+
230
+ [ "the item name `A` is defined multiple times" , ]
231
+
232
+ expect_test:: expect![ [ r#"the item name `A` is defined multiple times"# ] ]
233
+ ) ;
234
+
235
+ crate :: assert_err!(
236
+ [
237
+ crate core {
238
+ trait a { }
239
+
240
+ trait a { }
241
+ }
242
+ ]
243
+
244
+ [ "the trait name `a` is defined multiple times" , ]
245
+
246
+ expect_test:: expect![ [ r#"the trait name `a` is defined multiple times"# ] ]
247
+ ) ;
248
+
249
+ crate :: assert_err!(
250
+ [
251
+ crate core {
252
+ fn a( ) -> ( ) { trusted }
253
+
254
+ fn a( ) -> ( ) { trusted }
255
+ }
256
+ ]
257
+
258
+ [ "the function name `a` is defined multiple times" , ]
259
+
260
+ expect_test:: expect![ [ r#"the function name `a` is defined multiple times"# ] ]
261
+ ) ;
262
+
263
+ crate :: assert_ok!(
264
+ //@check-pass
265
+ [
266
+ crate core {
267
+ trait a { }
268
+
269
+ fn a( ) -> ( ) { trusted }
270
+ }
271
+ ]
272
+
273
+ expect_test:: expect![ "()" ]
274
+ ) ;
275
+ }
You can’t perform that action at this time.
0 commit comments