In rust-lang/rust#49451 i added an --edition
flag to rustdoc that made it compile crates and doctests in the given edition. Cargo should be extended to call this flag when an edition is present in a project's Cargo.toml.
At present the flag is unstable, so a -Z unstable-options
will need to be passed to rustdoc for it to work properly. I'm not sure how cargo handles the flag for rustc, but i imagine something similar should happen for rustdoc.