You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: proc-macro derive panicked
--> src/uu/du/src/du.rs:79:10
|
79 | #[derive(Arguments)]
| ^^^^^^^^^
|
= help: message: called `Option::unwrap()` on a `None` value
How should we approach this? I suggest replacing every .unwrap within derive to a .expect. This way, we at least get some information on what's wrong. This affects the following places:
$ git grep -Pirn 'unwrap\(' derive/derive/src/argument.rs:35: return ArgumentsAttr::parse(attr).unwrap();derive/src/argument.rs:43: let attributes = get_arg_attributes(&v.attrs).unwrap();derive/src/flags.rs:64: .unwrap();derive/src/flags.rs:86: let f = chars.next().unwrap();derive/src/help.rs:88: ).unwrap();derive/src/help.rs:90: writeln!(w, "{}", #summary).unwrap();derive/src/help.rs:92: writeln!(w, "\nUsage:\n {}", format!(#usage, bin_name)).unwrap();derive/src/help.rs:96: writeln!(w, "{}", #after_options).unwrap();derive/src/help.rs:103: let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();derive/src/help.rs:107: let mut f = std::fs::File::open(location).unwrap();derive/src/help.rs:108: f.read_to_string(&mut contents).unwrap();derive/src/help_parser.rs:117: parse_section("some section", input).unwrap(),derive/src/help_parser.rs:121: parse_section("SOME SECTION", input).unwrap(),derive/src/help_parser.rs:125: parse_section("another section", input).unwrap(),derive/src/help_parser.rs:146: parse_section("after section", input).unwrap(),derive/src/lib.rs:76: let mut values = parser.raw_args().unwrap().collect::<Vec<OsString>>();derive/src/lib.rs:155: let ValueAttr { keys, value } = ValueAttr::parse(&attr).unwrap();
However, I'm not sure whether this would result in actually-useful error messages.
The text was updated successfully, but these errors were encountered:
Some (somewhat reasonable?) mistakes lead to completely incomprehensible and unhelpful compiler errors. For example, writing
instead of:
leads to this unhelpful error message:
How should we approach this? I suggest replacing every
.unwrap
within derive to a.expect
. This way, we at least get some information on what's wrong. This affects the following places:However, I'm not sure whether this would result in actually-useful error messages.
The text was updated successfully, but these errors were encountered: