Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Auto merge of #1709 - m-ou-se:2021, r=Xanewok
Browse files Browse the repository at this point in the history
Add edition 2021.

See rust-lang/rust#80576. This un-breaks the build of RLS after rust-lang/rust#79576 broke it.
  • Loading branch information
bors committed Jan 10, 2021
2 parents 2cf84ba + 956c2e2 commit 288260a
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 47 deletions.
90 changes: 45 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ lsp-types = { version = "0.60", features = ["proposed"] }
lazy_static = "1"
log = "0.4"
num_cpus = "1"
racer = { version = "2.1.41", default-features = false }
racer = { version = "2.1.42", default-features = false }
rand = "0.7"
rayon = "1"
rustc_tools_util = "0.2"
rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", branch = "rustfmt-1.4.29" }
rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", branch = "rustfmt-1.4.31" }
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
Expand Down
2 changes: 2 additions & 0 deletions rls-ipc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@ pub enum Edition {
Edition2015,
/// Rust 2018
Edition2018,
/// Rust 2021
Edition2021,
}
1 change: 1 addition & 0 deletions rls-rustc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ impl Callbacks for ShimCalls {
edition: match sess.edition() {
rustc_span::edition::Edition::Edition2015 => Edition::Edition2015,
rustc_span::edition::Edition::Edition2018 => Edition::Edition2018,
rustc_span::edition::Edition::Edition2021 => Edition::Edition2021,
},
};

Expand Down
1 change: 1 addition & 0 deletions rls/src/actions/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ fn reformat(
let edition = match edition {
Edition::Edition2015 => RustfmtEdition::Edition2015,
Edition::Edition2018 => RustfmtEdition::Edition2018,
Edition::Edition2021 => RustfmtEdition::Edition2021,
};
config.set().edition(edition);
trace!("Detected edition {:?} for file `{}`", edition, path.display());
Expand Down
1 change: 1 addition & 0 deletions rls/src/build/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ mod callbacks {
edition: match krate.edition {
rls_ipc::rpc::Edition::Edition2015 => crate::build::plan::Edition::Edition2015,
rls_ipc::rpc::Edition::Edition2018 => crate::build::plan::Edition::Edition2018,
rls_ipc::rpc::Edition::Edition2021 => crate::build::plan::Edition::Edition2021,
},
disambiguator: krate.disambiguator,
}
Expand Down
2 changes: 2 additions & 0 deletions rls/src/build/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ pub struct Crate {
pub enum Edition {
Edition2015,
Edition2018,
Edition2021,
}

impl Default for Edition {
Expand All @@ -251,6 +252,7 @@ impl std::convert::TryFrom<&str> for Edition {
Ok(match val {
"2015" => Edition::Edition2015,
"2018" => Edition::Edition2018,
"2021" => Edition::Edition2021,
_ => return Err("unknown"),
})
}
Expand Down
1 change: 1 addition & 0 deletions rls/src/build/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ impl rustc_driver::Callbacks for RlsRustcCalls {
edition: match sess.edition() {
RustcEdition::Edition2015 => Edition::Edition2015,
RustcEdition::Edition2018 => Edition::Edition2018,
RustcEdition::Edition2021 => Edition::Edition2021,
},
};

Expand Down

0 comments on commit 288260a

Please sign in to comment.