Skip to main content

unreachable_code

#![allow(unreachable_code)]


fn main() {
    println!("{:?}", {
        fn foo(domains: Vec<Vec<String>>) -> HashSet<&String> { domains.iter().flat_map(|sub| sub.iter()).collect() }
    });
}


/* ~~~~=== stderr ===~~~~
   Compiling playground v0.0.1 (/playground)
error[E0412]: cannot find type `HashSet` in this scope
 --> src/main.rs:6:46
  |
6 |         fn foo(domains: Vec<Vec<String>>) -> HashSet<&String> { domains.iter().flat_map(|sub| sub.iter()).collect() }
  |                                              ^^^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
  |
4 | use hashbrown::HashSet;
  |
4 | use hashbrown::hash_set::HashSet;
  |
4 | use std::collections::HashSet;
  |
4 | use std::collections::hash_set::HashSet;
  |

error[E0106]: missing lifetime specifier
 --> src/main.rs:6:54
  |
6 |         fn foo(domains: Vec<Vec<String>>) -> HashSet<&String> { domains.iter().flat_map(|sub| sub.iter()).collect() }
  |                                                      ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
  |
  = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments

error: aborting due to 2 previous errors

Some errors occurred: E0106, E0412.
For more information about an error, try `rustc --explain E0106`.
error: Could not compile `playground`.

To learn more, run the command again with --verbose.

*/

/* ~~~~=== stdout ===~~~~

*/