2018-Specific Changes
The following is a summary of changes that only apply to code compiled withthe 2018 edition compared to the 2015 edition.
- Path changes:
- Paths in
use
declarations work the same as other paths. - Paths starting with
::
must be followed with an external crate. - Paths in
pub(in path)
visibility modifiers must start withcrate
,self
, orsuper
.
- Paths in
- Anonymous trait function parameters are not allowed.
- Trait function parameters may use any irrefutable pattern when thefunction has a body.
dyn
is a strict keyword, in 2015 it is a weak keyword.async
,await
, andtry
are reserved keywords.- The following lints are now deny by default:
Cargo
- If there is a target definition in a
Cargo.toml
manifest, it no longerautomatically disables automatic discovery of other targets. - Target paths of the form
src/{target_name}.rs
are no longer inferred fortargets where thepath
field is not set. cargo install
for the current directory is no longer allowed, you mustspecifycargo install —path .
to install the current package.