2021-03-05 22:01:01 +00:00
//! Tests for future-incompat-report messages
2021-07-16 12:45:29 +00:00
//!
//! Note that these tests use the -Zfuture-incompat-test for rustc.
//! This causes rustc to treat *every* lint as future-incompatible.
//! This is done because future-incompatible lints are inherently
//! ephemeral, but we don't want to continually update these tests.
//! So we pick some random lint that will likely always be the same
//! over time.
2021-03-05 22:01:01 +00:00
2021-05-04 04:24:08 +00:00
use super ::config ::write_config_toml ;
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
use cargo_test_support ::registry ::Package ;
2021-09-09 06:10:33 +00:00
use cargo_test_support ::{ basic_manifest , project , Project } ;
2021-06-20 16:32:43 +00:00
2021-07-16 12:45:29 +00:00
// An arbitrary lint (unused_variables) that triggers a lint.
// We use a special flag to force it to generate a report.
const FUTURE_EXAMPLE : & 'static str = " fn main() { let x = 1; } " ;
2021-06-20 16:32:43 +00:00
// Some text that will be displayed when the lint fires.
2021-07-16 12:45:29 +00:00
const FUTURE_OUTPUT : & 'static str = " [..]unused_variables[..] " ;
2021-06-20 16:32:43 +00:00
fn simple_project ( ) -> Project {
project ( )
. file ( " Cargo.toml " , & basic_manifest ( " foo " , " 0.0.0 " ) )
. file ( " src/main.rs " , FUTURE_EXAMPLE )
. build ( )
}
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
2021-12-04 20:17:53 +00:00
fn output_on_stable ( ) {
2021-06-20 16:32:43 +00:00
let p = simple_project ( ) ;
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
2021-07-16 12:45:29 +00:00
p . cargo ( " check " )
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr_contains ( FUTURE_OUTPUT )
2021-12-04 20:17:53 +00:00
. with_stderr_contains ( " [..]cargo report[..] " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
}
2021-12-04 20:17:53 +00:00
// This feature is stable, and should not be gated
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
#[ cargo_test ]
2021-12-04 20:17:53 +00:00
fn no_gate_future_incompat_report ( ) {
2021-06-20 16:32:43 +00:00
let p = simple_project ( ) ;
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
2023-02-15 23:36:54 +00:00
p . cargo ( " check --future-incompat-report " )
2021-12-04 20:17:53 +00:00
. with_status ( 0 )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
2021-04-30 20:01:21 +00:00
p . cargo ( " report future-incompatibilities --id foo " )
2021-12-04 20:17:53 +00:00
. with_stderr_contains ( " error: no reports are currently available " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. with_status ( 101 )
. run ( ) ;
}
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
2021-03-14 19:45:54 +00:00
fn test_zero_future_incompat ( ) {
let p = project ( )
. file ( " Cargo.toml " , & basic_manifest ( " foo " , " 0.0.0 " ) )
. file ( " src/main.rs " , " fn main() {} " )
. build ( ) ;
2021-06-20 16:32:43 +00:00
// No note if --future-incompat-report is not specified.
2023-02-15 23:36:54 +00:00
p . cargo ( " check " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr (
" \
2023-02-15 23:36:54 +00:00
[ CHECKING ] foo v0 . 0.0 [ .. ]
2021-06-20 16:32:43 +00:00
[ FINISHED ] [ .. ]
" ,
)
. run ( ) ;
2023-02-15 23:36:54 +00:00
p . cargo ( " check --future-incompat-report " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr (
" \
[ FINISHED ] [ .. ]
note : 0 dependencies had future - incompatible warnings
" ,
)
2021-03-14 19:45:54 +00:00
. run ( ) ;
}
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
fn test_single_crate ( ) {
2021-06-20 16:32:43 +00:00
let p = simple_project ( ) ;
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
2021-03-14 19:50:01 +00:00
for command in & [ " build " , " check " , " rustc " , " test " ] {
2021-05-04 04:24:08 +00:00
let check_has_future_compat = | | {
2021-12-04 20:17:53 +00:00
p . cargo ( command )
2021-05-04 04:24:08 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
. with_stderr_contains ( FUTURE_OUTPUT )
. with_stderr_contains ( " warning: the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 [..] " )
. with_stderr_does_not_contain ( " [..]incompatibility[..] " )
. run ( ) ;
} ;
// Check that we show a message with no [future-incompat-report] config section
write_config_toml ( " " ) ;
check_has_future_compat ( ) ;
2022-05-07 17:07:28 +00:00
// Check that we show a message with `frequency = "always"`
2021-05-04 04:24:08 +00:00
write_config_toml (
" \
[ future - incompat - report ]
frequency = ' always '
" ,
) ;
check_has_future_compat ( ) ;
// Check that we do not show a message with `frequency = "never"`
write_config_toml (
" \
[ future - incompat - report ]
frequency = ' never '
" ,
) ;
p . cargo ( command )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr_contains ( FUTURE_OUTPUT )
2021-05-04 04:24:08 +00:00
. with_stderr_does_not_contain ( " [..]rejected[..] " )
2021-03-04 19:04:36 +00:00
. with_stderr_does_not_contain ( " [..]incompatibility[..] " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
2021-05-04 04:24:08 +00:00
// Check that passing `--future-incompat-report` overrides `frequency = 'never'`
2021-12-04 20:17:53 +00:00
p . cargo ( command ) . arg ( " --future-incompat-report " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr_contains ( FUTURE_OUTPUT )
. with_stderr_contains ( " warning: the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 [..] " )
2022-04-19 21:00:15 +00:00
. with_stderr_contains ( " - foo@0.0.0[..] " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
}
}
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
fn test_multi_crate ( ) {
Package ::new ( " first-dep " , " 0.0.1 " )
2021-06-20 16:32:43 +00:00
. file ( " src/lib.rs " , FUTURE_EXAMPLE )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. publish ( ) ;
Package ::new ( " second-dep " , " 0.0.2 " )
2021-06-20 16:32:43 +00:00
. file ( " src/lib.rs " , FUTURE_EXAMPLE )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. publish ( ) ;
let p = project ( )
. file (
" Cargo.toml " ,
r #"
[ package ]
name = " foo "
version = " 0.0.0 "
[ dependencies ]
first - dep = " * "
second - dep = " * "
" #,
)
2023-08-14 12:37:43 +00:00
. file ( " src/lib.rs " , " " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. build ( ) ;
2021-03-14 19:50:01 +00:00
for command in & [ " build " , " check " , " rustc " , " test " ] {
2021-12-04 20:17:53 +00:00
p . cargo ( command )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr_does_not_contain ( FUTURE_OUTPUT )
. with_stderr_contains ( " warning: the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2 " )
2021-08-27 18:16:17 +00:00
// Check that we don't have the 'triggers' message shown at the bottom of this loop,
// and that we don't explain how to show a per-package report
2021-03-04 19:04:36 +00:00
. with_stderr_does_not_contain ( " [..]triggers[..] " )
2021-10-05 00:20:23 +00:00
. with_stderr_does_not_contain ( " [..]--package[..] " )
. with_stderr_does_not_contain ( " [..]-p[..] " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( command ) . arg ( " --future-incompat-report " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-06-20 16:32:43 +00:00
. with_stderr_contains ( " warning: the following packages contain code that will be rejected by a future version of Rust: first-dep v0.0.1, second-dep v0.0.2 " )
2022-04-19 21:00:15 +00:00
. with_stderr_contains ( " - first-dep@0.0.1 " )
. with_stderr_contains ( " - second-dep@0.0.2 " )
2021-08-27 18:16:17 +00:00
. run ( ) ;
2022-04-19 21:00:15 +00:00
p . cargo ( " report future-incompatibilities " ) . arg ( " --package " ) . arg ( " first-dep@0.0.1 " )
2021-08-27 18:16:17 +00:00
. with_stdout_contains ( " The package `first-dep v0.0.1` currently triggers the following future incompatibility lints: " )
. with_stdout_contains ( FUTURE_OUTPUT )
2021-10-18 17:01:07 +00:00
. with_stdout_does_not_contain ( " [..]second-dep-0.0.2/src[..] " )
2021-08-27 18:16:17 +00:00
. run ( ) ;
2022-04-19 21:00:15 +00:00
p . cargo ( " report future-incompatibilities " ) . arg ( " --package " ) . arg ( " second-dep@0.0.2 " )
2021-08-27 18:16:17 +00:00
. with_stdout_contains ( " The package `second-dep v0.0.2` currently triggers the following future incompatibility lints: " )
. with_stdout_contains ( FUTURE_OUTPUT )
2021-10-18 17:01:07 +00:00
. with_stdout_does_not_contain ( " [..]first-dep-0.0.1/src[..] " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
}
// Test that passing the correct id via '--id' doesn't generate a warning message
let output = p
2023-02-15 23:36:54 +00:00
. cargo ( " check " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. exec_with_output ( )
. unwrap ( ) ;
// Extract the 'id' from the stdout. We are looking
2021-04-30 20:01:21 +00:00
// for the id in a line of the form "run `cargo report future-incompatibilities --id yZ7S`"
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
// which is generated by Cargo to tell the user what command to run
// This is just to test that passing the id suppresses the warning mesasge. Any users needing
// access to the report from a shell script should use the `--future-incompat-report` flag
let stderr = std ::str ::from_utf8 ( & output . stderr ) . unwrap ( ) ;
// Find '--id <ID>' in the output
2021-04-02 10:30:36 +00:00
let mut iter = stderr . split ( ' ' ) ;
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
iter . find ( | w | * w = = " --id " ) . unwrap ( ) ;
let id = iter
. next ( )
. unwrap_or_else ( | | panic! ( " Unexpected output: \n {} " , stderr ) ) ;
// Strip off the trailing '`' included in the output
let id : String = id . chars ( ) . take_while ( | c | * c ! = '`' ) . collect ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( & format! ( " report future-incompatibilities --id {} " , id ) )
2021-06-20 16:32:43 +00:00
. with_stdout_contains ( " The package `first-dep v0.0.1` currently triggers the following future incompatibility lints: " )
. with_stdout_contains ( " The package `second-dep v0.0.2` currently triggers the following future incompatibility lints: " )
. run ( ) ;
// Test without --id, and also the full output of the report.
let output = p
2021-12-04 20:17:53 +00:00
. cargo ( " report future-incompat " )
2021-06-20 16:32:43 +00:00
. exec_with_output ( )
. unwrap ( ) ;
let output = std ::str ::from_utf8 ( & output . stdout ) . unwrap ( ) ;
2021-06-20 22:58:55 +00:00
assert! ( output . starts_with ( " The following warnings were discovered " ) ) ;
let mut lines = output
. lines ( )
// Skip the beginning of the per-package information.
. skip_while ( | line | ! line . starts_with ( " The package " ) ) ;
2021-06-20 16:32:43 +00:00
for expected in & [ " first-dep v0.0.1 " , " second-dep v0.0.2 " ] {
assert_eq! (
& format! (
" The package `{}` currently triggers the following future incompatibility lints: " ,
expected
) ,
2021-08-27 18:16:17 +00:00
lines . next ( ) . unwrap ( ) ,
" Bad output: \n {} " ,
output
2021-06-20 16:32:43 +00:00
) ;
let mut count = 0 ;
while let Some ( line ) = lines . next ( ) {
if line . is_empty ( ) {
break ;
}
count + = 1 ;
}
assert! ( count > 0 ) ;
}
assert_eq! ( lines . next ( ) , None ) ;
}
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
2021-06-20 16:32:43 +00:00
fn color ( ) {
let p = simple_project ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " check " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2022-07-16 02:32:23 +00:00
. masquerade_as_nightly_cargo ( & [ " future-incompat-test " ] )
2021-06-20 16:32:43 +00:00
. run ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " report future-incompatibilities " )
2021-06-20 16:32:43 +00:00
. with_stdout_does_not_contain ( " [..] \x1b [[..] " )
. run ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " report future-incompatibilities " )
2021-06-20 16:32:43 +00:00
. env ( " CARGO_TERM_COLOR " , " always " )
. with_stdout_contains ( " [..] \x1b [[..] " )
. run ( ) ;
}
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
2021-06-20 16:32:43 +00:00
fn bad_ids ( ) {
let p = simple_project ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " report future-incompatibilities --id 1 " )
2021-06-20 16:32:43 +00:00
. with_status ( 101 )
. with_stderr ( " error: no reports are currently available " )
. run ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " check " )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2022-07-16 02:32:23 +00:00
. masquerade_as_nightly_cargo ( & [ " future-incompat-test " ] )
2021-06-20 16:32:43 +00:00
. run ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " report future-incompatibilities --id foo " )
2021-06-20 16:32:43 +00:00
. with_status ( 1 )
. with_stderr ( " error: Invalid value: could not parse `foo` as a number " )
. run ( ) ;
2021-12-04 20:17:53 +00:00
p . cargo ( " report future-incompatibilities --id 7 " )
2021-06-20 16:32:43 +00:00
. with_status ( 101 )
. with_stderr (
" \
error : could not find report with ID 7
Available IDs are : 1
" ,
)
Implement future incompatibility report support
cc rust-lang/rust#71249
This implements the Cargo side of 'Cargo report future-incompat'
Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).
This PR contains:
* Gating of all functionality behind `-Z report-future-incompat`.
Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
`-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
it a user-readable format.
* Emitting a warning at the end of a build if any crates had
future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
each affected crate.
* Tests for all of the above.
At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?
This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2020-10-29 21:48:09 +00:00
. run ( ) ;
}
2021-06-20 22:58:55 +00:00
2021-09-09 06:10:33 +00:00
#[ cargo_test(
nightly ,
reason = " -Zfuture-incompat-test requires nightly (permanently) "
) ]
2021-06-20 22:58:55 +00:00
fn suggestions_for_updates ( ) {
Package ::new ( " with_updates " , " 1.0.0 " )
. file ( " src/lib.rs " , FUTURE_EXAMPLE )
. publish ( ) ;
Package ::new ( " big_update " , " 1.0.0 " )
. file ( " src/lib.rs " , FUTURE_EXAMPLE )
. publish ( ) ;
Package ::new ( " without_updates " , " 1.0.0 " )
. file ( " src/lib.rs " , FUTURE_EXAMPLE )
. publish ( ) ;
let p = project ( )
. file (
" Cargo.toml " ,
r #"
[ package ]
name = " foo "
version = " 0.1.0 "
[ dependencies ]
with_updates = " 1 "
big_update = " 1 "
without_updates = " 1 "
" #,
)
. file ( " src/lib.rs " , " " )
. build ( ) ;
p . cargo ( " generate-lockfile " ) . run ( ) ;
Package ::new ( " with_updates " , " 1.0.1 " )
. file ( " src/lib.rs " , " " )
. publish ( ) ;
Package ::new ( " with_updates " , " 1.0.2 " )
. file ( " src/lib.rs " , " " )
. publish ( ) ;
2021-08-27 18:16:17 +00:00
Package ::new ( " with_updates " , " 3.0.1 " )
. file ( " src/lib.rs " , " " )
. publish ( ) ;
2021-06-20 22:58:55 +00:00
Package ::new ( " big_update " , " 2.0.0 " )
. file ( " src/lib.rs " , " " )
. publish ( ) ;
2021-06-21 16:55:29 +00:00
// This is a hack to force cargo to update the index. Cargo can't do this
// automatically because doing a network update on every build would be a
// bad idea. Under normal circumstances, we'll hope the user has done
// something else along the way to trigger an update (building some other
// project or something). This could use some more consideration of how to
// handle this better (maybe only trigger an update if it hasn't updated
// in a long while?).
2023-08-23 14:13:34 +00:00
p . cargo ( " update without_updates " ) . run ( ) ;
2021-06-21 16:55:29 +00:00
2021-10-12 21:48:56 +00:00
let update_message = " \
- Some affected dependencies have newer versions available .
You may want to consider updating them to a newer version to see if the issue has been fixed .
big_update v1 . 0.0 has the following newer versions available : 2. 0.0
with_updates v1 . 0.0 has the following newer versions available : 1. 0.1 , 1. 0.2 , 3. 0.1
" ;
2021-12-04 20:17:53 +00:00
p . cargo ( " check --future-incompat-report " )
2022-07-16 02:32:23 +00:00
. masquerade_as_nightly_cargo ( & [ " future-incompat-test " ] )
2021-07-16 12:45:29 +00:00
. env ( " RUSTFLAGS " , " -Zfuture-incompat-test " )
2021-10-12 21:48:56 +00:00
. with_stderr_contains ( update_message )
2021-06-20 22:58:55 +00:00
. run ( ) ;
2021-10-12 21:48:56 +00:00
p . cargo ( " report future-incompatibilities " )
. with_stdout_contains ( update_message )
. run ( )
2021-06-20 22:58:55 +00:00
}