Questions tagged [rust-2021]

Use this tag for code that requires Rust 2021 to compile or questions specifically related to the Rust 2021 edition.

Use this tag for code that requires Rust 2021 to compile or questions specifically related to the Rust 2021 edition.

RFC 3085 introduced the 2021 Edition.

For documentation about Rust editions, see the Edition Guide

4 questions
4
votes
2 answers

Can Rust macros be shared across editions?

Say a Rust 2018 macro defines an async function inside it. The syntax it would use would be incompatible with Rust 2015. So if you're compiling your crate with 2015 edition, wouldn't this expanded code from the macro conflict with that? I'm not that…
zombiesauce
  • 1,009
  • 1
  • 7
  • 22
1
vote
1 answer

Module resolution

I have the following code in src/ main.rs a.rs b.rs Here's the code: main.rs mod a; mod b; use crate::a::Summary; use crate::b::Person; fn main() { let p = Person{ first: "John".to_string(), last:…
1
vote
2 answers

`match` arms have incompatible types

I have some code that needs to create and use a quick_xml::Writer with either a File or Cursor depending on user input. What is the proper Rust way (non-inheritance/no downcasting) to create a Writer with different structs but same trait? All the…
David
  • 692
  • 8
  • 21
0
votes
1 answer

Can `use std::io` break my code after update of `rustc`?

I'm learning rust for fun after C++ class and I'm wondering, can use std::io break my code after update of rustc edition to newer? For example, in C++ using using namespace std is bad, because if new function gets added to std your multiple…
blonded04
  • 147
  • 9