Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Also, revert the following commits:

- cc8b57a
- 7e9057f
  • Loading branch information
smoelius committed Jan 23, 2023
1 parent 7e9057f commit 1299cd5
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 9 deletions.
7 changes: 6 additions & 1 deletion cargo-dylint/tests/boundary_toolchains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ use tempfile::tempdir;
use test_log::test;

// smoelius: The channel date is one day later than the `rustc --version` date.
const BOUNDARIES: [(&str, &str); 2] = [("2022-07-14", "2022-07-15"), ("2022-09-08", "2022-09-09")];
// smoelius: Put recent boundaries first, since they're more likely to cause problems.
const BOUNDARIES: [(&str, &str); 3] = [
("2023-01-19", "2023-01-20"),
("2022-09-08", "2022-09-09"),
("2022-07-14", "2022-07-15"),
];

#[test]
fn boundary_toolchains() {
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ published() {
echo '[workspace]' >> Cargo.toml
cat > rust-toolchain << EOF
[toolchain]
channel = "nightly-2023-01-19"
channel = "nightly"
components = ["llvm-tools-preview", "rustc-dev"]
EOF
echo "Checking whether \`$1:$2\` is published ..." >&2
Expand Down
120 changes: 120 additions & 0 deletions utils/linting/Cargo.lock

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

3 changes: 3 additions & 0 deletions utils/linting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ toml = "0.5"

dylint_internal = { version = "=2.1.3", path = "../../internal" }

[dev-dependencies]
assert_cmd = "2.0"

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]

Expand Down
3 changes: 1 addition & 2 deletions utils/linting/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[toolchain]
# smoelius: Temporarily pin to `nightly-2023-01-19` until rust-lang/rust#106810 can be dealt with.
channel = "nightly-2023-01-19"
channel = "nightly"
components = ["llvm-tools-preview", "rustc-dev"]
28 changes: 23 additions & 5 deletions utils/linting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ use cargo_metadata::{Metadata, MetadataCommand};
use dylint_internal::env;
use rustc_session::Session;
use rustc_span::Symbol;
use std::{any::type_name, cell::RefCell, fs::read_to_string, path::Path, sync::Mutex};
use std::{
any::type_name,
cell::RefCell,
fs::read_to_string,
path::{Path, PathBuf},
sync::Mutex,
};
use thiserror::Error;

pub const DYLINT_VERSION: &str = "0.1.0";
Expand Down Expand Up @@ -72,8 +78,8 @@ macro_rules! __make_late_closure {
}

// smoelius: Relevant PR and merge commit:
// * https://github.com/rust-lang/rust/pull/101501
// * https://github.com/rust-lang/rust/commit/87788097b776f8e3662f76627944230684b671bd
// - https://github.com/rust-lang/rust/pull/101501
// - https://github.com/rust-lang/rust/commit/87788097b776f8e3662f76627944230684b671bd
#[rustversion::since(2022-09-08)]
#[doc(hidden)]
#[macro_export]
Expand Down Expand Up @@ -310,8 +316,7 @@ pub fn try_init_config(sess: &Session) -> ConfigResult<()> {
Some(Symbol::intern(&value)),
));
Some(value)
} else if let Some(local_crate_source_file) = sess
.local_crate_source_file
} else if let Some(local_crate_source_file) = local_crate_source_file(sess)
.as_deref()
.map(Path::canonicalize)
.transpose()?
Expand Down Expand Up @@ -363,3 +368,16 @@ pub fn try_init_config(sess: &Session) -> ConfigResult<()> {

Ok(())
}

#[rustversion::before(2023-01-19)]
fn local_crate_source_file(sess: &Session) -> Option<PathBuf> {
sess.local_crate_source_file.clone()
}

// smoelius: Relevant PR and merge commit:
// - https://github.com/rust-lang/rust/pull/106810
// - https://github.com/rust-lang/rust/commit/65d2f2a5f9c323c88d1068e8e90d0b47a20d491c
#[rustversion::since(2023-01-19)]
fn local_crate_source_file(sess: &Session) -> Option<PathBuf> {
sess.local_crate_source_file()
}
18 changes: 18 additions & 0 deletions utils/linting/tests/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use assert_cmd::{assert::AssertResult, prelude::*};

#[test]
fn builds_with_latest_nightly() {
update_nightly().unwrap();

std::process::Command::new("cargo")
.args(["+nightly", "build"])
.assert()
.success();
}

fn update_nightly() -> AssertResult {
std::process::Command::new("rustup")
.args(["update", "--no-self-update", "nightly"])
.assert()
.try_success()
}

0 comments on commit 1299cd5

Please sign in to comment.