man icon indicating copy to clipboard operation
man copied to clipboard

update to roff 0.2?

Open dkg opened this issue 3 years ago • 1 comments

🐛 bug report

The man crate depends on roff 0.1, but roff has been at 0.2 since the end of last year, which is an API break.

It would be useful to bring man up to date with the latest version of roff, so that other build processes that depend on modern roff could use the same roff crate as man uses.

dkg avatar Nov 02 '22 19:11 dkg

Note that the change from roff 0.1 to 0.2 is a significant overhaul.

just trying to build against roff 0.2.1, i see these errors:

   Compiling roff v0.2.1
   Compiling man v0.3.0 (/home/dkg/src/rust/man)
error[E0432]: unresolved imports `roff::list`, `roff::Troffable`
 --> src/man.rs:2:26
  |
2 | use roff::{bold, italic, list, Roff, Troffable};
  |                          ^^^^        ^^^^^^^^^ no `Troffable` in the root
  |                          |
  |                          no `list` in the root

error[E0061]: this function takes 0 arguments but 2 arguments were supplied
  --> src/man.rs:95:20
   |
95 |     let mut page = Roff::new(&self.name, man_num);
   |                    ^^^^^^^^^ ----------  ------- supplied 2 arguments
   |                    |
   |                    expected 0 arguments
   |
note: associated function defined here
  --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:48:12
   |
48 |     pub fn new() -> Self {
   |            ^^^

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:131:8
    |
131 |   page.section("NAME", &[desc])
    |        ^^^^^^^ method not found in `Roff`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:143:10
    |
143 |     page.section("DESCRIPTION", &[desc.to_owned()])
    |          ^^^^^^^ method not found in `Roff`

error[E0308]: mismatched types
   --> src/man.rs:172:14
    |
172 |     msg.push(format!(" {}", arg.name));
    |              ^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Inline`, found struct `String`
    |
    = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:175:8
    |
175 |   page.section("SYNOPSIS", &msg)
    |        ^^^^^^^ method not found in `Roff`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:208:8
    |
208 |   page.section(title, &auth_values)
    |        ^^^^^^^ method not found in `Roff`

error[E0277]: the trait bound `String: From<&&String>` is not satisfied
   --> src/man.rs:227:22
    |
227 |       args.push(bold(&short));
    |                 ---- ^^^^^^
    |                 |    |
    |                 |    the trait `From<&&String>` is not implemented for `String`
    |                 |    help: consider adding dereference here: `&*short`
    |                 required by a bound introduced by this call
    |
    = help: the following implementations were found:
              <String as From<&String>>
              <String as From<&mut str>>
              <String as From<&str>>
              <String as From<Box<str>>>
            and 2 others
    = note: required because of the requirements on the impl of `Into<String>` for `&&String`
note: required by a bound in `bold`
   --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:190:25
    |
190 | pub fn bold(input: impl Into<String>) -> Inline {
    |                         ^^^^^^^^^^^^ required by this bound in `bold`

error[E0308]: mismatched types
   --> src/man.rs:227:17
    |
227 |       args.push(bold(&short));
    |                 ^^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0277]: the trait bound `String: From<&&String>` is not satisfied
   --> src/man.rs:233:22
    |
233 |       args.push(bold(&long));
    |                 ---- ^^^^^
    |                 |    |
    |                 |    the trait `From<&&String>` is not implemented for `String`
    |                 |    help: consider adding dereference here: `&*long`
    |                 required by a bound introduced by this call
    |
    = help: the following implementations were found:
              <String as From<&String>>
              <String as From<&mut str>>
              <String as From<&str>>
              <String as From<Box<str>>>
            and 2 others
    = note: required because of the requirements on the impl of `Into<String>` for `&&String`
note: required by a bound in `bold`
   --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:190:25
    |
190 | pub fn bold(input: impl Into<String>) -> Inline {
    |                         ^^^^^^^^^^^^ required by this bound in `bold`

error[E0308]: mismatched types
   --> src/man.rs:233:17
    |
233 |       args.push(bold(&long));
    |                 ^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:245:8
    |
245 |   page.section("FLAGS", &arr)
    |        ^^^^^^^ method not found in `Roff`

error[E0277]: the trait bound `String: From<&&String>` is not satisfied
   --> src/man.rs:264:22
    |
264 |       args.push(bold(&short));
    |                 ---- ^^^^^^
    |                 |    |
    |                 |    the trait `From<&&String>` is not implemented for `String`
    |                 |    help: consider adding dereference here: `&*short`
    |                 required by a bound introduced by this call
    |
    = help: the following implementations were found:
              <String as From<&String>>
              <String as From<&mut str>>
              <String as From<&str>>
              <String as From<Box<str>>>
            and 2 others
    = note: required because of the requirements on the impl of `Into<String>` for `&&String`
note: required by a bound in `bold`
   --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:190:25
    |
190 | pub fn bold(input: impl Into<String>) -> Inline {
    |                         ^^^^^^^^^^^^ required by this bound in `bold`

error[E0308]: mismatched types
   --> src/man.rs:264:17
    |
264 |       args.push(bold(&short));
    |                 ^^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0277]: the trait bound `String: From<&&String>` is not satisfied
   --> src/man.rs:270:22
    |
270 |       args.push(bold(&long));
    |                 ---- ^^^^^
    |                 |    |
    |                 |    the trait `From<&&String>` is not implemented for `String`
    |                 |    help: consider adding dereference here: `&*long`
    |                 required by a bound introduced by this call
    |
    = help: the following implementations were found:
              <String as From<&String>>
              <String as From<&mut str>>
              <String as From<&str>>
              <String as From<Box<str>>>
            and 2 others
    = note: required because of the requirements on the impl of `Into<String>` for `&&String`
note: required by a bound in `bold`
   --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:190:25
    |
190 | pub fn bold(input: impl Into<String>) -> Inline {
    |                         ^^^^^^^^^^^^ required by this bound in `bold`

error[E0308]: mismatched types
   --> src/man.rs:270:17
    |
270 |       args.push(bold(&long));
    |                 ^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0308]: mismatched types
   --> src/man.rs:273:15
    |
273 |     args.push(italic(&opt.name));
    |               ^^^^^^^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0277]: the trait bound `String: From<&&String>` is not satisfied
   --> src/man.rs:281:24
    |
281 |       args.push(italic(&default));
    |                 ------ ^^^^^^^^
    |                 |      |
    |                 |      the trait `From<&&String>` is not implemented for `String`
    |                 |      help: consider adding dereference here: `&*default`
    |                 required by a bound introduced by this call
    |
    = help: the following implementations were found:
              <String as From<&String>>
              <String as From<&mut str>>
              <String as From<&str>>
              <String as From<Box<str>>>
            and 2 others
    = note: required because of the requirements on the impl of `Into<String>` for `&&String`
note: required by a bound in `italic`
   --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:195:27
    |
195 | pub fn italic(input: impl Into<String>) -> Inline {
    |                           ^^^^^^^^^^^^ required by this bound in `italic`

error[E0308]: mismatched types
   --> src/man.rs:281:17
    |
281 |       args.push(italic(&default));
    |                 ^^^^^^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:294:8
    |
294 |   page.section("OPTIONS", &arr)
    |        ^^^^^^^ method not found in `Roff`

error[E0308]: mismatched types
   --> src/man.rs:313:15
    |
313 |     args.push(bold(&env.name));
    |               ^^^^^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0277]: the trait bound `String: From<&&String>` is not satisfied
   --> src/man.rs:321:24
    |
321 |       args.push(italic(&default));
    |                 ------ ^^^^^^^^
    |                 |      |
    |                 |      the trait `From<&&String>` is not implemented for `String`
    |                 |      help: consider adding dereference here: `&*default`
    |                 required by a bound introduced by this call
    |
    = help: the following implementations were found:
              <String as From<&String>>
              <String as From<&mut str>>
              <String as From<&str>>
              <String as From<Box<str>>>
            and 2 others
    = note: required because of the requirements on the impl of `Into<String>` for `&&String`
note: required by a bound in `italic`
   --> /usr/share/cargo/registry/roff-0.2.1/src/lib.rs:195:27
    |
195 | pub fn italic(input: impl Into<String>) -> Inline {
    |                           ^^^^^^^^^^^^ required by this bound in `italic`

error[E0308]: mismatched types
   --> src/man.rs:321:17
    |
321 |       args.push(italic(&default));
    |                 ^^^^^^^^^^^^^^^^ expected struct `String`, found enum `Inline`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:334:8
    |
334 |   page.section("ENVIRONMENT", &arr)
    |        ^^^^^^^ method not found in `Roff`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:353:8
    |
353 |   page.section(
    |        ^^^^^^^ method not found in `Roff`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:383:8
    |
383 |   page.section(&custom_section.name, &paragraphs)
    |        ^^^^^^^ method not found in `Roff`

error[E0308]: mismatched types
   --> src/man.rs:425:64
    |
425 |     let example = list(&[text], &[bold(full_command.as_str()), output]);
    |                                                                ^^^^^^ expected enum `Inline`, found struct `String`

error[E0599]: no method named `section` found for struct `Roff` in the current scope
   --> src/man.rs:428:8
    |
428 |   page.section("examples", &arr)
    |        ^^^^^^^ method not found in `Roff`

Some errors have detailed explanations: E0061, E0277, E0308, E0432, E0599.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `man` due to 28 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

dkg avatar Nov 02 '22 20:11 dkg