diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..51e8671c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +*.dot text eol=lf +*.fixed text eol=lf +*.rs text eol=lf +*.sh text eol=lf +*.stderr text eol=lf +*.toml text eol=lf diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 756c6f5f..9ae2183d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,11 @@ on: - 'README.md' - 'CONTRIBUTING.md' - '.vscode/**' + workflow_dispatch: + +defaults: + run: + shell: bash jobs: build: @@ -22,19 +27,33 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 with: # Unsetting this would make so that any malicious package could get our Github Token persist-credentials: false - - run: cargo fmt --check - - run: cargo test --all - - run: cargo test --all + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Format check + run: cargo fmt --check + - name: Test rpl with embedded patterns + run: cargo test --all + - name: Test rpl with external patterns (actually the same with embedded ones) + run: cargo test --all env: RPL_PATS: docs/patterns-pest - - run: cargo clippy -- -D warnings - - run: cargo install --path . - - run: cargo rpl --workspace --all-targets + - name: Run Clippy + run: cargo clippy -- -D warnings + - name: Install rpl + run: cargo install --path . --verbose + - name: Test installed rpl + run: cargo rpl --workspace --all-targets --verbose # - uses: actions-rust-lang/audit@v1.2.4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9052f997..4f334ddc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,10 @@ Then, use `cargo +nightly-2025-02-14 rpl` to run RPL in your own repository to d > Every three months (or so), the toolchain will be updated to the latest nightly version. You can check the current toolchain by running `rustc -V` in the RPL repository. +# Development Setup + +When aiming to update the pattern grammar, you should first set your RUSTUP_HOME environment variable, normally `%USERPROFILE%\.rustup` on Windows, so that the build script of `rpl_parser` crate can find the rustfmt binary in your toolchains. + # Tests - Use `cargo tests` (short for `cargo test --all`) to run all tests. diff --git a/Cargo.lock b/Cargo.lock index d5626037..f212aacd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.95" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "autocfg" @@ -308,7 +308,7 @@ dependencies = [ "eyre", "indenter", "once_cell", - "owo-colors", + "owo-colors 3.5.0", "tracing-error", ] @@ -340,7 +340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2" dependencies = [ "once_cell", - "owo-colors", + "owo-colors 3.5.0", "tracing-core", "tracing-error", ] @@ -351,16 +351,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" -[[package]] -name = "colored" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" -dependencies = [ - "lazy_static", - "windows-sys 0.59.0", -] - [[package]] name = "colored" version = "3.0.0" @@ -378,15 +368,15 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335" [[package]] name = "console" -version = "0.15.10" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" +checksum = "03e45a4a8926227e4197636ba97a9fc9b00477e9f4bd711395687c5f0734bec4" dependencies = [ "encode_unicode", "libc", "once_cell", "unicode-width 0.2.0", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -921,14 +911,14 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.11" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" +checksum = "9375e112e4b463ec1b1c6c011953545c65a30164fbab5b581df32b3abf0dcb88" dependencies = [ "console", - "number_prefix", "portable-atomic", "unicode-width 0.2.0", + "unit-prefix", "web-time", ] @@ -1173,12 +1163,6 @@ dependencies = [ "libc", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - [[package]] name = "object" version = "0.32.2" @@ -1201,13 +1185,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] -name = "pad" -version = "0.1.6" +name = "owo-colors" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3" -dependencies = [ - "unicode-width 0.1.14", -] +checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" [[package]] name = "parking_lot" @@ -1382,12 +1363,11 @@ dependencies = [ [[package]] name = "prettydiff" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abec3fb083c10660b3854367697da94c674e9e82aa7511014dc958beeb7215e9" +checksum = "ac17546d82912e64874e3d5b40681ce32eac4e5834344f51efcf689ff1550a65" dependencies = [ - "owo-colors", - "pad", + "owo-colors 4.2.3", ] [[package]] @@ -1617,7 +1597,7 @@ dependencies = [ name = "rpl_meta" version = "0.1.0" dependencies = [ - "colored 3.0.0", + "colored", "derive_more", "error-enum", "pest", @@ -1653,7 +1633,7 @@ version = "0.1.0" name = "rpl_parser" version = "0.1.0" dependencies = [ - "colored 3.0.0", + "colored", "derive_more", "pest", "pest_derive", @@ -1923,10 +1903,11 @@ checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "spanned" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86af297923fbcfd107c20a189a6e9c872160df71a7190ae4a7a6c5dce4b2feb6" +checksum = "c92d4b0c055fde758f086eb4a6e73410247df8a3837fd606d2caeeaf72aa566d" dependencies = [ + "anyhow", "bstr", "color-eyre", ] @@ -2214,9 +2195,9 @@ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "ui_test" -version = "0.29.2" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1211b1111c752c73b33073d2958072be08825fd97c9ab4d83444da361a06634b" +checksum = "ada249620d81f010b9a1472b63a5077ac7c722dd0f4bacf6528b313d0b8c15d8" dependencies = [ "annotate-snippets", "anyhow", @@ -2224,7 +2205,7 @@ dependencies = [ "cargo-platform", "cargo_metadata 0.18.1", "color-eyre", - "colored 2.2.0", + "colored", "comma", "crossbeam-channel", "indicatif", @@ -2262,6 +2243,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + [[package]] name = "untrusted" version = "0.9.0" @@ -2474,6 +2461,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" version = "0.52.0" @@ -2492,6 +2485,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-targets" version = "0.52.6" diff --git a/Cargo.toml b/Cargo.toml index cb396bc3..7be0de4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ color-print = "0.3.4" anstream = "0.6.0" [dev-dependencies] -ui_test = "0.29.2" +ui_test = "0.30.4" tester = "0.9" regex = "1.5" toml.workspace = true diff --git a/crates/rpl_parser/build.rs b/crates/rpl_parser/build.rs index 10d636b4..25f3142b 100644 --- a/crates/rpl_parser/build.rs +++ b/crates/rpl_parser/build.rs @@ -1,11 +1,21 @@ +use std::env::VarError; use std::fs::{File, read_to_string}; use std::io::Write as _; +use std::path::Path; use std::process::{Command, Stdio}; use quote::quote; +const TOOLCHAIN_PREFIX: &str = "nightly-2025-02-14"; + fn main() -> Result<(), Box> { println!("cargo::rerun-if-changed=src/grammar/RPL.pest"); + + let Some(rustfmt) = find_rustfmt_path()? else { + println!("cargo::warning=Could not find rustfmt for {TOOLCHAIN_PREFIX}, skipping parser generation."); + return Ok(()); + }; + let parser = { use pest_typed_generator::derive_typed_parser; let input = quote! { @@ -18,8 +28,6 @@ fn main() -> Result<(), Box> { derive_typed_parser(input.clone(), false, true) }; - let rustfmt = find_rustfmt_path()?; - let child = Command::new(rustfmt) .stdin(Stdio::piped()) .stdout(Stdio::piped()) @@ -41,10 +49,14 @@ fn main() -> Result<(), Box> { Ok(()) } -fn find_rustfmt_path() -> Result> { - let rustup_home = std::env::var("RUSTUP_HOME")?; +fn find_rustfmt_path() -> Result, Box> { + let rustup_home = match std::env::var("RUSTUP_HOME") { + Ok(val) => val, + Err(VarError::NotPresent) => return Ok(None), + Err(e) => return Err(Box::new(e)), + }; - let toolchains_dir = format!("{}/toolchains", rustup_home); + let toolchains_dir = Path::new(&rustup_home).join("toolchains"); let toolchains = std::fs::read_dir(toolchains_dir)? .filter_map(|entry| entry.ok()) .filter(|entry| entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false)) @@ -56,16 +68,21 @@ fn find_rustfmt_path() -> Result> { .file_stem() // Remember to update the date in the condition below if you change the nightly toolchain date. // FIXME: This is a temporary solution to use a specific nightly toolchain. - .is_some_and(|stem| stem.to_str().is_some_and(|stem| stem.starts_with("nightly-2025-02-14"))) + .is_some_and(|stem| stem.to_str().is_some_and(|stem| stem.starts_with(TOOLCHAIN_PREFIX))) { continue; // Use only the nightly toolchain from 2025-02-14 } - let rustfmt_candidate = toolchain.join("bin/rustfmt"); + let rustfmt_executable = if cfg!(windows) { "rustfmt.exe" } else { "rustfmt" }; + let rustfmt_candidate = toolchain.join("bin").join(rustfmt_executable); if rustfmt_candidate.exists() { - return Ok(rustfmt_candidate.to_str().unwrap().to_string()); + return Ok(Some( + rustfmt_candidate + .to_str() + .ok_or_else(|| format!("Invalid UTF-8 in rustfmt path {:?}", rustfmt_candidate))? + .to_string(), + )); } } - let err = "Could not find rustfmt in any toolchain"; - Err(err.into()) + Ok(None) } diff --git a/tests/compile-test.rs b/tests/compile-test.rs index d726c04e..11b8f732 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -11,7 +11,8 @@ use std::path::{Path, PathBuf}; use ui_test::custom_flags::edition::Edition; use ui_test::custom_flags::rustfix::RustfixMode; use ui_test::spanned::Spanned; -use ui_test::{Args, Config, error_on_output_conflict, status_emitter}; +use ui_test::status_emitter::StatusEmitter; +use ui_test::{Args, Config, Match, error_on_output_conflict}; // Test dependencies may need an `extern crate` here to ensure that they show up // in the depinfo file (otherwise cargo thinks they are unused) @@ -196,6 +197,14 @@ impl TestContext { config.program.program = profile_path.join(if cfg!(windows) { "rpl-driver.exe" } else { "rpl-driver" }); + config + .comment_defaults + .base() + .normalize_stderr + .push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR".into())); + + config.fill_host_and_target().unwrap(); + config } } @@ -207,7 +216,7 @@ fn run_ui(cx: &TestContext) { vec![config], ui_test::default_file_filter, ui_test::default_per_file_config, - status_emitter::Text::from(cx.args.format), + Box::::from(cx.args.format), ) .unwrap(); } diff --git a/tests/ui/cve/cve_2021_27376/src/adjusted.rs b/tests/ui/cve/cve_2021_27376/src/adjusted.rs index 4dfc5faf..25ab659f 100644 --- a/tests/ui/cve/cve_2021_27376/src/adjusted.rs +++ b/tests/ui/cve/cve_2021_27376/src/adjusted.rs @@ -1,7 +1,7 @@ //@ revisions: inline regular //@[inline] compile-flags: -Z inline-mir=true //@[regular] compile-flags: -Z inline-mir=false - +//@ignore-target: windows extern crate libc; use libc::{sockaddr, sockaddr_storage, socklen_t}; diff --git a/tests/ui/cve/cve_2021_27376/src/lib.inline.stderr b/tests/ui/cve/cve_2021_27376/src/lib.inline.stderr index 0234823b..86aaab1f 100644 --- a/tests/ui/cve/cve_2021_27376/src/lib.inline.stderr +++ b/tests/ui/cve/cve_2021_27376/src/lib.inline.stderr @@ -1,26 +1,26 @@ error: wrong assumption of layout compatibility from `std::net::SocketAddrV4` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/lib.rs:70:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 | LL | ... SocketAddr::V4(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/lib.rs:70:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 | LL | ... SocketAddr::V4(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^ = note: `#[deny(rpl::wrong_assumption_of_layout_compatibility)]` on by default error: wrong assumption of layout compatibility from `std::net::SocketAddrV6` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:72:38 | LL | ... SocketAddr::V6(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:72:38 | LL | ... SocketAddr::V6(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^ diff --git a/tests/ui/cve/cve_2021_27376/src/lib.regular.stderr b/tests/ui/cve/cve_2021_27376/src/lib.regular.stderr index 0234823b..86aaab1f 100644 --- a/tests/ui/cve/cve_2021_27376/src/lib.regular.stderr +++ b/tests/ui/cve/cve_2021_27376/src/lib.regular.stderr @@ -1,26 +1,26 @@ error: wrong assumption of layout compatibility from `std::net::SocketAddrV4` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/lib.rs:70:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 | LL | ... SocketAddr::V4(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/lib.rs:70:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 | LL | ... SocketAddr::V4(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^ = note: `#[deny(rpl::wrong_assumption_of_layout_compatibility)]` on by default error: wrong assumption of layout compatibility from `std::net::SocketAddrV6` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:72:38 | LL | ... SocketAddr::V6(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38 + --> tests/ui/cve/cve_2021_27376/src/lib.rs:72:38 | LL | ... SocketAddr::V6(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _), | ^^^^ diff --git a/tests/ui/cve/cve_2021_27376/src/lib.rs b/tests/ui/cve/cve_2021_27376/src/lib.rs index 40a69174..a0b14078 100644 --- a/tests/ui/cve/cve_2021_27376/src/lib.rs +++ b/tests/ui/cve/cve_2021_27376/src/lib.rs @@ -1,6 +1,7 @@ //@revisions: inline regular //@[inline]compile-flags: -Z inline-mir=true //@[regular]compile-flags: -Z inline-mir=false +//@ignore-target: windows #![allow(unsafe_op_in_unsafe_fn)] //! Non-blocking TCP or Unix connect. diff --git a/tests/ui/cve/cve_2021_27376/src/minimal.rs b/tests/ui/cve/cve_2021_27376/src/minimal.rs index f556535c..6a73175a 100644 --- a/tests/ui/cve/cve_2021_27376/src/minimal.rs +++ b/tests/ui/cve/cve_2021_27376/src/minimal.rs @@ -1,3 +1,4 @@ +//@ignore-target: windows fn main() { let s: *const core::net::SocketAddrV4 = core::ptr::null(); let t1 = s as *const libc::sockaddr; diff --git a/tests/ui/cve/cve_2021_27376/src/minimal.stderr b/tests/ui/cve/cve_2021_27376/src/minimal.stderr index 849d4868..75712599 100644 --- a/tests/ui/cve/cve_2021_27376/src/minimal.stderr +++ b/tests/ui/cve/cve_2021_27376/src/minimal.stderr @@ -1,26 +1,26 @@ error: wrong assumption of layout compatibility from `std::net::SocketAddrV4` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/minimal.rs:3:14 + --> tests/ui/cve/cve_2021_27376/src/minimal.rs:4:14 | LL | let t1 = s as *const libc::sockaddr; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/minimal.rs:3:14 + --> tests/ui/cve/cve_2021_27376/src/minimal.rs:4:14 | LL | let t1 = s as *const libc::sockaddr; | ^ = note: `#[deny(rpl::wrong_assumption_of_layout_compatibility)]` on by default error: wrong assumption of layout compatibility from `std::net::SocketAddrV6` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/minimal.rs:6:14 + --> tests/ui/cve/cve_2021_27376/src/minimal.rs:7:14 | LL | let t2 = s as *const libc::sockaddr; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/minimal.rs:6:14 + --> tests/ui/cve/cve_2021_27376/src/minimal.rs:7:14 | LL | let t2 = s as *const libc::sockaddr; | ^ diff --git a/tests/ui/cve/cve_2021_27376/src/simplified.inline.stderr b/tests/ui/cve/cve_2021_27376/src/simplified.inline.stderr index 850aa4ab..699e976b 100644 --- a/tests/ui/cve/cve_2021_27376/src/simplified.inline.stderr +++ b/tests/ui/cve/cve_2021_27376/src/simplified.inline.stderr @@ -1,26 +1,26 @@ error: wrong assumption of layout compatibility from `std::net::SocketAddrV4` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:22:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:23:17 | LL | addr as *const SocketAddrV4 as *const sockaddr, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:22:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:23:17 | LL | addr as *const SocketAddrV4 as *const sockaddr, | ^^^^ = note: `#[deny(rpl::wrong_assumption_of_layout_compatibility)]` on by default error: wrong assumption of layout compatibility from `std::net::SocketAddrV6` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:27:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:28:17 | LL | addr as *const SocketAddrV6 as *const sockaddr, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:27:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:28:17 | LL | addr as *const SocketAddrV6 as *const sockaddr, | ^^^^ diff --git a/tests/ui/cve/cve_2021_27376/src/simplified.regular.stderr b/tests/ui/cve/cve_2021_27376/src/simplified.regular.stderr index 850aa4ab..699e976b 100644 --- a/tests/ui/cve/cve_2021_27376/src/simplified.regular.stderr +++ b/tests/ui/cve/cve_2021_27376/src/simplified.regular.stderr @@ -1,26 +1,26 @@ error: wrong assumption of layout compatibility from `std::net::SocketAddrV4` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:22:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:23:17 | LL | addr as *const SocketAddrV4 as *const sockaddr, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:22:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:23:17 | LL | addr as *const SocketAddrV4 as *const sockaddr, | ^^^^ = note: `#[deny(rpl::wrong_assumption_of_layout_compatibility)]` on by default error: wrong assumption of layout compatibility from `std::net::SocketAddrV6` to `libc::sockaddr` - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:27:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:28:17 | LL | addr as *const SocketAddrV6 as *const sockaddr, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here | = help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802 note: casted from this - --> tests/ui/cve/cve_2021_27376/src/simplified.rs:27:17 + --> tests/ui/cve/cve_2021_27376/src/simplified.rs:28:17 | LL | addr as *const SocketAddrV6 as *const sockaddr, | ^^^^ diff --git a/tests/ui/cve/cve_2021_27376/src/simplified.rs b/tests/ui/cve/cve_2021_27376/src/simplified.rs index 8b7c0af2..ccebdd4c 100644 --- a/tests/ui/cve/cve_2021_27376/src/simplified.rs +++ b/tests/ui/cve/cve_2021_27376/src/simplified.rs @@ -1,6 +1,7 @@ //@revisions: inline regular //@[inline]compile-flags: -Z inline-mir=true //@[regular]compile-flags: -Z inline-mir=false +//@ignore-target: windows extern crate libc; use libc::{sockaddr, sockaddr_storage, socklen_t}; diff --git a/tests/ui/utils/dump_hir.fixed b/tests/ui/utils/dump_hir.fixed index 0f164081..7ff29963 100644 --- a/tests/ui/utils/dump_hir.fixed +++ b/tests/ui/utils/dump_hir.fixed @@ -1,5 +1,6 @@ -//@ normalize-stderr-test: "\d+:\d+ ~ (\w+)\[[0-9a-f]{4}\]" -> "$1" -//@ normalize-stderr-test: "/.*/lib/rustlib/src/rust/library" -> "$$SRC_DIR" +//@ normalize-stderr-test: "span: (.*):(\d+):(\d+): (\d+):(\d+) \(#\d+\)" -> "span: $1:$2:$3: $4:$5 (#N)" +//@ normalize-stderr-test: "DefId\(\d+:\d+ ~ (\w+)\[[0-9a-f]{4}\]" -> "DefId($1" +//@ normalize-stderr-test: "(\w:)?[/\\].*[/\\]lib[/\\]rustlib[/\\]src[/\\]rust[/\\]library" -> "$$SRC_DIR" #![feature(stmt_expr_attributes)] //~ ERROR: abort due to debugging diff --git a/tests/ui/utils/dump_hir.rs b/tests/ui/utils/dump_hir.rs index 87a96868..219fa525 100644 --- a/tests/ui/utils/dump_hir.rs +++ b/tests/ui/utils/dump_hir.rs @@ -1,5 +1,6 @@ -//@ normalize-stderr-test: "\d+:\d+ ~ (\w+)\[[0-9a-f]{4}\]" -> "$1" -//@ normalize-stderr-test: "/.*/lib/rustlib/src/rust/library" -> "$$SRC_DIR" +//@ normalize-stderr-test: "span: (.*):(\d+):(\d+): (\d+):(\d+) \(#\d+\)" -> "span: $1:$2:$3: $4:$5 (#N)" +//@ normalize-stderr-test: "DefId\(\d+:\d+ ~ (\w+)\[[0-9a-f]{4}\]" -> "DefId($1" +//@ normalize-stderr-test: "(\w:)?[/\\].*[/\\]lib[/\\]rustlib[/\\]src[/\\]rust[/\\]library" -> "$$SRC_DIR" #![feature(stmt_expr_attributes)] #[rpl::dump_hir] //~ ERROR: abort due to debugging diff --git a/tests/ui/utils/dump_hir.stderr b/tests/ui/utils/dump_hir.stderr index f4d34f48..42bed22f 100644 --- a/tests/ui/utils/dump_hir.stderr +++ b/tests/ui/utils/dump_hir.stderr @@ -4,7 +4,7 @@ note: Item( owner_id: DefId(dump_hir::{use#1}), kind: Use( Path { - span: tests/ui/utils/dump_hir.rs:9:5: 9:19 (#0), + span: tests/ui/utils/dump_hir.rs:10:5: 10:19 (#N), res: [ Def( Struct, @@ -43,11 +43,11 @@ note: Item( }, Single, ), - span: tests/ui/utils/dump_hir.rs:9:1: 9:20 (#0), - vis_span: tests/ui/utils/dump_hir.rs:9:1: 9:1 (#0), + span: tests/ui/utils/dump_hir.rs:10:1: 10:20 (#N), + vis_span: tests/ui/utils/dump_hir.rs:10:1: 10:1 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:9:5 + --> tests/ui/utils/dump_hir.rs:10:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -62,8 +62,8 @@ note: Item( kind: Mod( Mod { spans: ModSpans { - inner_span: tests/ui/utils/dump_hir.rs:17:5: 18:2 (#0), - inject_use_span: tests/ui/utils/dump_hir.rs:17:5: 17:5 (#0), + inner_span: tests/ui/utils/dump_hir.rs:18:5: 19:2 (#N), + inject_use_span: tests/ui/utils/dump_hir.rs:18:5: 18:5 (#N), }, item_ids: [ ItemId { @@ -72,11 +72,11 @@ note: Item( ], }, ), - span: tests/ui/utils/dump_hir.rs:15:1: 18:2 (#0), - vis_span: tests/ui/utils/dump_hir.rs:15:1: 15:1 (#0), + span: tests/ui/utils/dump_hir.rs:16:1: 19:2 (#N), + vis_span: tests/ui/utils/dump_hir.rs:16:1: 16:1 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:15:1 + --> tests/ui/utils/dump_hir.rs:16:1 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -95,8 +95,8 @@ note: Item( params: [], predicates: [], has_where_clause_predicates: false, - where_clause_span: tests/ui/utils/dump_hir.rs:24:10: 24:10 (#0), - span: tests/ui/utils/dump_hir.rs:24:10: 24:10 (#0), + where_clause_span: tests/ui/utils/dump_hir.rs:25:10: 25:10 (#N), + span: tests/ui/utils/dump_hir.rs:25:10: 25:10 (#N), }, [], [ @@ -106,15 +106,15 @@ note: Item( }, ident: N#0, kind: Const, - span: tests/ui/utils/dump_hir.rs:30:5: 30:20 (#0), + span: tests/ui/utils/dump_hir.rs:31:5: 31:20 (#N), }, ], ), - span: tests/ui/utils/dump_hir.rs:24:1: 31:2 (#0), - vis_span: tests/ui/utils/dump_hir.rs:24:1: 24:1 (#0), + span: tests/ui/utils/dump_hir.rs:25:1: 32:2 (#N), + vis_span: tests/ui/utils/dump_hir.rs:25:1: 25:1 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:24:1 + --> tests/ui/utils/dump_hir.rs:25:1 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -130,18 +130,18 @@ note: TraitItem( params: [], predicates: [], has_where_clause_predicates: false, - where_clause_span: tests/ui/utils/dump_hir.rs:30:19: 30:19 (#0), - span: tests/ui/utils/dump_hir.rs:30:12: 30:12 (#0), + where_clause_span: tests/ui/utils/dump_hir.rs:31:19: 31:19 (#N), + span: tests/ui/utils/dump_hir.rs:31:12: 31:12 (#N), }, kind: Const( Ty { hir_id: HirId(DefId(dump_hir::Foo::N).1), - span: tests/ui/utils/dump_hir.rs:30:14: 30:19 (#0), + span: tests/ui/utils/dump_hir.rs:31:14: 31:19 (#N), kind: Path( Resolved( None, Path { - span: tests/ui/utils/dump_hir.rs:30:14: 30:19 (#0), + span: tests/ui/utils/dump_hir.rs:31:14: 31:19 (#N), res: PrimTy( Uint( Usize, @@ -166,13 +166,13 @@ note: TraitItem( }, None, ), - span: tests/ui/utils/dump_hir.rs:30:5: 30:20 (#0), + span: tests/ui/utils/dump_hir.rs:31:5: 31:20 (#N), defaultness: Default { has_value: false, }, }, ) - --> tests/ui/utils/dump_hir.rs:30:5 + --> tests/ui/utils/dump_hir.rs:31:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -195,13 +195,13 @@ note: Item( params: [], predicates: [], has_where_clause_predicates: false, - where_clause_span: tests/ui/utils/dump_hir.rs:37:16: 37:16 (#0), - span: tests/ui/utils/dump_hir.rs:37:5: 37:5 (#0), + where_clause_span: tests/ui/utils/dump_hir.rs:38:16: 38:16 (#N), + span: tests/ui/utils/dump_hir.rs:38:5: 38:5 (#N), }, of_trait: Some( TraitRef { path: Path { - span: tests/ui/utils/dump_hir.rs:37:6: 37:9 (#0), + span: tests/ui/utils/dump_hir.rs:38:6: 38:9 (#N), res: Def( Trait, DefId(dump_hir::Foo), @@ -224,7 +224,7 @@ note: Item( ), self_ty: Ty { hir_id: HirId(DefId(dump_hir::{impl#0}).3), - span: tests/ui/utils/dump_hir.rs:37:14: 37:16 (#0), + span: tests/ui/utils/dump_hir.rs:38:14: 38:16 (#N), kind: Tup( [], ), @@ -236,7 +236,7 @@ note: Item( }, ident: N#0, kind: Const, - span: tests/ui/utils/dump_hir.rs:43:5: 43:30 (#0), + span: tests/ui/utils/dump_hir.rs:44:5: 44:30 (#N), trait_item_def_id: Some( DefId(dump_hir::Foo::N), ), @@ -244,11 +244,11 @@ note: Item( ], }, ), - span: tests/ui/utils/dump_hir.rs:37:1: 44:2 (#0), - vis_span: tests/ui/utils/dump_hir.rs:37:1: 37:1 (#0), + span: tests/ui/utils/dump_hir.rs:38:1: 45:2 (#N), + vis_span: tests/ui/utils/dump_hir.rs:38:1: 38:1 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:37:1 + --> tests/ui/utils/dump_hir.rs:38:1 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -264,18 +264,18 @@ note: ImplItem( params: [], predicates: [], has_where_clause_predicates: false, - where_clause_span: tests/ui/utils/dump_hir.rs:43:19: 43:19 (#0), - span: tests/ui/utils/dump_hir.rs:43:12: 43:12 (#0), + where_clause_span: tests/ui/utils/dump_hir.rs:44:19: 44:19 (#N), + span: tests/ui/utils/dump_hir.rs:44:12: 44:12 (#N), }, kind: Const( Ty { hir_id: HirId(DefId(dump_hir::{impl#0}::N).1), - span: tests/ui/utils/dump_hir.rs:43:14: 43:19 (#0), + span: tests/ui/utils/dump_hir.rs:44:14: 44:19 (#N), kind: Path( Resolved( None, Path { - span: tests/ui/utils/dump_hir.rs:43:14: 43:19 (#0), + span: tests/ui/utils/dump_hir.rs:44:14: 44:19 (#N), res: PrimTy( Uint( Usize, @@ -303,11 +303,11 @@ note: ImplItem( }, ), defaultness: Final, - span: tests/ui/utils/dump_hir.rs:43:5: 43:30 (#0), - vis_span: tests/ui/utils/dump_hir.rs:43:5: 43:5 (#0), + span: tests/ui/utils/dump_hir.rs:44:5: 44:30 (#N), + vis_span: tests/ui/utils/dump_hir.rs:44:5: 44:5 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:43:5 + --> tests/ui/utils/dump_hir.rs:44:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -332,31 +332,31 @@ note: Item( decl: FnDecl { inputs: [], output: DefaultReturn( - tests/ui/utils/dump_hir.rs:50:10: 50:10 (#0), + tests/ui/utils/dump_hir.rs:51:10: 51:10 (#0), ), c_variadic: false, implicit_self: None, lifetime_elision_allowed: false, }, - span: tests/ui/utils/dump_hir.rs:50:1: 50:10 (#0), + span: tests/ui/utils/dump_hir.rs:51:1: 51:10 (#N), }, generics: Generics { params: [], predicates: [], has_where_clause_predicates: false, - where_clause_span: tests/ui/utils/dump_hir.rs:50:10: 50:10 (#0), - span: tests/ui/utils/dump_hir.rs:50:8: 50:8 (#0), + where_clause_span: tests/ui/utils/dump_hir.rs:51:10: 51:10 (#N), + span: tests/ui/utils/dump_hir.rs:51:8: 51:8 (#N), }, body: BodyId { hir_id: HirId(DefId(dump_hir::main).75), }, has_body: true, }, - span: tests/ui/utils/dump_hir.rs:50:1: 103:2 (#0), - vis_span: tests/ui/utils/dump_hir.rs:50:1: 50:1 (#0), + span: tests/ui/utils/dump_hir.rs:51:1: 104:2 (#N), + vis_span: tests/ui/utils/dump_hir.rs:51:1: 51:1 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:50:1 + --> tests/ui/utils/dump_hir.rs:51:1 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -380,7 +380,7 @@ note: Stmt( x#0, None, ), - span: tests/ui/utils/dump_hir.rs:56:9: 56:10 (#0), + span: tests/ui/utils/dump_hir.rs:57:9: 57:10 (#N), default_binding_modes: true, }, ty: None, @@ -394,12 +394,12 @@ note: Stmt( TypeRelative( Ty { hir_id: HirId(DefId(dump_hir::main).6), - span: tests/ui/utils/dump_hir.rs:56:13: 56:16 (#0), + span: tests/ui/utils/dump_hir.rs:57:13: 57:16 (#N), kind: Path( Resolved( None, Path { - span: tests/ui/utils/dump_hir.rs:56:13: 56:16 (#0), + span: tests/ui/utils/dump_hir.rs:57:13: 57:16 (#N), res: Def( Struct, DefId(alloc::sync::Arc), @@ -429,7 +429,7 @@ note: Stmt( }, ), ), - span: tests/ui/utils/dump_hir.rs:56:13: 56:21 (#0), + span: tests/ui/utils/dump_hir.rs:57:13: 57:21 (#N), }, [ Expr { @@ -444,26 +444,26 @@ note: Stmt( Usize, ), ), - span: tests/ui/utils/dump_hir.rs:56:22: 56:29 (#0), + span: tests/ui/utils/dump_hir.rs:57:22: 57:29 (#N), }, ), - span: tests/ui/utils/dump_hir.rs:56:22: 56:29 (#0), + span: tests/ui/utils/dump_hir.rs:57:22: 57:29 (#N), }, ], ), - span: tests/ui/utils/dump_hir.rs:56:13: 56:30 (#0), + span: tests/ui/utils/dump_hir.rs:57:13: 57:30 (#N), }, ), els: None, hir_id: HirId(DefId(dump_hir::main).9), - span: tests/ui/utils/dump_hir.rs:56:5: 56:31 (#0), + span: tests/ui/utils/dump_hir.rs:57:5: 57:31 (#N), source: Normal, }, ), - span: tests/ui/utils/dump_hir.rs:56:5: 56:31 (#0), + span: tests/ui/utils/dump_hir.rs:57:5: 57:31 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:56:5 + --> tests/ui/utils/dump_hir.rs:57:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -488,31 +488,31 @@ note: Item( decl: FnDecl { inputs: [], output: DefaultReturn( - tests/ui/utils/dump_hir.rs:62:13: 62:13 (#0), + tests/ui/utils/dump_hir.rs:63:13: 63:13 (#0), ), c_variadic: false, implicit_self: None, lifetime_elision_allowed: false, }, - span: tests/ui/utils/dump_hir.rs:62:5: 62:13 (#0), + span: tests/ui/utils/dump_hir.rs:63:5: 63:13 (#N), }, generics: Generics { params: [], predicates: [], has_where_clause_predicates: false, - where_clause_span: tests/ui/utils/dump_hir.rs:62:13: 62:13 (#0), - span: tests/ui/utils/dump_hir.rs:62:11: 62:11 (#0), + where_clause_span: tests/ui/utils/dump_hir.rs:63:13: 63:13 (#N), + span: tests/ui/utils/dump_hir.rs:63:11: 63:11 (#N), }, body: BodyId { hir_id: HirId(DefId(dump_hir::main::foo).4), }, has_body: true, }, - span: tests/ui/utils/dump_hir.rs:62:5: 69:6 (#0), - vis_span: tests/ui/utils/dump_hir.rs:62:5: 62:5 (#0), + span: tests/ui/utils/dump_hir.rs:63:5: 70:6 (#N), + vis_span: tests/ui/utils/dump_hir.rs:63:5: 63:5 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:62:5 + --> tests/ui/utils/dump_hir.rs:63:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -529,15 +529,15 @@ note: Expr( expr: None, hir_id: HirId(DefId(dump_hir::main::foo).3), rules: DefaultBlock, - span: tests/ui/utils/dump_hir.rs:68:9: 68:11 (#0), + span: tests/ui/utils/dump_hir.rs:69:9: 69:11 (#N), targeted_by_break: false, }, None, ), - span: tests/ui/utils/dump_hir.rs:68:9: 68:11 (#0), + span: tests/ui/utils/dump_hir.rs:69:9: 69:11 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:68:9 + --> tests/ui/utils/dump_hir.rs:69:9 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -559,13 +559,13 @@ note: Expr( node: Bool( true, ), - span: tests/ui/utils/dump_hir.rs:75:8: 75:12 (#0), + span: tests/ui/utils/dump_hir.rs:76:8: 76:12 (#N), }, ), - span: tests/ui/utils/dump_hir.rs:75:8: 75:12 (#0), + span: tests/ui/utils/dump_hir.rs:76:8: 76:12 (#N), }, ), - span: tests/ui/utils/dump_hir.rs:75:8: 75:12 (#11), + span: tests/ui/utils/dump_hir.rs:76:8: 76:12 (#N), }, Expr { hir_id: HirId(DefId(dump_hir::main).16), @@ -575,12 +575,12 @@ note: Expr( expr: None, hir_id: HirId(DefId(dump_hir::main).15), rules: DefaultBlock, - span: tests/ui/utils/dump_hir.rs:75:13: 77:6 (#0), + span: tests/ui/utils/dump_hir.rs:76:13: 78:6 (#N), targeted_by_break: false, }, None, ), - span: tests/ui/utils/dump_hir.rs:75:13: 77:6 (#0), + span: tests/ui/utils/dump_hir.rs:76:13: 78:6 (#N), }, Some( Expr { @@ -591,19 +591,19 @@ note: Expr( expr: None, hir_id: HirId(DefId(dump_hir::main).18), rules: DefaultBlock, - span: tests/ui/utils/dump_hir.rs:77:12: 78:6 (#0), + span: tests/ui/utils/dump_hir.rs:78:12: 79:6 (#N), targeted_by_break: false, }, None, ), - span: tests/ui/utils/dump_hir.rs:77:12: 78:6 (#0), + span: tests/ui/utils/dump_hir.rs:78:12: 79:6 (#N), }, ), ), - span: tests/ui/utils/dump_hir.rs:75:5: 78:6 (#0), + span: tests/ui/utils/dump_hir.rs:76:5: 79:6 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:75:5 + --> tests/ui/utils/dump_hir.rs:76:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -624,7 +624,7 @@ note: Expr( Resolved( None, Path { - span: tests/ui/utils/dump_hir.rs:84:5: 84:23 (#0), + span: tests/ui/utils/dump_hir.rs:85:5: 85:23 (#N), res: Def( Fn, DefId(std::thread::spawn), @@ -664,7 +664,7 @@ note: Expr( }, ), ), - span: tests/ui/utils/dump_hir.rs:84:5: 84:23 (#0), + span: tests/ui/utils/dump_hir.rs:85:5: 85:23 (#N), }, [ Expr { @@ -675,13 +675,13 @@ note: Expr( binder: Default, constness: NotConst, capture_clause: Value { - move_kw: tests/ui/utils/dump_hir.rs:84:24: 84:28 (#0), + move_kw: tests/ui/utils/dump_hir.rs:85:24: 85:28 (#0), }, bound_generic_params: [], fn_decl: FnDecl { inputs: [], output: DefaultReturn( - tests/ui/utils/dump_hir.rs:84:31: 84:31 (#0), + tests/ui/utils/dump_hir.rs:85:31: 85:31 (#0), ), c_variadic: false, implicit_self: None, @@ -690,21 +690,21 @@ note: Expr( body: BodyId { hir_id: HirId(DefId(dump_hir::main).26), }, - fn_decl_span: tests/ui/utils/dump_hir.rs:84:24: 84:31 (#0), + fn_decl_span: tests/ui/utils/dump_hir.rs:85:24: 85:31 (#N), fn_arg_span: Some( - tests/ui/utils/dump_hir.rs:84:29: 84:31 (#0), + tests/ui/utils/dump_hir.rs:85:29: 85:31 (#0), ), kind: Closure, }, ), - span: tests/ui/utils/dump_hir.rs:84:24: 87:6 (#0), + span: tests/ui/utils/dump_hir.rs:85:24: 88:6 (#N), }, ], ), - span: tests/ui/utils/dump_hir.rs:84:5: 87:7 (#0), + span: tests/ui/utils/dump_hir.rs:85:5: 88:7 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:84:5 + --> tests/ui/utils/dump_hir.rs:85:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -723,16 +723,16 @@ note: Item( MacroDef { body: DelimArgs { dspan: DelimSpan { - open: tests/ui/utils/dump_hir.rs:93:22: 93:23 (#0), - close: tests/ui/utils/dump_hir.rs:99:5: 99:6 (#0), + open: tests/ui/utils/dump_hir.rs:94:22: 94:23 (#0), + close: tests/ui/utils/dump_hir.rs:100:5: 100:6 (#0), }, delim: Brace, tokens: TokenStream( [ Delimited( DelimSpan { - open: tests/ui/utils/dump_hir.rs:95:9: 95:10 (#0), - close: tests/ui/utils/dump_hir.rs:95:10: 95:11 (#0), + open: tests/ui/utils/dump_hir.rs:96:9: 96:10 (#0), + close: tests/ui/utils/dump_hir.rs:96:10: 96:11 (#0), }, DelimSpacing { open: JointHidden, @@ -746,14 +746,14 @@ note: Item( Token( Token { kind: FatArrow, - span: tests/ui/utils/dump_hir.rs:95:12: 95:14 (#0), + span: tests/ui/utils/dump_hir.rs:96:12: 96:14 (#N), }, Alone, ), Delimited( DelimSpan { - open: tests/ui/utils/dump_hir.rs:95:15: 95:16 (#0), - close: tests/ui/utils/dump_hir.rs:98:9: 98:10 (#0), + open: tests/ui/utils/dump_hir.rs:96:15: 96:16 (#0), + close: tests/ui/utils/dump_hir.rs:99:9: 99:10 (#0), }, DelimSpacing { open: Alone, @@ -765,14 +765,14 @@ note: Item( Token( Token { kind: Pound, - span: tests/ui/utils/dump_hir.rs:96:13: 96:14 (#0), + span: tests/ui/utils/dump_hir.rs:97:13: 97:14 (#N), }, JointHidden, ), Delimited( DelimSpan { - open: tests/ui/utils/dump_hir.rs:96:14: 96:15 (#0), - close: tests/ui/utils/dump_hir.rs:96:28: 96:29 (#0), + open: tests/ui/utils/dump_hir.rs:97:14: 97:15 (#0), + close: tests/ui/utils/dump_hir.rs:97:28: 97:29 (#0), }, DelimSpacing { open: JointHidden, @@ -787,14 +787,14 @@ note: Item( "rpl", No, ), - span: tests/ui/utils/dump_hir.rs:96:15: 96:18 (#0), + span: tests/ui/utils/dump_hir.rs:97:15: 97:18 (#N), }, Joint, ), Token( Token { kind: PathSep, - span: tests/ui/utils/dump_hir.rs:96:18: 96:20 (#0), + span: tests/ui/utils/dump_hir.rs:97:18: 97:20 (#N), }, JointHidden, ), @@ -804,7 +804,7 @@ note: Item( "dump_hir", No, ), - span: tests/ui/utils/dump_hir.rs:96:20: 96:28 (#0), + span: tests/ui/utils/dump_hir.rs:97:20: 97:28 (#N), }, JointHidden, ), @@ -817,21 +817,21 @@ note: Item( "println", No, ), - span: tests/ui/utils/dump_hir.rs:97:13: 97:20 (#0), + span: tests/ui/utils/dump_hir.rs:98:13: 98:20 (#N), }, Joint, ), Token( Token { kind: Not, - span: tests/ui/utils/dump_hir.rs:97:20: 97:21 (#0), + span: tests/ui/utils/dump_hir.rs:98:20: 98:21 (#N), }, JointHidden, ), Delimited( DelimSpan { - open: tests/ui/utils/dump_hir.rs:97:21: 97:22 (#0), - close: tests/ui/utils/dump_hir.rs:97:28: 97:29 (#0), + open: tests/ui/utils/dump_hir.rs:98:21: 98:22 (#0), + close: tests/ui/utils/dump_hir.rs:98:28: 98:29 (#0), }, DelimSpacing { open: JointHidden, @@ -849,7 +849,7 @@ note: Item( suffix: None, }, ), - span: tests/ui/utils/dump_hir.rs:97:22: 97:28 (#0), + span: tests/ui/utils/dump_hir.rs:98:22: 98:28 (#N), }, JointHidden, ), @@ -859,7 +859,7 @@ note: Item( Token( Token { kind: Semi, - span: tests/ui/utils/dump_hir.rs:97:29: 97:30 (#0), + span: tests/ui/utils/dump_hir.rs:98:29: 98:30 (#N), }, Alone, ), @@ -869,7 +869,7 @@ note: Item( Token( Token { kind: Semi, - span: tests/ui/utils/dump_hir.rs:98:10: 98:11 (#0), + span: tests/ui/utils/dump_hir.rs:99:10: 99:11 (#N), }, Alone, ), @@ -880,11 +880,11 @@ note: Item( }, Bang, ), - span: tests/ui/utils/dump_hir.rs:93:5: 99:6 (#0), - vis_span: tests/ui/utils/dump_hir.rs:93:5: 93:5 (#0), + span: tests/ui/utils/dump_hir.rs:94:5: 100:6 (#N), + vis_span: tests/ui/utils/dump_hir.rs:94:5: 94:5 (#N), }, ) - --> tests/ui/utils/dump_hir.rs:93:5 + --> tests/ui/utils/dump_hir.rs:94:5 | LL | #[rpl::dump_hir] | ---------------- HIR dumped because of this attribute @@ -893,7 +893,7 @@ LL | macro_rules! mac { | ^^^^^^^^^^^^^^^^ error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:5:1 + --> tests/ui/utils/dump_hir.rs:6:1 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -902,7 +902,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:11:1 + --> tests/ui/utils/dump_hir.rs:12:1 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -911,7 +911,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:20:1 + --> tests/ui/utils/dump_hir.rs:21:1 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -920,7 +920,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:26:5 + --> tests/ui/utils/dump_hir.rs:27:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -929,7 +929,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:33:1 + --> tests/ui/utils/dump_hir.rs:34:1 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -938,7 +938,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:39:5 + --> tests/ui/utils/dump_hir.rs:40:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -947,7 +947,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:46:1 + --> tests/ui/utils/dump_hir.rs:47:1 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -956,7 +956,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:52:5 + --> tests/ui/utils/dump_hir.rs:53:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -965,7 +965,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:58:5 + --> tests/ui/utils/dump_hir.rs:59:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -974,7 +974,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:64:9 + --> tests/ui/utils/dump_hir.rs:65:9 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -983,7 +983,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:71:5 + --> tests/ui/utils/dump_hir.rs:72:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -992,7 +992,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:80:5 + --> tests/ui/utils/dump_hir.rs:81:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute @@ -1001,7 +1001,7 @@ LL | #[rpl::dump_hir] = note: this error is to remind you removing these attributes error: abort due to debugging - --> tests/ui/utils/dump_hir.rs:89:5 + --> tests/ui/utils/dump_hir.rs:90:5 | LL | #[rpl::dump_hir] | ^^^^^^^^^^^^^^^^ help: remove this attribute diff --git a/tests/ui/utils/dump_mir.fixed b/tests/ui/utils/dump_mir.fixed index 52b5c309..80ad5d27 100644 --- a/tests/ui/utils/dump_mir.fixed +++ b/tests/ui/utils/dump_mir.fixed @@ -1,6 +1,6 @@ //@ compile-flags: -Z inline-mir=false -//@ normalize-stderr-test: "see `.*/mir_dump/(.*)` for dumped" -> "see `./mir_dump/$1` for dumped" -//@ normalize-stderr-test: "/.*/lib/rustlib/src/rust/library" -> "$$SRC_DIR" +// +//@ normalize-stderr-test: "(\w:)?[/\\].*[/\\]lib[/\\]rustlib[/\\]src[/\\]rust[/\\]library" -> "$$SRC_DIR" //~ ERROR: abort due to debugging //~^ NOTE: `#[rpl::dump_hir]`, `#[rpl::print_hir]` and `#[rpl::dump_mir]` are only used for debugging diff --git a/tests/ui/utils/dump_mir.rs b/tests/ui/utils/dump_mir.rs index 4c1381db..54e2f710 100644 --- a/tests/ui/utils/dump_mir.rs +++ b/tests/ui/utils/dump_mir.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Z inline-mir=false -//@ normalize-stderr-test: "see `.*/mir_dump/(.*)` for dumped" -> "see `./mir_dump/$1` for dumped" -//@ normalize-stderr-test: "/.*/lib/rustlib/src/rust/library" -> "$$SRC_DIR" +// +//@ normalize-stderr-test: "(\w:)?[/\\].*[/\\]lib[/\\]rustlib[/\\]src[/\\]rust[/\\]library" -> "$$SRC_DIR" #[rpl::dump_mir(dump_cfg, dump_ddg)] //~ ERROR: abort due to debugging //~^ NOTE: `#[rpl::dump_hir]`, `#[rpl::print_hir]` and `#[rpl::dump_mir]` are only used for debugging diff --git a/tests/ui/utils/dump_mir.stderr b/tests/ui/utils/dump_mir.stderr index 80ce2fc1..aadb3cf0 100644 --- a/tests/ui/utils/dump_mir.stderr +++ b/tests/ui/utils/dump_mir.stderr @@ -9,9 +9,9 @@ LL | / fn test() { LL | | } | |_^ | - = note: see `./mir_dump/dump_mir.test.-------.dump_mir..mir` for dumped MIR - = note: see `./mir_dump/dump_mir.test.-------.dump_mir..mir.cfg.dot` for dumped control flow graph - = note: see `./mir_dump/dump_mir.test.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph + = note: see `$DIR/mir_dump/dump_mir.test.-------.dump_mir..mir` for dumped MIR + = note: see `$DIR/mir_dump/dump_mir.test.-------.dump_mir..mir.cfg.dot` for dumped control flow graph + = note: see `$DIR/mir_dump/dump_mir.test.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph note: locals and scopes in this MIR --> tests/ui/utils/dump_mir.rs:9:1 | @@ -208,9 +208,9 @@ LL | | Ok(result) LL | | } | |_^ | - = note: see `./mir_dump/dump_mir.critical.-------.dump_mir..mir` for dumped MIR - = note: see `./mir_dump/dump_mir.critical.-------.dump_mir..mir.cfg.dot` for dumped control flow graph - = note: see `./mir_dump/dump_mir.critical.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph + = note: see `$DIR/mir_dump/dump_mir.critical.-------.dump_mir..mir` for dumped MIR + = note: see `$DIR/mir_dump/dump_mir.critical.-------.dump_mir..mir.cfg.dot` for dumped control flow graph + = note: see `$DIR/mir_dump/dump_mir.critical.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph note: locals and scopes in this MIR --> tests/ui/utils/dump_mir.rs:42:1 | @@ -318,9 +318,9 @@ LL | #[rpl::dump_mir(dump_cfg, dump_ddg)] LL | let _ = std::alloc::alloc; | ^^^^^^^^^^^^^^^^^ | - = note: see `./mir_dump/alloc.alloc-alloc.-------.dump_mir..mir` for dumped MIR - = note: see `./mir_dump/alloc.alloc-alloc.-------.dump_mir..mir.cfg.dot` for dumped control flow graph - = note: see `./mir_dump/alloc.alloc-alloc.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph + = note: see `$DIR/mir_dump/alloc.alloc-alloc.-------.dump_mir..mir` for dumped MIR + = note: see `$DIR/mir_dump/alloc.alloc-alloc.-------.dump_mir..mir.cfg.dot` for dumped control flow graph + = note: see `$DIR/mir_dump/alloc.alloc-alloc.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph note: locals and scopes in this MIR --> $SRC_DIR/alloc/src/alloc.rs:90:1 | @@ -628,9 +628,9 @@ LL | #[rpl::dump_mir(dump_cfg, dump_ddg)] LL | let _ = |x: i32| x + 1; | ^^^^^^^^^^^^^^ | - = note: see `./mir_dump/dump_mir.main-{closure#0}.-------.dump_mir..mir` for dumped MIR - = note: see `./mir_dump/dump_mir.main-{closure#0}.-------.dump_mir..mir.cfg.dot` for dumped control flow graph - = note: see `./mir_dump/dump_mir.main-{closure#0}.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph + = note: see `$DIR/mir_dump/dump_mir.main-{closure#0}.-------.dump_mir..mir` for dumped MIR + = note: see `$DIR/mir_dump/dump_mir.main-{closure#0}.-------.dump_mir..mir.cfg.dot` for dumped control flow graph + = note: see `$DIR/mir_dump/dump_mir.main-{closure#0}.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph note: locals and scopes in this MIR --> tests/ui/utils/dump_mir.rs:86:13 | @@ -661,9 +661,9 @@ LL | #[rpl::dump_mir(dump_cfg, dump_ddg)] LL | let _ = as std::iter::Iterator>::next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see `./mir_dump/core.result-{impl#20}-next.-------.dump_mir..mir` for dumped MIR - = note: see `./mir_dump/core.result-{impl#20}-next.-------.dump_mir..mir.cfg.dot` for dumped control flow graph - = note: see `./mir_dump/core.result-{impl#20}-next.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph + = note: see `$DIR/mir_dump/core.result-{impl#20}-next.-------.dump_mir..mir` for dumped MIR + = note: see `$DIR/mir_dump/core.result-{impl#20}-next.-------.dump_mir..mir.cfg.dot` for dumped control flow graph + = note: see `$DIR/mir_dump/core.result-{impl#20}-next.-------.dump_mir..mir.ddg.dot` for dumped data dependency graph note: locals and scopes in this MIR --> $SRC_DIR/core/src/result.rs:1908:5 |