Skip to content

Commit b92b7c0

Browse files
committed
Auto merge of rust-lang#14598 - lowr:fix/release-channel-from-str, r=lnicola
Fix release channel detection We detect toolchain's release channel by looking at pre-release identifier of cargo/rustc's version string. It's empty for stable, "beta" or "beta.x" for beta, and "nightly" for nightly. See rust-lang/rust's [bootstrap code] for how the version string is determined. [bootstrap code]: https://github.com/rust-lang/rust/blob/e49122fb1ca87a6c3e3c22abb315fc75cfe8daed/src/bootstrap/lib.rs#L1244
2 parents 1f92641 + 4db87f9 commit b92b7c0

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

crates/base-db/src/input.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ impl ReleaseChannel {
284284

285285
pub fn from_str(str: &str) -> Option<Self> {
286286
Some(match str {
287-
"stable" => ReleaseChannel::Stable,
288-
"beta" => ReleaseChannel::Beta,
287+
"" => ReleaseChannel::Stable,
289288
"nightly" => ReleaseChannel::Nightly,
289+
_ if str.starts_with("beta") => ReleaseChannel::Beta,
290290
_ => return None,
291291
})
292292
}

crates/ide-completion/src/tests/use_tree.rs

-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ use self::foo::impl$0
387387
fn use_tree_no_unstable_items_on_stable() {
388388
check(
389389
r#"
390-
//- toolchain:stable
391390
//- /lib.rs crate:main deps:std
392391
use std::$0
393392
//- /std.rs crate:std

crates/project-model/src/workspace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ fn project_json_to_crate_graph(
779779
CrateOrigin::Local { repo: None, name: None }
780780
},
781781
target_layout.clone(),
782-
None,
782+
channel,
783783
);
784784
if *is_proc_macro {
785785
if let Some(path) = proc_macro_dylib_path.clone() {

crates/test-utils/src/fixture.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ impl FixtureWithProjectMeta {
111111
/// //- minicore: sized
112112
/// ```
113113
///
114-
/// That will include predefined proc macros and a subset of `libcore` into the fixture, see
115-
/// `minicore.rs` for what's available.
114+
/// That will set toolchain to nightly and include predefined proc macros and a subset of
115+
/// `libcore` into the fixture, see `minicore.rs` for what's available. Note that toolchain
116+
/// defaults to stable.
116117
pub fn parse(ra_fixture: &str) -> Self {
117118
let fixture = trim_indent(ra_fixture);
118119
let mut fixture = fixture.as_str();

0 commit comments

Comments
 (0)