diff options
| author | bors <bors@rust-lang.org> | 2022-02-07 15:32:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-07 15:32:19 +0000 |
| commit | f52c31840df7ec9c9350baff51a8964b20b5e1ba (patch) | |
| tree | a7ea66705f0f42dc17756f1a63b91f3faa2a5139 /src/test | |
| parent | c5e414843ebfe25674d8e18a5369d6249fdee741 (diff) | |
| parent | a6c48108ad2a5bbfb161818a047e4497dde0afea (diff) | |
Auto merge of #93738 - m-ou-se:rollup-zjyd2et, r=m-ou-se
Rollup of 13 pull requests
Successful merges:
- #88313 (Make the pre-commit script pre-push instead)
- #91530 (Suggest 1-tuple parentheses on exprs without existing parens)
- #92724 (Cleanup c_str.rs)
- #93208 (Impl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}Assign<$t> for Wrapping<$t> for rust 1.60.0)
- #93394 (Don't allow {} to refer to implicit captures in format_args.)
- #93416 (remove `allow_fail` test flag)
- #93487 (Fix linking stage1 toolchain in `./x.py setup`)
- #93673 (Linkify sidebar headings for sibling items)
- #93680 (Drop json::from_reader)
- #93682 (Update tracking issue for `const_fn_trait_bound`)
- #93722 (Use shallow clones for submodules managed by rustbuild, not just bootstrap.py)
- #93723 (Rerun bootstrap's build script when RUSTC changes)
- #93737 (bootstrap: prefer using '--config' over 'RUST_BOOTSTRAP_CONFIG')
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
25 files changed, 167 insertions, 183 deletions
diff --git a/src/test/run-make-fulldeps/libtest-json/output-default.json b/src/test/run-make-fulldeps/libtest-json/output-default.json index 099b65a23ca..e2c778aa865 100644 --- a/src/test/run-make-fulldeps/libtest-json/output-default.json +++ b/src/test/run-make-fulldeps/libtest-json/output-default.json @@ -7,4 +7,4 @@ { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } { "type": "test", "name": "d", "event": "ignored" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json b/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json index fd676799a76..68eb00c297e 100644 --- a/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json +++ b/src/test/run-make-fulldeps/libtest-json/output-stdout-success.json @@ -7,4 +7,4 @@ { "type": "test", "name": "c", "event": "ok", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:15:5\n" } { "type": "test", "event": "started", "name": "d" } { "type": "test", "name": "d", "event": "ignored" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } diff --git a/src/test/rustdoc-gui/sidebar-mobile.goml b/src/test/rustdoc-gui/sidebar-mobile.goml index 60bcffe120b..ef588a69f1d 100644 --- a/src/test/rustdoc-gui/sidebar-mobile.goml +++ b/src/test/rustdoc-gui/sidebar-mobile.goml @@ -39,4 +39,4 @@ assert-position: ("#method\.must_use", {"y": 45}) // Check that the bottom-most item on the sidebar menu can be scrolled fully into view. click: ".sidebar-menu-toggle" scroll-to: ".block.keyword li:nth-child(1)" -assert-position: (".block.keyword li:nth-child(1)", {"y": 542.96875}) +assert-position: (".block.keyword li:nth-child(1)", {"y": 542.234375}) diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index ef3a92ad7a6..9505e00512f 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -78,3 +78,10 @@ assert-text: ("#functions + .item-table .item-left > a", "foo") // Links to trait implementations in the sidebar should not wrap even if they are long. goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html assert-property: (".sidebar-links a", {"offsetHeight": 29}) + +// Test that clicking on of the "In <module>" headings in the sidebar links to the +// appropriate anchor in index.html. +goto: file://|DOC_PATH|/test_docs/struct.Foo.html +click: ".block.mod h3 a" +// PAGE: index.html +assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"}) diff --git a/src/test/rustdoc-ui/check-attr-test.rs b/src/test/rustdoc-ui/check-attr-test.rs index 023d620bea2..e955470148a 100644 --- a/src/test/rustdoc-ui/check-attr-test.rs +++ b/src/test/rustdoc-ui/check-attr-test.rs @@ -23,13 +23,6 @@ pub fn bar() {} /// ``` pub fn foobar() {} -/// barfoo -/// -/// ```allow-fail,allowfail,allOw_fail -/// boo -/// ``` -pub fn barfoo() {} - /// b /// /// ```test-harness,testharness,tesT_harness diff --git a/src/test/rustdoc-ui/check-attr-test.stderr b/src/test/rustdoc-ui/check-attr-test.stderr index affd0372a1f..b1fa9edf0e4 100644 --- a/src/test/rustdoc-ui/check-attr-test.stderr +++ b/src/test/rustdoc-ui/check-attr-test.stderr @@ -111,77 +111,41 @@ error: unknown attribute `nO_run`. Did you mean `no_run`? | = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) -error: unknown attribute `allow-fail`. Did you mean `allow_fail`? +error: unknown attribute `test-harness`. Did you mean `test_harness`? --> $DIR/check-attr-test.rs:26:1 | -26 | / /// barfoo +26 | / /// b 27 | | /// -28 | | /// ```allow-fail,allowfail,allOw_fail +28 | | /// ```test-harness,testharness,tesT_harness 29 | | /// boo 30 | | /// ``` | |_______^ | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function -error: unknown attribute `allowfail`. Did you mean `allow_fail`? +error: unknown attribute `testharness`. Did you mean `test_harness`? --> $DIR/check-attr-test.rs:26:1 | -26 | / /// barfoo +26 | / /// b 27 | | /// -28 | | /// ```allow-fail,allowfail,allOw_fail +28 | | /// ```test-harness,testharness,tesT_harness 29 | | /// boo 30 | | /// ``` | |_______^ | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) + = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function -error: unknown attribute `allOw_fail`. Did you mean `allow_fail`? +error: unknown attribute `tesT_harness`. Did you mean `test_harness`? --> $DIR/check-attr-test.rs:26:1 | -26 | / /// barfoo +26 | / /// b 27 | | /// -28 | | /// ```allow-fail,allowfail,allOw_fail +28 | | /// ```test-harness,testharness,tesT_harness 29 | | /// boo 30 | | /// ``` | |_______^ | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `test-harness`. Did you mean `test_harness`? - --> $DIR/check-attr-test.rs:33:1 - | -33 | / /// b -34 | | /// -35 | | /// ```test-harness,testharness,tesT_harness -36 | | /// boo -37 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: unknown attribute `testharness`. Did you mean `test_harness`? - --> $DIR/check-attr-test.rs:33:1 - | -33 | / /// b -34 | | /// -35 | | /// ```test-harness,testharness,tesT_harness -36 | | /// boo -37 | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function - -error: unknown attribute `tesT_harness`. Did you mean `test_harness`? - --> $DIR/check-attr-test.rs:33:1 - | -33 | / /// b -34 | | /// -35 | | /// ```test-harness,testharness,tesT_harness -36 | | /// boo -37 | | /// ``` - | |_______^ - | = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function -error: aborting due to 15 previous errors +error: aborting due to 12 previous errors diff --git a/src/test/rustdoc-ui/check-attr.rs b/src/test/rustdoc-ui/check-attr.rs index 763bc4c6cdd..0b3f7bedda5 100644 --- a/src/test/rustdoc-ui/check-attr.rs +++ b/src/test/rustdoc-ui/check-attr.rs @@ -30,16 +30,6 @@ pub fn bar() {} /// ``` pub fn foobar() {} -/// barfoo -//~^ ERROR -//~^^ ERROR -//~^^^ ERROR -/// -/// ```allow-fail,allowfail,alLow_fail -/// boo -/// ``` -pub fn barfoo() {} - /// b //~^ ERROR //~^^ ERROR diff --git a/src/test/rustdoc-ui/check-attr.stderr b/src/test/rustdoc-ui/check-attr.stderr index 9312cfb76f3..370b804c56c 100644 --- a/src/test/rustdoc-ui/check-attr.stderr +++ b/src/test/rustdoc-ui/check-attr.stderr @@ -129,50 +129,8 @@ LL | | /// ``` | = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) -error: unknown attribute `allow-fail`. Did you mean `allow_fail`? - --> $DIR/check-attr.rs:33:1 - | -LL | / /// barfoo -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `allowfail`. Did you mean `allow_fail`? - --> $DIR/check-attr.rs:33:1 - | -LL | / /// barfoo -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - -error: unknown attribute `alLow_fail`. Did you mean `allow_fail`? - --> $DIR/check-attr.rs:33:1 - | -LL | / /// barfoo -LL | | -LL | | -LL | | -... | -LL | | /// boo -LL | | /// ``` - | |_______^ - | - = help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want) - error: unknown attribute `test-harness`. Did you mean `test_harness`? - --> $DIR/check-attr.rs:43:1 + --> $DIR/check-attr.rs:33:1 | LL | / /// b LL | | @@ -186,7 +144,7 @@ LL | | /// ``` = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function error: unknown attribute `testharness`. Did you mean `test_harness`? - --> $DIR/check-attr.rs:43:1 + --> $DIR/check-attr.rs:33:1 | LL | / /// b LL | | @@ -200,7 +158,7 @@ LL | | /// ``` = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function error: unknown attribute `teSt_harness`. Did you mean `test_harness`? - --> $DIR/check-attr.rs:43:1 + --> $DIR/check-attr.rs:33:1 | LL | / /// b LL | | @@ -213,5 +171,5 @@ LL | | /// ``` | = help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function -error: aborting due to 15 previous errors +error: aborting due to 12 previous errors diff --git a/src/test/ui/consts/const-tup-index-span.stderr b/src/test/ui/consts/const-tup-index-span.stderr index 6724984d8d7..d301f8c4054 100644 --- a/src/test/ui/consts/const-tup-index-span.stderr +++ b/src/test/ui/consts/const-tup-index-span.stderr @@ -6,6 +6,10 @@ LL | const TUP: (usize,) = 5usize << 64; | = note: expected tuple `(usize,)` found type `usize` +help: use a trailing comma to create a tuple with one element + | +LL | const TUP: (usize,) = (5usize << 64,); + | + ++ error: aborting due to previous error diff --git a/src/test/ui/consts/const_fn_trait_bound.stock.stderr b/src/test/ui/consts/const_fn_trait_bound.stock.stderr index d652b5268a8..7d9e18cb341 100644 --- a/src/test/ui/consts/const_fn_trait_bound.stock.stderr +++ b/src/test/ui/consts/const_fn_trait_bound.stock.stderr @@ -4,7 +4,7 @@ error[E0658]: trait bounds other than `Sized` on const fn parameters are unstabl LL | const fn test1<T: std::ops::Add>() {} | ^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -13,7 +13,7 @@ error[E0658]: trait objects in const fn are unstable LL | const fn test2(_x: &dyn Send) {} | ^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -22,7 +22,7 @@ error[E0658]: trait objects in const fn are unstable LL | const fn test3() -> &'static dyn Send { loop {} } | ^^^^^^^^^^^^^^^^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index fd1ab6f64bf..67cb604b6a7 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -136,7 +136,7 @@ error[E0658]: trait bounds other than `Sized` on const fn parameters are unstabl LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t } | ^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable @@ -145,7 +145,7 @@ error[E0658]: trait bounds other than `Sized` on const fn parameters are unstabl LL | const fn foo11_2<T: Send>(t: T) -> T { t } | ^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0013]: constant functions cannot refer to statics @@ -218,7 +218,7 @@ LL | LL | const fn foo(&self) {} | ------------------- function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable @@ -230,7 +230,7 @@ LL | LL | const fn foo2(&self) {} | -------------------- function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable @@ -242,7 +242,7 @@ LL | LL | const fn foo3(&self) {} | -------------------- function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable @@ -251,7 +251,7 @@ error[E0658]: trait bounds other than `Sized` on const fn parameters are unstabl LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {} | ^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time @@ -268,7 +268,7 @@ error[E0658]: trait bounds other than `Sized` on const fn parameters are unstabl LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0493]: destructors cannot be evaluated at compile-time @@ -285,7 +285,7 @@ error[E0658]: trait objects in const fn are unstable LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -294,7 +294,7 @@ error[E0658]: trait objects in const fn are unstable LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -305,7 +305,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 | | | function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -316,7 +316,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 | | | function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -327,7 +327,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 | | | function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: function pointers cannot appear in constant functions diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr index 6eec1df5aec..4c2199101d3 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr @@ -6,7 +6,7 @@ LL | const fn no_inner_dyn_trait2(x: Hide) { LL | x.0.field; | ^^^^^^^^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error[E0658]: trait objects in const fn are unstable @@ -17,7 +17,7 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | | | function declared as const here | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.rs b/src/test/ui/feature-gates/feature-gate-allow_fail.rs deleted file mode 100644 index 287d4ccf180..00000000000 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check that #[allow_fail] is feature-gated - -#[allow_fail] //~ ERROR the `#[allow_fail]` attribute is an experimental feature -fn ok_to_fail() { - assert!(false); -} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr deleted file mode 100644 index 76115fb9698..00000000000 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: the `#[allow_fail]` attribute is an experimental feature - --> $DIR/feature-gate-allow_fail.rs:3:1 - | -LL | #[allow_fail] - | ^^^^^^^^^^^^^ - | - = note: see issue #46488 <https://github.com/rust-lang/rust/issues/46488> for more information - = help: add `#![feature(allow_fail)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/fmt/format-args-capture-issue-93378.rs b/src/test/ui/fmt/format-args-capture-issue-93378.rs new file mode 100644 index 00000000000..67444444264 --- /dev/null +++ b/src/test/ui/fmt/format-args-capture-issue-93378.rs @@ -0,0 +1,11 @@ +fn main() { + let a = "a"; + let b = "b"; + + println!("{a} {b} {} {} {c} {}", c = "c"); + //~^ ERROR: invalid reference to positional arguments 1 and 2 (there is 1 argument) + + let n = 1; + println!("{a:.n$} {b:.*}"); + //~^ ERROR: invalid reference to positional argument 0 (no arguments were given) +} diff --git a/src/test/ui/fmt/format-args-capture-issue-93378.stderr b/src/test/ui/fmt/format-args-capture-issue-93378.stderr new file mode 100644 index 00000000000..588541044fe --- /dev/null +++ b/src/test/ui/fmt/format-args-capture-issue-93378.stderr @@ -0,0 +1,22 @@ +error: invalid reference to positional arguments 1 and 2 (there is 1 argument) + --> $DIR/format-args-capture-issue-93378.rs:5:26 + | +LL | println!("{a} {b} {} {} {c} {}", c = "c"); + | ^^ ^^ + | + = note: positional arguments are zero-based + +error: invalid reference to positional argument 0 (no arguments were given) + --> $DIR/format-args-capture-issue-93378.rs:9:23 + | +LL | println!("{a:.n$} {b:.*}"); + | ------- ^^^--^ + | | | + | | this precision flag adds an extra required argument at position 0, which is why there are 3 arguments expected + | this parameter corresponds to the precision flag + | + = note: positional arguments are zero-based + = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/fmt/format-args-capture.rs b/src/test/ui/fmt/format-args-capture.rs index e830a5bc9c5..d31d2a6c336 100644 --- a/src/test/ui/fmt/format-args-capture.rs +++ b/src/test/ui/fmt/format-args-capture.rs @@ -5,6 +5,7 @@ fn main() { named_argument_takes_precedence_to_captured(); formatting_parameters_can_be_captured(); capture_raw_strings_and_idents(); + repeated_capture(); #[cfg(panic = "unwind")] { @@ -80,3 +81,10 @@ fn formatting_parameters_can_be_captured() { let s = format!("{x:-^width$.precision$}"); assert_eq!(&s, "--7.000--"); } + +fn repeated_capture() { + let a = 1; + let b = 2; + let s = format!("{a} {b} {a}"); + assert_eq!(&s, "1 2 1"); +} diff --git a/src/test/ui/nll/issue-55825-const-fn.stderr b/src/test/ui/nll/issue-55825-const-fn.stderr index 9af5180343b..c834f8bd9c4 100644 --- a/src/test/ui/nll/issue-55825-const-fn.stderr +++ b/src/test/ui/nll/issue-55825-const-fn.stderr @@ -4,7 +4,7 @@ error[E0658]: trait objects in const fn are unstable LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information + = note: see issue #93706 <https://github.com/rust-lang/rust/issues/93706> for more information = help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/suggestions/args-instead-of-tuple-errors.rs b/src/test/ui/suggestions/args-instead-of-tuple-errors.rs index 2c3ee5fcb80..5403b8d6d28 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple-errors.rs +++ b/src/test/ui/suggestions/args-instead-of-tuple-errors.rs @@ -10,6 +10,12 @@ fn main() { let _: Option<(i8,)> = Some(); //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied + + let _: Option<(i32,)> = Some(5_usize); + //~^ ERROR mismatched types + + let _: Option<(i32,)> = Some((5_usize)); + //~^ ERROR mismatched types } fn int_bool(_: (i32, bool)) { diff --git a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr index a2ad602dbd4..ddcdfb1c3b3 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -15,7 +15,7 @@ LL | int_bool(1, 2); | expected 1 argument | note: function defined here - --> $DIR/args-instead-of-tuple-errors.rs:15:4 + --> $DIR/args-instead-of-tuple-errors.rs:21:4 | LL | fn int_bool(_: (i32, bool)) { | ^^^^^^^^ -------------- @@ -28,6 +28,25 @@ LL | let _: Option<(i8,)> = Some(); | | | expected 1 argument -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/args-instead-of-tuple-errors.rs:14:34 + | +LL | let _: Option<(i32,)> = Some(5_usize); + | ^^^^^^^ expected tuple, found `usize` + | + = note: expected tuple `(i32,)` + found type `usize` + +error[E0308]: mismatched types + --> $DIR/args-instead-of-tuple-errors.rs:17:34 + | +LL | let _: Option<(i32,)> = Some((5_usize)); + | ^^^^^^^^^ expected tuple, found `usize` + | + = note: expected tuple `(i32,)` + found type `usize` + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0061`. +Some errors have detailed explanations: E0061, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/src/test/ui/suggestions/args-instead-of-tuple.fixed b/src/test/ui/suggestions/args-instead-of-tuple.fixed index c9b8a41d469..66e53f9ce2c 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.fixed +++ b/src/test/ui/suggestions/args-instead-of-tuple.fixed @@ -11,6 +11,12 @@ fn main() { let _: Option<()> = Some(()); //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied + let _: Option<(i32,)> = Some((3,)); + //~^ ERROR mismatched types + + let _: Option<(i32,)> = Some((3,)); + //~^ ERROR mismatched types + two_ints((1, 2)); //~ ERROR this function takes 1 argument with_generic((3, 4)); //~ ERROR this function takes 1 argument diff --git a/src/test/ui/suggestions/args-instead-of-tuple.rs b/src/test/ui/suggestions/args-instead-of-tuple.rs index d4cc3024dd0..a15bff07ebf 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.rs +++ b/src/test/ui/suggestions/args-instead-of-tuple.rs @@ -11,6 +11,12 @@ fn main() { let _: Option<()> = Some(); //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied + let _: Option<(i32,)> = Some(3); + //~^ ERROR mismatched types + + let _: Option<(i32,)> = Some((3)); + //~^ ERROR mismatched types + two_ints(1, 2); //~ ERROR this function takes 1 argument with_generic(3, 4); //~ ERROR this function takes 1 argument diff --git a/src/test/ui/suggestions/args-instead-of-tuple.stderr b/src/test/ui/suggestions/args-instead-of-tuple.stderr index 172db7ee3df..6a7602c9d0f 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple.stderr @@ -31,14 +31,40 @@ help: expected the unit value `()`; create it with empty parentheses LL | let _: Option<()> = Some(()); | ++ +error[E0308]: mismatched types + --> $DIR/args-instead-of-tuple.rs:14:34 + | +LL | let _: Option<(i32,)> = Some(3); + | ^ expected tuple, found integer + | + = note: expected tuple `(i32,)` + found type `{integer}` +help: use a trailing comma to create a tuple with one element + | +LL | let _: Option<(i32,)> = Some((3,)); + | + ++ + +error[E0308]: mismatched types + --> $DIR/args-instead-of-tuple.rs:17:34 + | +LL | let _: Option<(i32,)> = Some((3)); + | ^^^ expected tuple, found integer + | + = note: expected tuple `(i32,)` + found type `{integer}` +help: use a trailing comma to create a tuple with one element + | +LL | let _: Option<(i32,)> = Some((3,)); + | + + error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/args-instead-of-tuple.rs:14:5 + --> $DIR/args-instead-of-tuple.rs:20:5 | LL | two_ints(1, 2); | ^^^^^^^^ - - supplied 2 arguments | note: function defined here - --> $DIR/args-instead-of-tuple.rs:19:4 + --> $DIR/args-instead-of-tuple.rs:25:4 | LL | fn two_ints(_: (i32, i32)) { | ^^^^^^^^ ------------- @@ -48,13 +74,13 @@ LL | two_ints((1, 2)); | + + error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/args-instead-of-tuple.rs:16:5 + --> $DIR/args-instead-of-tuple.rs:22:5 | LL | with_generic(3, 4); | ^^^^^^^^^^^^ - - supplied 2 arguments | note: function defined here - --> $DIR/args-instead-of-tuple.rs:22:4 + --> $DIR/args-instead-of-tuple.rs:28:4 | LL | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { | ^^^^^^^^^^^^ ---------------- @@ -64,13 +90,13 @@ LL | with_generic((3, 4)); | + + error[E0061]: this function takes 1 argument but 2 arguments were supplied - --> $DIR/args-instead-of-tuple.rs:25:9 + --> $DIR/args-instead-of-tuple.rs:31:9 | LL | with_generic(a, b); | ^^^^^^^^^^^^ - - supplied 2 arguments | note: function defined here - --> $DIR/args-instead-of-tuple.rs:22:4 + --> $DIR/args-instead-of-tuple.rs:28:4 | LL | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { | ^^^^^^^^^^^^ ---------------- @@ -79,6 +105,7 @@ help: use parentheses to construct a tuple LL | with_generic((a, b)); | + + -error: aborting due to 6 previous errors +error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0061`. +Some errors have detailed explanations: E0061, E0308. +For more information about an error, try `rustc --explain E0061`. diff --git a/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr b/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr index 9c8356a5284..0016f192842 100644 --- a/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr +++ b/src/test/ui/suggestions/issue-86100-tuple-paren-comma.stderr @@ -11,7 +11,7 @@ LL | let _x: (i32,) = (5); help: use a trailing comma to create a tuple with one element | LL | let _x: (i32,) = (5,); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:13:9 @@ -24,7 +24,7 @@ LL | foo((Some(3))); help: use a trailing comma to create a tuple with one element | LL | foo((Some(3),)); - | ~~~~~~~~~~ + | + error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:17:22 @@ -37,7 +37,7 @@ LL | let _s = S { _s: ("abc".to_string()) }; help: use a trailing comma to create a tuple with one element | LL | let _s = S { _s: ("abc".to_string(),) }; - | ~~~~~~~~~~~~~~~~~~~~ + | + error[E0308]: mismatched types --> $DIR/issue-86100-tuple-paren-comma.rs:23:22 diff --git a/src/test/ui/test-attrs/test-allow-fail-attr.rs b/src/test/ui/test-attrs/test-allow-fail-attr.rs deleted file mode 100644 index 29ce9f7c2e9..00000000000 --- a/src/test/ui/test-attrs/test-allow-fail-attr.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass -// compile-flags: --test -#![feature(allow_fail)] -#![feature(cfg_panic)] - -#[test] -#[allow_fail] -fn test1() { - #[cfg(not(panic = "abort"))] - panic!(); -} - -#[test] -#[allow_fail] -fn test2() { - assert!(true); -} |
