Commit 7af2210
committed
rust: module: improve parsing and errors
- Simplified code.
- Repeated keys are not allowed anymore, e.g.
module! {
type: RustMinimal,
type: RustMinimal,
...
- Better error messages:
error: proc macro panicked
--> ../samples/rust/rust_minimal.rs:10:1
|
10 | / module! {
11 | | type: RustMinimal,
12 | | name: b"rust_minimal",
13 | | description: b"Rust minimal sample",
14 | | author: b"Rust for Linux Contributors",
15 | | license: b"GPL v2",
16 | | }
| |_^
|
= help: message: Keys are not ordered as expected. Order them like: ["type", "name", "author", "description", "license"]
error: proc macro panicked
--> ../samples/rust/rust_minimal.rs:10:1
|
10 | / module! {
11 | | typo: RustMinimal,
12 | | name: b"rust_minimal",
13 | | author: b"Rust for Linux Contributors",
14 | | description: b"Rust minimal sample",
15 | | license: b"GPL v2",
16 | | }
| |_^
|
= help: message: Unknown key "typo". Valid keys are: ["type", "name", "author", "description", "license", "alias", "alias_rtnl_link", "params"].
error: proc macro panicked
--> ../samples/rust/rust_minimal.rs:10:1
|
10 | / module! {
11 | | type: RustMinimal,
12 | | name: b"rust_minimal",
13 | | author: b"Rust for Linux Contributors",
14 | | description: b"Rust minimal sample",
15 | | }
| |_^
|
= help: message: Missing required key "license".
error: proc macro panicked
--> ../samples/rust/rust_minimal.rs:10:1
|
10 | / module! {
11 | | type: RustMinimal,
12 | | name: b"rust_minimal",
13 | | license: b"GPL v2",
14 | | license: b"GPL v2",
15 | | }
| |_^
|
= help: message: Duplicated key "license". Keys can only be specified once.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>1 parent c3410c1 commit 7af2210
1 file changed
+54
-53
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
325 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
326 | 337 | | |
327 | 338 | | |
328 | | - | |
| 339 | + | |
329 | 340 | | |
330 | 341 | | |
331 | 342 | | |
332 | 343 | | |
333 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
334 | 352 | | |
335 | 353 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
373 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
374 | 369 | | |
| 370 | + | |
375 | 371 | | |
| 372 | + | |
| 373 | + | |
376 | 374 | | |
377 | 375 | | |
378 | 376 | | |
379 | 377 | | |
380 | | - | |
381 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
382 | 382 | | |
383 | | - | |
384 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
385 | 389 | | |
386 | | - | |
387 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
388 | 396 | | |
389 | 397 | | |
390 | 398 | | |
391 | 399 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | 400 | | |
400 | 401 | | |
401 | 402 | | |
| |||
0 commit comments