Skip to content

Commit

Permalink
Fix test problems discovered by the revision check
Browse files Browse the repository at this point in the history
Most of these changes either add revision names that were apparently missing,
or explicitly mark a revision name as currently unused.
  • Loading branch information
Zalathar committed May 9, 2024
1 parent 4bbd637 commit 80b67c8
Show file tree
Hide file tree
Showing 26 changed files with 87 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: fatal error triggered by #[rustc_error]
--> $DIR/bound-lifetime-constrained.rs:48:1
|
LL | fn main() { }
| ^^^^^^^^^

error: aborting due to 1 previous error

2 changes: 1 addition & 1 deletion tests/ui/associated-types/bound-lifetime-constrained.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ revisions: func object clause
//@ revisions: func object clause ok

#![allow(dead_code)]
#![feature(rustc_attrs)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-activation-sharing-interference.rs:28:15
--> $DIR/two-phase-activation-sharing-interference.rs:29:15
|
LL | let y = &mut x;
| ------ mutable borrow occurs here
Expand All @@ -10,7 +10,7 @@ LL | *y += 1;
| ------- mutable borrow later used here

error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-activation-sharing-interference.rs:36:13
--> $DIR/two-phase-activation-sharing-interference.rs:37:13
|
LL | let y = &mut x;
| ------ mutable borrow occurs here
Expand All @@ -32,7 +32,7 @@ LL | *y += 1;
| ------- mutable borrow later used here

error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-activation-sharing-interference.rs:58:14
--> $DIR/two-phase-activation-sharing-interference.rs:56:14
|
LL | let y = &mut x;
| ------ mutable borrow occurs here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ revisions: nll_target

// The following revisions are disabled due to missing support from two-phase beyond autorefs
//@ unused-revision-names: nll_beyond
//@[nll_beyond] compile-flags: -Z two-phase-beyond-autoref

// This is an important corner case pointed out by Niko: one is
Expand Down Expand Up @@ -36,8 +37,7 @@ fn not_ok() {
let z = &x;
//[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
*y += 1;
//[lxl_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
//[nll_beyond]~^^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
//[nll_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
read(z);
}

Expand All @@ -48,8 +48,6 @@ fn should_be_ok_with_nll() {
//[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
read(z);
*y += 1;
//[lxl_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
// (okay with (generalized) nll today)
}

fn should_also_eventually_be_ok_with_nll() {
Expand All @@ -58,8 +56,6 @@ fn should_also_eventually_be_ok_with_nll() {
let _z = &x;
//[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
*y += 1;
//[lxl_beyond]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
// (okay with (generalized) nll today)
}

fn main() { }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0503]: cannot use `i` because it was mutably borrowed
--> $DIR/two-phase-allow-access-during-reservation.rs:26:19
--> $DIR/two-phase-allow-access-during-reservation.rs:27:19
|
LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
| ------ `i` is borrowed here
Expand All @@ -11,7 +11,7 @@ LL | /*3*/ *p += 1; // (mutable borrow of `i` starts here, since `p`
| ------- borrow later used here

error[E0503]: cannot use `i` because it was mutably borrowed
--> $DIR/two-phase-allow-access-during-reservation.rs:31:19
--> $DIR/two-phase-allow-access-during-reservation.rs:32:19
|
LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
| ------ `i` is borrowed here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ revisions: nll_target

// The following revisions are disabled due to missing support for two_phase_beyond_autoref
//@ unused-revision-names: nll_beyond
//@[nll_beyond] compile-flags: -Z two_phase_beyond_autoref

// This is the second counter-example from Niko's blog post
Expand Down
22 changes: 11 additions & 11 deletions tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0499]: cannot borrow `*f` as mutable more than once at a time
--> $DIR/two-phase-nonrecv-autoref.rs:50:11
--> $DIR/two-phase-nonrecv-autoref.rs:51:11
|
LL | f(f(10));
| - ^ second mutable borrow occurs here
Expand All @@ -8,7 +8,7 @@ LL | f(f(10));
| first borrow later used by call

error[E0382]: use of moved value: `f`
--> $DIR/two-phase-nonrecv-autoref.rs:57:11
--> $DIR/two-phase-nonrecv-autoref.rs:58:11
|
LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
| - move occurs because `f` has type `Box<F>`, which does not implement the `Copy` trait
Expand All @@ -18,7 +18,7 @@ LL | f(f(10));
| value moved here

error[E0499]: cannot borrow `*f` as mutable more than once at a time
--> $DIR/two-phase-nonrecv-autoref.rs:62:11
--> $DIR/two-phase-nonrecv-autoref.rs:63:11
|
LL | f(f(10));
| - ^ second mutable borrow occurs here
Expand All @@ -27,7 +27,7 @@ LL | f(f(10));
| first borrow later used by call

error[E0382]: use of moved value: `f`
--> $DIR/two-phase-nonrecv-autoref.rs:69:11
--> $DIR/two-phase-nonrecv-autoref.rs:70:11
|
LL | fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
| - move occurs because `f` has type `Box<dyn FnOnce(i32) -> i32>`, which does not implement the `Copy` trait
Expand All @@ -37,7 +37,7 @@ LL | f(f(10));
| value moved here

error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-nonrecv-autoref.rs:107:27
--> $DIR/two-phase-nonrecv-autoref.rs:108:27
|
LL | double_access(&mut a, &a);
| ------------- ------ ^^ immutable borrow occurs here
Expand All @@ -46,7 +46,7 @@ LL | double_access(&mut a, &a);
| mutable borrow later used by call

error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-nonrecv-autoref.rs:132:7
--> $DIR/two-phase-nonrecv-autoref.rs:133:7
|
LL | i[i[3]] = 4;
| --^----
Expand All @@ -56,18 +56,18 @@ LL | i[i[3]] = 4;
| mutable borrow occurs here
|
help: try adding a local storing this...
--> $DIR/two-phase-nonrecv-autoref.rs:132:8
--> $DIR/two-phase-nonrecv-autoref.rs:133:8
|
LL | i[i[3]] = 4;
| ^^^
help: ...and then using that local here
--> $DIR/two-phase-nonrecv-autoref.rs:132:6
--> $DIR/two-phase-nonrecv-autoref.rs:133:6
|
LL | i[i[3]] = 4;
| ^^^^^^

error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
--> $DIR/two-phase-nonrecv-autoref.rs:138:7
--> $DIR/two-phase-nonrecv-autoref.rs:139:7
|
LL | i[i[3]] = i[4];
| --^----
Expand All @@ -77,12 +77,12 @@ LL | i[i[3]] = i[4];
| mutable borrow occurs here
|
help: try adding a local storing this...
--> $DIR/two-phase-nonrecv-autoref.rs:138:8
--> $DIR/two-phase-nonrecv-autoref.rs:139:8
|
LL | i[i[3]] = i[4];
| ^^^
help: ...and then using that local here
--> $DIR/two-phase-nonrecv-autoref.rs:138:6
--> $DIR/two-phase-nonrecv-autoref.rs:139:6
|
LL | i[i[3]] = i[4];
| ^^^^^^
Expand Down
1 change: 1 addition & 0 deletions tests/ui/borrowck/two-phase-nonrecv-autoref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ revisions: base

//@ unused-revision-names: g2p
//@[g2p]compile-flags: -Z two-phase-beyond-autoref
// the above revision is disabled until two-phase-beyond-autoref support is better

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-reservation-sharing-interference.rs:32:17
--> $DIR/two-phase-reservation-sharing-interference.rs:33:17
|
LL | let shared = &vec;
| ---- immutable borrow occurs here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ revisions: nll_target

// The nll_beyond revision is disabled due to missing support from two-phase beyond autorefs
//@ unused-revision-names: nll_beyond
//@[nll_beyond]compile-flags: -Z two-phase-beyond-autoref
//@[nll_beyond]should-fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LL | #[cfg(feature = "unk")]
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `feature`
--> $DIR/exhaustive-names-values.rs:25:7
--> $DIR/exhaustive-names-values.rs:24:7
|
LL | #[cfg(feature = "std")]
| ^^^^^^^^^^^^^^^
Expand Down
10 changes: 4 additions & 6 deletions tests/ui/check-cfg/exhaustive-names-values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ pub fn f() {}
pub fn f() {}

#[cfg(feature = "unk")]
//[empty_names_values]~^ WARNING unexpected `cfg` condition name
//[empty_cfg]~^^ WARNING unexpected `cfg` condition name
//[feature]~^^^ WARNING unexpected `cfg` condition value
//[full]~^^^^ WARNING unexpected `cfg` condition value
//[empty_cfg]~^ WARNING unexpected `cfg` condition name
//[feature]~^^ WARNING unexpected `cfg` condition value
//[full]~^^^ WARNING unexpected `cfg` condition value
pub fn feat() {}

#[cfg(feature = "std")]
//[empty_names_values]~^ WARNING unexpected `cfg` condition name
//[empty_cfg]~^^ WARNING unexpected `cfg` condition name
//[empty_cfg]~^ WARNING unexpected `cfg` condition name
pub fn feat() {}

#[cfg(windows)]
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/check-cfg/values-none.concat_1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
warning: unexpected `cfg` condition value: `bar`
--> $DIR/values-none.rs:16:7
|
LL | #[cfg(foo = "bar")]
| ^^^^^^^^^^^
|
= note: expected values for `foo` are: (none), `too`
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

warning: 1 warning emitted

13 changes: 13 additions & 0 deletions tests/ui/check-cfg/values-none.concat_2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
warning: unexpected `cfg` condition value: `bar`
--> $DIR/values-none.rs:16:7
|
LL | #[cfg(foo = "bar")]
| ^^^^^^^^^^^
|
= note: expected values for `foo` are: (none), `too`
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

warning: 1 warning emitted

2 changes: 1 addition & 1 deletion tests/ui/check-cfg/values-none.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ check-pass
//
//@ no-auto-check-cfg
//@ revisions: explicit implicit
//@ revisions: explicit implicit simple concat_1 concat_2
//@ [explicit]compile-flags: --check-cfg=cfg(foo,values(none()))
//@ [implicit]compile-flags: --check-cfg=cfg(foo)
//@ [simple] compile-flags: --check-cfg=cfg(foo,values(none(),"too"))
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/check-cfg/values-none.simple.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
warning: unexpected `cfg` condition value: `bar`
--> $DIR/values-none.rs:16:7
|
LL | #[cfg(foo = "bar")]
| ^^^^^^^^^^^
|
= note: expected values for `foo` are: (none), `too`
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

warning: 1 warning emitted

2 changes: 1 addition & 1 deletion tests/ui/dyn-star/param-env-region-infer.current.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0282]: type annotations needed
--> $DIR/param-env-region-infer.rs:19:10
--> $DIR/param-env-region-infer.rs:20:10
|
LL | t as _
| ^ cannot infer type
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/dyn-star/param-env-region-infer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//@ revisions: current
//@ incremental

// FIXME(-Znext-solver): THis currently results in unstable query results:
// FIXME(-Znext-solver): This currently results in unstable query results:
// `normalizes-to(opaque, opaque)` changes from `Maybe(Ambiguous)` to `Maybe(Overflow)`
// once the hidden type of the opaque is already defined to be itself.
//@ unused-revision-names: next

// checks that we don't ICE if there are region inference variables in the environment
// when computing `PointerLike` builtin candidates.
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/instrument-coverage/coverage-options.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ needs-profiler-support
//@ revisions: block branch bad
//@ revisions: block branch mcdc bad
//@ compile-flags -Cinstrument-coverage

//@ [block] check-pass
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/meta/meta-expected-error-wrong-rev.a.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/meta-expected-error-wrong-rev.rs:13:18
--> $DIR/meta-expected-error-wrong-rev.rs:14:18
|
LL | let x: u32 = 22_usize;
| --- ^^^^^^^^ expected `u32`, found `usize`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/meta/meta-expected-error-wrong-rev.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@ ignore-compare-mode-polonius

//@ revisions: a
//@ unused-revision-names: b
//@ should-fail

// This is a "meta-test" of the compilertest framework itself. In
Expand Down
1 change: 1 addition & 0 deletions tests/ui/methods/method-lookup-order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// {mutbar_for_foo, valbar_for_etmut_foo} (which are lower precedent than the inherent `&mut self` method on `Foo`; e.g. b10101 *is* included.

//@ revisions: b00001 b00010 b00011 b00100 b00101 b00110 b00111 b01000 b01001 b01100 b01101 b10000 b10001 b10010 b10011 b10101 b10111 b11000 b11001 b11101
//@ unused-revision-names: b01010 b01011 b01110 b01111 b10100 b10110 b11010 b11011 b11100 b11110 b11111

//@ compile-flags: --check-cfg=cfg(inherent_mut,bar_for_foo,mutbar_for_foo)
//@ compile-flags: --check-cfg=cfg(valbar_for_et_foo,valbar_for_etmut_foo)
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/target-feature/tied-features-cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ revisions: one two three
//@ revisions: one two three four
//@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64
//
Expand Down
1 change: 0 additions & 1 deletion tests/ui/transmutability/primitives/bool-mut.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ check-fail
//@[next] compile-flags: -Znext-solver

#![feature(transmutability)]
mod assert {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/transmutability/primitives/bool-mut.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0277]: `u8` cannot be safely transmuted into `bool`
--> $DIR/bool-mut.rs:15:50
--> $DIR/bool-mut.rs:14:50
|
LL | assert::is_transmutable::<&'static mut bool, &'static mut u8>()
| ^^^^^^^^^^^^^^^ at least one value of `u8` isn't a bit-valid value of `bool`
|
note: required by a bound in `is_transmutable`
--> $DIR/bool-mut.rs:10:14
--> $DIR/bool-mut.rs:9:14
|
LL | pub fn is_transmutable<Src, Dst>()
| --------------- required by a bound in this function
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/version/version-info-flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
//@ check-pass
//@[version] compile-flags: -V
//@[verbose-version] compile-flags: -vV
//@[long-verbose-verison] compile-flags: --version --verbose
//@[long-verbose-version] compile-flags: --version --verbose

fn main() {}

0 comments on commit 80b67c8

Please sign in to comment.