fork download
  1. fn foo(message: Message, content: String) -> Result<(), Error> {
  2. let message_content = format!("```\n{}\n```", table_str);
  3. let mut msg = htc.create_message(message.channel_id)
  4. .reply(message.message_id)
  5. .content(&message_content)
  6.  
  7. match msg {
  8. Err(e) => match e.kind() {
  9. MessageValidationErrorType::ContentInvalid => {
  10. msg = htc.create_message(message.channel_id)
  11. .reply(message.message_id)
  12. .attachments(&[Attachment::from_bytes("foo.txt".to_owned(), content.into_bytes(), 1)])
  13. .content("foo")
  14. },
  15. _ => {}
  16. }
  17. }
  18.  
  19. let Ok(msg) = msg else {
  20. return Err(Error("CME"));
  21. }
  22.  
  23. msg.await?;
  24. Ok(())
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
error: expected `;`, found keyword `match`
 --> prog.rs:5:29
  |
5 |         .content(&message_content)
  |                                   ^ help: add `;` here
6 |         
7 |     match msg {
  |     ----- unexpected token

error: expected `;`, found `msg`
  --> prog.rs:21:3
   |
21 |     }
   |      ^ help: add `;` here
22 |     
23 |     msg.await?;
   |     --- unexpected token

error[E0433]: failed to resolve: use of undeclared type `MessageValidationErrorType`
 --> prog.rs:9:4
  |
9 |             MessageValidationErrorType::ContentInvalid => {
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type `MessageValidationErrorType`

error[E0433]: failed to resolve: use of undeclared type `Attachment`
  --> prog.rs:12:21
   |
12 |                     .attachments(&[Attachment::from_bytes("foo.txt".to_owned(), content.into_bytes(), 1)])
   |                                    ^^^^^^^^^^ use of undeclared type `Attachment`

error[E0412]: cannot find type `Message` in this scope
 --> prog.rs:1:17
  |
1 | fn foo(message: Message, content: String) -> Result<(), Error> {
  |                 ^^^^^^^ not found in this scope

error[E0412]: cannot find type `Error` in this scope
 --> prog.rs:1:57
  |
1 | fn foo(message: Message, content: String) -> Result<(), Error> {
  |                                                         ^^^^^ not found in this scope
  |
help: consider importing one of these items
  |
1 | use std::error::Error;
  |
1 | use std::fmt::Error;
  |
1 | use std::io::Error;
  |

error[E0425]: cannot find value `table_str` in this scope
 --> prog.rs:2:48
  |
2 |     let message_content = format!("```\n{}\n```", table_str);
  |                                                   ^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `htc` in this scope
 --> prog.rs:3:16
  |
3 |     let mut msg = htc.create_message(message.channel_id)
  |                   ^^^ not found in this scope

error[E0425]: cannot find value `htc` in this scope
  --> prog.rs:10:11
   |
10 |                 msg = htc.create_message(message.channel_id)
   |                       ^^^ not found in this scope

error[E0425]: cannot find function, tuple struct or tuple variant `Error` in this scope
  --> prog.rs:20:14
   |
20 |         return Err(Error("CME"));
   |                    ^^^^^ not found in this scope
   |
help: consider importing this unit struct
   |
1  | use std::fmt::Error;
   |

error[E0658]: `let...else` statements are unstable
  --> prog.rs:19:2
   |
19 | /     let Ok(msg) = msg else {
20 | |         return Err(Error("CME"));
21 | |     }
   | |_____^
   |
   = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information

error[E0601]: `main` function not found in crate `prog`
  --> prog.rs:1:1
   |
1  | / fn foo(message: Message, content: String) -> Result<(), Error> {
2  | |     let message_content = format!("```\n{}\n```", table_str);
3  | |     let mut msg = htc.create_message(message.channel_id)
4  | |         .reply(message.message_id)
...  |
24 | |     Ok(())
25 | | }
   | |_^ consider adding a `main` function to `prog.rs`

error: aborting due to 12 previous errors

Some errors have detailed explanations: E0412, E0425, E0433, E0601, E0658.
For more information about an error, try `rustc --explain E0412`.
stdout
Standard output is empty