diff options
Diffstat (limited to 'tests')
129 files changed, 1437 insertions, 403 deletions
diff --git a/tests/assembly/thin-lto.rs b/tests/assembly/thin-lto.rs new file mode 100644 index 00000000000..deb8fd21d14 --- /dev/null +++ b/tests/assembly/thin-lto.rs @@ -0,0 +1,8 @@ +// compile-flags: -O -C lto=thin -C prefer-dynamic=no +// only-x86_64-unknown-linux-gnu +// assembly-output: emit-asm + +// CHECK: main + +pub fn main() { +} diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly/x86_64-function-return.rs new file mode 100644 index 00000000000..0fcaca2d491 --- /dev/null +++ b/tests/assembly/x86_64-function-return.rs @@ -0,0 +1,30 @@ +// Test that the function return is (not) converted into a jump to the thunk +// when the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. + +// revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep +// assembly-output: emit-asm +// compile-flags: -O +// [keep] compile-flags: -Zfunction-return=keep +// [thunk-extern] compile-flags: -Zfunction-return=thunk-extern +// [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern +// [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep +// only-x86_64 +// ignore-x86_64-apple-darwin Symbol is called `___x86_return_thunk` (Darwin's extra underscore) +// ignore-sgx Tests incompatible with LVI mitigations + +#![crate_type = "lib"] + +// CHECK-LABEL: foo: +#[no_mangle] +pub unsafe fn foo() { + // unset: ret + // unset-NOT: jmp __x86_return_thunk + // keep: ret + // keep-NOT: jmp __x86_return_thunk + // thunk-extern: jmp __x86_return_thunk + // thunk-extern-NOT: ret + // keep-thunk-extern: jmp __x86_return_thunk + // keep-thunk-extern-NOT: ret + // thunk-extern-keep: ret + // thunk-extern-keep-NOT: jmp __x86_return_thunk +} diff --git a/tests/codegen/ascii-char.rs b/tests/codegen/ascii-char.rs index 4167becf5e9..711ffe7e1a5 100644 --- a/tests/codegen/ascii-char.rs +++ b/tests/codegen/ascii-char.rs @@ -14,7 +14,7 @@ pub fn unwrap_digit_from_remainder(v: u32) -> AsciiChar { // CHECK: %[[R:.+]] = urem i32 %v, 10 // CHECK-NEXT: %[[T:.+]] = trunc i32 %[[R]] to i8 - // CHECK-NEXT: %[[D:.+]] = or i8 %[[T]], 48 + // CHECK-NEXT: %[[D:.+]] = or{{( disjoint)?}} i8 %[[T]], 48 // CHECK-NEXT: ret i8 %[[D]] // CHECK-NOT: icmp diff --git a/tests/codegen/function-return.rs b/tests/codegen/function-return.rs new file mode 100644 index 00000000000..d832d19ac39 --- /dev/null +++ b/tests/codegen/function-return.rs @@ -0,0 +1,28 @@ +// Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when +// the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. + +// revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep +// needs-llvm-components: x86 +// compile-flags: --target x86_64-unknown-linux-gnu +// [keep] compile-flags: -Zfunction-return=keep +// [thunk-extern] compile-flags: -Zfunction-return=thunk-extern +// [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern +// [thunk-extern-keep] compile-flags: -Zfunction-return=thunk-extern -Zfunction-return=keep + +#![crate_type = "lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[no_mangle] +pub fn foo() { + // CHECK: @foo() unnamed_addr #0 + + // unset-NOT: fn_ret_thunk_extern + // keep-NOT: fn_ret_thunk_extern + // thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} } + // keep-thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} } + // thunk-extern-keep-NOT: fn_ret_thunk_extern +} diff --git a/tests/codegen/thin-lto.rs b/tests/codegen/thin-lto.rs new file mode 100644 index 00000000000..7991cad7a0c --- /dev/null +++ b/tests/codegen/thin-lto.rs @@ -0,0 +1,7 @@ +// compile-flags: -O -C lto=thin -C prefer-dynamic=no +// only-x86_64-unknown-linux-gnu + +// CHECK: main + +pub fn main() { +} diff --git a/tests/coverage/thin-lto.cov-map b/tests/coverage/thin-lto.cov-map new file mode 100644 index 00000000000..7e84e398f84 --- /dev/null +++ b/tests/coverage/thin-lto.cov-map @@ -0,0 +1,8 @@ +Function name: thin_lto::main +Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 01, 01, 02] +Number of files: 1 +- file 0 => global file 1 +Number of expressions: 0 +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 3, 1) to (start + 1, 2) + diff --git a/tests/coverage/thin-lto.coverage b/tests/coverage/thin-lto.coverage new file mode 100644 index 00000000000..21abb5dce04 --- /dev/null +++ b/tests/coverage/thin-lto.coverage @@ -0,0 +1,5 @@ + LL| |// compile-flags: -O -C lto=thin -C prefer-dynamic=no + LL| | + LL| 1|pub fn main() { + LL| 1|} + diff --git a/tests/coverage/thin-lto.rs b/tests/coverage/thin-lto.rs new file mode 100644 index 00000000000..050aac26319 --- /dev/null +++ b/tests/coverage/thin-lto.rs @@ -0,0 +1,4 @@ +// compile-flags: -O -C lto=thin -C prefer-dynamic=no + +pub fn main() { +} diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff index b30deb2a4d4..11cdf9e09db 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff @@ -8,7 +8,7 @@ let mut _3: u8; scope 1 { } - scope 2 (inlined <u8 as Add>::add) { + scope 2 (inlined #[track_caller] <u8 as Add>::add) { debug self => _2; debug other => _3; let mut _4: (u8, bool); diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff index 47c51196c02..181a2f287d6 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff @@ -8,7 +8,7 @@ let mut _3: u8; scope 1 { } - scope 2 (inlined <u8 as Add>::add) { + scope 2 (inlined #[track_caller] <u8 as Add>::add) { debug self => _2; debug other => _3; let mut _4: (u8, bool); diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs new file mode 100644 index 00000000000..4cf6d7c1396 --- /dev/null +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs @@ -0,0 +1,26 @@ +// unit-test: ConstProp +// compile-flags: -O + +// Regression test for https://github.com/rust-lang/rust/issues/118328 + +#![allow(unused_assignments)] + +struct SizeOfConst<T>(std::marker::PhantomData<T>); +impl<T> SizeOfConst<T> { + const SIZE: usize = std::mem::size_of::<T>(); +} + +// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff +fn size_of<T>() -> usize { + // CHECK-LABEL: fn size_of( + // CHECK: _1 = const 0_usize; + // CHECK-NEXT: _1 = const _; + // CHECK-NEXT: _0 = _1; + let mut a = 0; + a = SizeOfConst::<T>::SIZE; + a +} + +fn main() { + assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>()); +} diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff new file mode 100644 index 00000000000..ad8318832d6 --- /dev/null +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff @@ -0,0 +1,20 @@ +- // MIR for `size_of` before ConstProp ++ // MIR for `size_of` after ConstProp + + fn size_of() -> usize { + let mut _0: usize; + let mut _1: usize; + scope 1 { + debug a => _1; + } + + bb0: { + StorageLive(_1); + _1 = const 0_usize; + _1 = const _; + _0 = _1; + StorageDead(_1); + return; + } + } + diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff index 2d4591ea2d3..09fc48043b9 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff @@ -8,7 +8,7 @@ let mut _3: u8; scope 1 { } - scope 2 (inlined <u8 as Add>::add) { + scope 2 (inlined #[track_caller] <u8 as Add>::add) { debug self => _2; debug other => _3; let mut _4: (u8, bool); diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff index e99ac782a2f..c0b26080f56 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff @@ -8,7 +8,7 @@ let mut _3: u8; scope 1 { } - scope 2 (inlined <u8 as Add>::add) { + scope 2 (inlined #[track_caller] <u8 as Add>::add) { debug self => _2; debug other => _3; let mut _4: (u8, bool); diff --git a/tests/run-make/pass-linker-flags-flavor/Makefile b/tests/run-make/pass-linker-flags-flavor/Makefile index bd3d3ed882f..1bb05d0f974 100644 --- a/tests/run-make/pass-linker-flags-flavor/Makefile +++ b/tests/run-make/pass-linker-flags-flavor/Makefile @@ -3,6 +3,9 @@ include ../tools.mk all: - $(RUSTC) rs.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3' - $(RUSTC) rs.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg:+verbatim=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3' - $(RUSTC) rs.rs -Z unstable-options -C linker-flavor=ld -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"' + $(RUSTC) empty.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3' + $(RUSTC) empty.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg:+verbatim=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3' + $(RUSTC) empty.rs -Z unstable-options -C linker-flavor=ld -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"' + $(RUSTC) attribute.rs -Z unstable-options -C linker-flavor=gnu-cc --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3' + $(RUSTC) --cfg 'feature="verbatim"' attribute.rs -Z unstable-options -C linker-flavor=gnu-cc --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3' + $(RUSTC) attribute.rs -C linker-flavor=ld --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"' diff --git a/tests/run-make/pass-linker-flags-flavor/attribute.rs b/tests/run-make/pass-linker-flags-flavor/attribute.rs new file mode 100644 index 00000000000..d099165301b --- /dev/null +++ b/tests/run-make/pass-linker-flags-flavor/attribute.rs @@ -0,0 +1,12 @@ +#![feature(link_arg_attribute)] + +#[link(kind = "static", name = "l1")] +#[cfg_attr(feature = "verbatim", link(kind = "link-arg", name = "a1", modifiers = "+verbatim"))] +#[cfg_attr(not(feature = "verbatim"), link(kind = "link-arg", name = "a1"))] +#[link(kind = "static", name = "l2")] +#[link(kind = "link-arg", name = "a2")] +#[link(kind = "dylib", name = "d1")] +#[link(kind = "link-arg", name = "a3")] +extern "C" {} + +fn main() {} diff --git a/tests/run-make/pass-linker-flags-flavor/rs.rs b/tests/run-make/pass-linker-flags-flavor/empty.rs index f328e4d9d04..f328e4d9d04 100644 --- a/tests/run-make/pass-linker-flags-flavor/rs.rs +++ b/tests/run-make/pass-linker-flags-flavor/empty.rs diff --git a/tests/run-make/pass-linker-flags-from-dep/Makefile b/tests/run-make/pass-linker-flags-from-dep/Makefile index b57389bb7d4..48b3b26ce81 100644 --- a/tests/run-make/pass-linker-flags-from-dep/Makefile +++ b/tests/run-make/pass-linker-flags-from-dep/Makefile @@ -4,7 +4,9 @@ all: # Build deps $(RUSTC) native_dep_1.rs --crate-type=staticlib $(RUSTC) native_dep_2.rs --crate-type=staticlib - $(RUSTC) rust_dep.rs -l static:-bundle=native_dep_1 -l link-arg=some_flag -l static:-bundle=native_dep_2 --crate-type=lib -Z unstable-options + $(RUSTC) rust_dep_flag.rs -l static:-bundle=native_dep_1 -l link-arg=some_flag -l static:-bundle=native_dep_2 --crate-type=lib -Z unstable-options + $(RUSTC) rust_dep_attr.rs --crate-type=lib # Check sequence of linker args - $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2' + $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_flag.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2' + $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_attr.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2' diff --git a/tests/run-make/pass-linker-flags-from-dep/rust_dep_attr.rs b/tests/run-make/pass-linker-flags-from-dep/rust_dep_attr.rs new file mode 100644 index 00000000000..ac5888ce610 --- /dev/null +++ b/tests/run-make/pass-linker-flags-from-dep/rust_dep_attr.rs @@ -0,0 +1,14 @@ +#![feature(link_arg_attribute)] + +#[link(kind = "static", name = "native_dep_1", modifiers = "-bundle")] +#[link(kind = "link-arg", name = "some_flag")] +#[link(kind = "static", name = "native_dep_2", modifiers = "-bundle")] +extern "C" { + pub fn foo(); +} + +pub fn f() { + unsafe { + foo(); + } +} diff --git a/tests/run-make/pass-linker-flags-from-dep/rust_dep.rs b/tests/run-make/pass-linker-flags-from-dep/rust_dep_flag.rs index 7f5df113934..7f5df113934 100644 --- a/tests/run-make/pass-linker-flags-from-dep/rust_dep.rs +++ b/tests/run-make/pass-linker-flags-from-dep/rust_dep_flag.rs diff --git a/tests/run-make/pass-linker-flags/Makefile b/tests/run-make/pass-linker-flags/Makefile index 6ddbcbb1b08..226943e93bd 100644 --- a/tests/run-make/pass-linker-flags/Makefile +++ b/tests/run-make/pass-linker-flags/Makefile @@ -1,4 +1,5 @@ include ../tools.mk all: - $(RUSTC) rs.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3' + $(RUSTC) empty.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3' + $(RUSTC) attribute.rs --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3' diff --git a/tests/run-make/pass-linker-flags/attribute.rs b/tests/run-make/pass-linker-flags/attribute.rs new file mode 100644 index 00000000000..6f784c01ff2 --- /dev/null +++ b/tests/run-make/pass-linker-flags/attribute.rs @@ -0,0 +1,11 @@ +#![feature(link_arg_attribute)] + +#[link(kind = "static", name = "l1")] +#[link(kind = "link-arg", name = "a1")] +#[link(kind = "static", name = "l2")] +#[link(kind = "link-arg", name = "a2")] +#[link(kind = "dylib", name = "d1")] +#[link(kind = "link-arg", name = "a3")] +extern "C" {} + +fn main() {} diff --git a/tests/run-make/pass-linker-flags/rs.rs b/tests/run-make/pass-linker-flags/empty.rs index f328e4d9d04..f328e4d9d04 100644 --- a/tests/run-make/pass-linker-flags/rs.rs +++ b/tests/run-make/pass-linker-flags/empty.rs diff --git a/tests/run-make/valid-print-requests/valid-print-requests.stderr b/tests/run-make/valid-print-requests/valid-print-requests.stderr index 4f57550c29a..22bb102f9c9 100644 --- a/tests/run-make/valid-print-requests/valid-print-requests.stderr +++ b/tests/run-make/valid-print-requests/valid-print-requests.stderr @@ -1,2 +1,2 @@ -error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo`, `deployment-target` +error: unknown print request `uwu`. Valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models` diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml index 6fad128dab8..602b8d6f5b3 100644 --- a/tests/rustdoc-gui/font-weight.goml +++ b/tests/rustdoc-gui/font-weight.goml @@ -2,7 +2,7 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" assert-css: ("//*[@class='rust item-decl']//a[text()='Alias']", {"font-weight": "400"}) assert-css: ( - "//*[@class='structfield small-section-header']//a[text()='Alias']", + "//*[@class='structfield section-header']//a[text()='Alias']", {"font-weight": "400"}, ) assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"}) diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml index a7ac94c4943..19185818f40 100644 --- a/tests/rustdoc-gui/headers-color.goml +++ b/tests/rustdoc-gui/headers-color.goml @@ -31,7 +31,7 @@ define-function: ( ALL, ) go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" - assert-css: (".small-section-header a", {"color": |color|}, ALL) + assert-css: (".section-header a", {"color": |color|}, ALL) go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" // We select headings (h2, h3, h...). assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL) diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index ab8d72bf71b..f9f9c4f4de8 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -18,6 +18,15 @@ const PARSED = [ error: "Found generics without a path", }, { + query: '-> *', + elems: [], + foundElems: 0, + original: "-> *", + returned: [], + userQuery: "-> *", + error: "Unexpected `*`", + }, + { query: 'a<"P">', elems: [], foundElems: 0, @@ -144,6 +153,24 @@ const PARSED = [ error: "Unexpected `::::`", }, { + query: "a:: ::b", + elems: [], + foundElems: 0, + original: "a:: ::b", + returned: [], + userQuery: "a:: ::b", + error: "Unexpected `:: ::`", + }, + { + query: "a::\t::b", + elems: [], + foundElems: 0, + original: "a:: ::b", + returned: [], + userQuery: "a:: ::b", + error: "Unexpected `:: ::`", + }, + { query: "a::b::", elems: [], foundElems: 0, @@ -315,24 +342,6 @@ const PARSED = [ error: 'Unexpected `-` after `<`', }, { - query: "a:: a", - elems: [], - foundElems: 0, - original: 'a:: a', - returned: [], - userQuery: 'a:: a', - error: 'Unexpected `:: `', - }, - { - query: "a ::a", - elems: [], - foundElems: 0, - original: 'a ::a', - returned: [], - userQuery: 'a ::a', - error: 'Unexpected ` ::`', - }, - { query: "a<a>:", elems: [], foundElems: 0, diff --git a/tests/rustdoc-js-std/parser-paths.js b/tests/rustdoc-js-std/parser-paths.js index 8d4dedf3f46..774e5d028cc 100644 --- a/tests/rustdoc-js-std/parser-paths.js +++ b/tests/rustdoc-js-std/parser-paths.js @@ -16,6 +16,54 @@ const PARSED = [ error: null, }, { + query: "a:: a", + elems: [{ + name: "a:: a", + fullPath: ["a", "a"], + pathWithoutLast: ["a"], + pathLast: "a", + generics: [], + typeFilter: -1, + }], + foundElems: 1, + original: 'a:: a', + returned: [], + userQuery: 'a:: a', + error: null, + }, + { + query: "a ::a", + elems: [{ + name: "a ::a", + fullPath: ["a", "a"], + pathWithoutLast: ["a"], + pathLast: "a", + generics: [], + typeFilter: -1, + }], + foundElems: 1, + original: 'a ::a', + returned: [], + userQuery: 'a ::a', + error: null, + }, + { + query: "a :: a", + elems: [{ + name: "a :: a", + fullPath: ["a", "a"], + pathWithoutLast: ["a"], + pathLast: "a", + generics: [], + typeFilter: -1, + }], + foundElems: 1, + original: 'a :: a', + returned: [], + userQuery: 'a :: a', + error: null, + }, + { query: 'A::B,C', elems: [ { diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js index 00c489b51a6..7f95f61b006 100644 --- a/tests/rustdoc-js-std/parser-separators.js +++ b/tests/rustdoc-js-std/parser-separators.js @@ -5,7 +5,7 @@ const PARSED = [ query: 'aaaaaa b', elems: [ { - name: 'aaaaaa\tb', + name: 'aaaaaa b', fullPath: ['aaaaaa', 'b'], pathWithoutLast: ['aaaaaa'], pathLast: 'b', @@ -14,9 +14,9 @@ const PARSED = [ }, ], foundElems: 1, - original: "aaaaaa b", + original: "aaaaaa b", returned: [], - userQuery: "aaaaaa b", + userQuery: "aaaaaa b", error: null, }, { @@ -40,9 +40,9 @@ const PARSED = [ }, ], foundElems: 2, - original: "aaaaaa, b", + original: "aaaaaa, b", returned: [], - userQuery: "aaaaaa, b", + userQuery: "aaaaaa, b", error: null, }, { @@ -93,7 +93,7 @@ const PARSED = [ query: 'a\tb', elems: [ { - name: 'a\tb', + name: 'a b', fullPath: ['a', 'b'], pathWithoutLast: ['a'], pathLast: 'b', @@ -102,9 +102,9 @@ const PARSED = [ }, ], foundElems: 1, - original: "a\tb", + original: "a b", returned: [], - userQuery: "a\tb", + userQuery: "a b", error: null, }, { @@ -176,7 +176,7 @@ const PARSED = [ pathLast: 'a', generics: [ { - name: 'b\tc', + name: 'b c', fullPath: ['b', 'c'], pathWithoutLast: ['b'], pathLast: 'c', @@ -187,9 +187,9 @@ const PARSED = [ }, ], foundElems: 1, - original: "a<b\tc>", + original: "a<b c>", returned: [], - userQuery: "a<b\tc>", + userQuery: "a<b c>", error: null, }, ]; diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js index 720ef66c165..ba68c9717c5 100644 --- a/tests/rustdoc-js-std/parser-weird-queries.js +++ b/tests/rustdoc-js-std/parser-weird-queries.js @@ -92,9 +92,9 @@ const PARSED = [ query: 'mod\t:', elems: [], foundElems: 0, - original: 'mod\t:', + original: 'mod :', returned: [], - userQuery: 'mod\t:', + userQuery: 'mod :', error: "Unexpected `:` (expected path after type filter `mod:`)", }, ]; diff --git a/tests/rustdoc/async-fn-opaque-item.rs b/tests/rustdoc/async-fn-opaque-item.rs index a73e84f3fdc..2c030824fe7 100644 --- a/tests/rustdoc/async-fn-opaque-item.rs +++ b/tests/rustdoc/async-fn-opaque-item.rs @@ -9,7 +9,7 @@ // Checking there is only a "Functions" header and no "Opaque types". // @has async_fn_opaque_item/index.html -// @count - '//*[@class="small-section-header"]' 1 -// @has - '//*[@class="small-section-header"]' 'Functions' +// @count - '//*[@class="section-header"]' 1 +// @has - '//*[@class="section-header"]' 'Functions' pub async fn test() {} diff --git a/tests/rustdoc/compiler-derive-proc-macro.rs b/tests/rustdoc/compiler-derive-proc-macro.rs index 489ec924c1f..1c3867ced9b 100644 --- a/tests/rustdoc/compiler-derive-proc-macro.rs +++ b/tests/rustdoc/compiler-derive-proc-macro.rs @@ -5,9 +5,9 @@ // @has 'foo/index.html' // Each compiler builtin proc-macro has a trait equivalent so we should have // a trait section as well. -// @count - '//*[@id="main-content"]//*[@class="small-section-header"]' 2 -// @has - '//*[@id="main-content"]//*[@class="small-section-header"]' 'Traits' -// @has - '//*[@id="main-content"]//*[@class="small-section-header"]' 'Derive Macros' +// @count - '//*[@id="main-content"]//*[@class="section-header"]' 2 +// @has - '//*[@id="main-content"]//*[@class="section-header"]' 'Traits' +// @has - '//*[@id="main-content"]//*[@class="section-header"]' 'Derive Macros' // Now checking the correct file is generated as well. // @has 'foo/derive.Clone.html' diff --git a/tests/rustdoc/inline-private-with-intermediate-doc-hidden.rs b/tests/rustdoc/inline-private-with-intermediate-doc-hidden.rs index e382940a47e..ae830c03ea3 100644 --- a/tests/rustdoc/inline-private-with-intermediate-doc-hidden.rs +++ b/tests/rustdoc/inline-private-with-intermediate-doc-hidden.rs @@ -6,8 +6,8 @@ // @has 'foo/index.html' // There should only be one struct displayed. -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' // @has - '//*[@id="main-content"]//a[@href="struct.Reexport.html"]' 'Reexport' // @has - '//*[@id="main-content"]//*[@class="desc docblock-short"]' 'Visible. Original.' diff --git a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs index 5d2c553d8a5..2905e7d44bc 100644 --- a/tests/rustdoc/issue-105735-overlapping-reexport-2.rs +++ b/tests/rustdoc/issue-105735-overlapping-reexport-2.rs @@ -7,9 +7,9 @@ // @has - '//*[@class="item-name"]/a[@class="type"]' 'AtomicU8' // @has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8' // We also ensure we don't have another item displayed. -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 2 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Aliases' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 2 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Type Aliases' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Constants' mod other { pub type AtomicU8 = (); diff --git a/tests/rustdoc/issue-105735-overlapping-reexport.rs b/tests/rustdoc/issue-105735-overlapping-reexport.rs index 50f2450b90a..7fa7df7701a 100644 --- a/tests/rustdoc/issue-105735-overlapping-reexport.rs +++ b/tests/rustdoc/issue-105735-overlapping-reexport.rs @@ -7,9 +7,9 @@ // @has - '//*[@class="item-name"]/a[@class="struct"]' 'AtomicU8' // @has - '//*[@class="item-name"]/a[@class="constant"]' 'AtomicU8' // We also ensure we don't have another item displayed. -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 2 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 2 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Constants' mod thing { pub use core::sync::atomic::AtomicU8; diff --git a/tests/rustdoc/issue-109258-missing-private-inlining.rs b/tests/rustdoc/issue-109258-missing-private-inlining.rs index 96f606368b2..12c5556f132 100644 --- a/tests/rustdoc/issue-109258-missing-private-inlining.rs +++ b/tests/rustdoc/issue-109258-missing-private-inlining.rs @@ -4,9 +4,9 @@ // @has 'foo/index.html' // We should only have a "Re-exports" and a "Modules" headers. -// @count - '//*[@id="main-content"]/h2[@class="small-section-header"]' 2 -// @has - '//*[@id="main-content"]/h2[@class="small-section-header"]' 'Re-exports' -// @has - '//*[@id="main-content"]/h2[@class="small-section-header"]' 'Modules' +// @count - '//*[@id="main-content"]/h2[@class="section-header"]' 2 +// @has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Re-exports' +// @has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Modules' // @has - '//*[@id="reexport.Foo"]' 'pub use crate::issue_109258::Foo;' // @has - '//*[@id="reexport.Foo"]//a[@href="issue_109258/struct.Foo.html"]' 'Foo' @@ -15,8 +15,8 @@ pub use crate::issue_109258::Foo; // @has 'foo/issue_109258/index.html' // We should only have a "Structs" header. -// @count - '//*[@id="main-content"]/h2[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/h2[@class="small-section-header"]' 'Structs' +// @count - '//*[@id="main-content"]/h2[@class="section-header"]' 1 +// @has - '//*[@id="main-content"]/h2[@class="section-header"]' 'Structs' // @has - '//*[@id="main-content"]//a[@href="struct.Foo.html"]' 'Foo' // @has 'foo/issue_109258/struct.Foo.html' pub mod issue_109258 { diff --git a/tests/rustdoc/issue-109449-doc-hidden-reexports.rs b/tests/rustdoc/issue-109449-doc-hidden-reexports.rs index 3b836a21931..9fb2f7c7c05 100644 --- a/tests/rustdoc/issue-109449-doc-hidden-reexports.rs +++ b/tests/rustdoc/issue-109449-doc-hidden-reexports.rs @@ -66,8 +66,8 @@ pub mod single_reexport_inherit_hidden { pub mod single_reexport_no_inline { // First we ensure that we only have re-exports and no inlined items. // @has 'foo/single_reexport_no_inline/index.html' - // @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports' + // @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Re-exports' // Now we check that we don't have links to the items, just `pub use`. // @has - '//*[@id="main-content"]//*' 'pub use crate::private_module::Public as XFoo;' @@ -101,10 +101,10 @@ pub mod glob_reexport { // With glob re-exports, we don't inline `#[doc(hidden)]` items so only `module` items // should be inlined. // @has 'foo/glob_reexport/index.html' - // @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3 - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports' - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Type Aliases' + // @count - '//*[@id="main-content"]/*[@class="section-header"]' 3 + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Re-exports' + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Type Aliases' // Now we check we have 1 re-export and 2 inlined items. // If not item from a glob re-export is visible, we don't show the re-export. diff --git a/tests/rustdoc/issue-110422-inner-private.rs b/tests/rustdoc/issue-110422-inner-private.rs index ee8ed5cc6e1..43dc929ab07 100644 --- a/tests/rustdoc/issue-110422-inner-private.rs +++ b/tests/rustdoc/issue-110422-inner-private.rs @@ -8,11 +8,11 @@ // @has 'foo/index.html' // Checking there is no "trait" entry. -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 4 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Constants' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Functions' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Macros' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 4 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Constants' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Functions' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Macros' // @has - '//a[@href="fn.foo.html"]' 'foo' fn foo() { @@ -50,11 +50,11 @@ const BAR: i32 = { // @has 'foo/struct.Bar.html' // @has - '//*[@id="method.foo"]/*[@class="code-header"]' 'pub(crate) fn foo()' - // @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3 + // @count - '//*[@id="main-content"]/*[@class="section-header"]' 3 // We now check that the `Foo` trait is not documented nor visible on `Bar` page. - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Implementations' - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Auto Trait Implementations' - // @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Blanket Implementations' + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Implementations' + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Auto Trait Implementations' + // @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Blanket Implementations' // @!has - '//*[@href="trait.Foo.html#method.babar"]/*[@class="code-header"]' 'fn babar()' impl Bar { fn foo() {} diff --git a/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs b/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs index 1429b5e4741..50def2c3cd9 100644 --- a/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs +++ b/tests/rustdoc/issue-60522-duplicated-glob-reexport.rs @@ -5,8 +5,8 @@ #![crate_name = "foo"] // @has 'foo/index.html' -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Modules' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Modules' // @count - '//*[@id="main-content"]/*[@class="item-table"]//*[@class="mod"]' 2 // @has - '//*[@id="main-content"]//*[@class="mod"]' 'banana' // @has - '//*[@id="main-content"]//*[@href="banana/index.html"]' 'banana' diff --git a/tests/rustdoc/nested-items-issue-111415.rs b/tests/rustdoc/nested-items-issue-111415.rs index 9b7688c332c..c117569d9b4 100644 --- a/tests/rustdoc/nested-items-issue-111415.rs +++ b/tests/rustdoc/nested-items-issue-111415.rs @@ -5,10 +5,10 @@ // @has 'foo/index.html' // Checking there are only three sections. -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 3 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Structs' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Functions' -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 3 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Structs' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Functions' +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Traits' // Checking that there are only three items. // @count - '//*[@id="main-content"]//*[@class="item-name"]' 3 // @has - '//*[@id="main-content"]//a[@href="struct.Bar.html"]' 'Bar' diff --git a/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs b/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs index d8953eaf597..ae0aead244b 100644 --- a/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs +++ b/tests/rustdoc/pub-reexport-of-pub-reexport-46506.rs @@ -4,8 +4,8 @@ #![crate_name = "foo"] // @has 'foo/associations/index.html' -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Traits' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Traits' // @has - '//*[@id="main-content"]//a[@href="trait.GroupedBy.html"]' 'GroupedBy' // @has 'foo/associations/trait.GroupedBy.html' pub mod associations { @@ -16,8 +16,8 @@ pub mod associations { } // @has 'foo/prelude/index.html' -// @count - '//*[@id="main-content"]/*[@class="small-section-header"]' 1 -// @has - '//*[@id="main-content"]/*[@class="small-section-header"]' 'Re-exports' +// @count - '//*[@id="main-content"]/*[@class="section-header"]' 1 +// @has - '//*[@id="main-content"]/*[@class="section-header"]' 'Re-exports' // @has - '//*[@id="main-content"]//*[@id="reexport.GroupedBy"]' 'pub use associations::GroupedBy;' pub mod prelude { pub use associations::GroupedBy; diff --git a/tests/rustdoc/typedef-inner-variants.rs b/tests/rustdoc/typedef-inner-variants.rs index b734714fd64..4d0ff85551c 100644 --- a/tests/rustdoc/typedef-inner-variants.rs +++ b/tests/rustdoc/typedef-inner-variants.rs @@ -65,7 +65,7 @@ pub union OneOr<A: Copy> { // @count - '//*[@id="aliased-type"]' 1 // @count - '//*[@id="variants"]' 0 // @count - '//*[@id="fields"]' 1 -// @count - '//*[@class="structfield small-section-header"]' 2 +// @count - '//*[@class="structfield section-header"]' 2 // @matches - '//pre[@class="rust item-decl"]//code' "union OneOrF64" pub type OneOrF64 = OneOr<f64>; @@ -81,7 +81,7 @@ pub struct One<T> { // @count - '//*[@id="aliased-type"]' 1 // @count - '//*[@id="variants"]' 0 // @count - '//*[@id="fields"]' 1 -// @count - '//*[@class="structfield small-section-header"]' 1 +// @count - '//*[@class="structfield section-header"]' 1 // @matches - '//pre[@class="rust item-decl"]//code' "struct OneU64" // @matches - '//pre[@class="rust item-decl"]//code' "pub val" pub type OneU64 = One<u64>; diff --git a/tests/ui/async-await/issue-70594.rs b/tests/ui/async-await/issue-70594.rs index 9e7c5847b3b..4c8209348b3 100644 --- a/tests/ui/async-await/issue-70594.rs +++ b/tests/ui/async-await/issue-70594.rs @@ -3,9 +3,6 @@ async fn fun() { [1; ().await]; //~^ error: `await` is only allowed inside `async` functions and blocks - //~| error: `.await` is not allowed in a `const` - //~| error: `.await` is not allowed in a `const` - //~| error: `()` is not a future } fn main() {} diff --git a/tests/ui/async-await/issue-70594.stderr b/tests/ui/async-await/issue-70594.stderr index 9866e00bb83..aed99ec3f1f 100644 --- a/tests/ui/async-await/issue-70594.stderr +++ b/tests/ui/async-await/issue-70594.stderr @@ -1,37 +1,12 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks --> $DIR/issue-70594.rs:4:12 | -LL | async fn fun() { - | --- this is not `async` LL | [1; ().await]; - | ^^^^^ only allowed inside `async` functions and blocks + | ---^^^^^ + | | | + | | only allowed inside `async` functions and blocks + | this is not `async` -error[E0744]: `.await` is not allowed in a `const` - --> $DIR/issue-70594.rs:4:9 - | -LL | [1; ().await]; - | ^^^^^^^^ - -error[E0744]: `.await` is not allowed in a `const` - --> $DIR/issue-70594.rs:4:12 - | -LL | [1; ().await]; - | ^^^^^ - -error[E0277]: `()` is not a future - --> $DIR/issue-70594.rs:4:12 - | -LL | [1; ().await]; - | -^^^^^ - | || - | |`()` is not a future - | help: remove the `.await` - | - = help: the trait `Future` is not implemented for `()` - = note: () must be a future or must implement `IntoFuture` to be awaited - = note: required for `()` to implement `IntoFuture` - -error: aborting due to 4 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0277, E0728, E0744. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0728`. diff --git a/tests/ui/async-await/issues/issue-62009-1.rs b/tests/ui/async-await/issues/issue-62009-1.rs index 40ccf25712e..51d216408d7 100644 --- a/tests/ui/async-await/issues/issue-62009-1.rs +++ b/tests/ui/async-await/issues/issue-62009-1.rs @@ -11,5 +11,4 @@ fn main() { //~^ ERROR `await` is only allowed inside `async` functions and blocks (|_| 2333).await; //~^ ERROR `await` is only allowed inside `async` functions and blocks - //~| ERROR is not a future } diff --git a/tests/ui/async-await/issues/issue-62009-1.stderr b/tests/ui/async-await/issues/issue-62009-1.stderr index bb617d09076..02933f4f2f2 100644 --- a/tests/ui/async-await/issues/issue-62009-1.stderr +++ b/tests/ui/async-await/issues/issue-62009-1.stderr @@ -24,20 +24,6 @@ LL | fn main() { LL | (|_| 2333).await; | ^^^^^ only allowed inside `async` functions and blocks -error[E0277]: `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future - --> $DIR/issue-62009-1.rs:12:16 - | -LL | (|_| 2333).await; - | -^^^^^ - | || - | |`{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` is not a future - | help: remove the `.await` - | - = help: the trait `Future` is not implemented for closure `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` - = note: {closure@$DIR/issue-62009-1.rs:12:6: 12:9} must be a future or must implement `IntoFuture` to be awaited - = note: required for `{closure@$DIR/issue-62009-1.rs:12:6: 12:9}` to implement `IntoFuture` - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0277, E0728. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0728`. diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr index 8221505b100..3ee89d9734a 100644 --- a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr +++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.stderr @@ -9,7 +9,7 @@ LL | let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3); LL | bar(x); | - borrow later used here | - = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used + = note: the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html> = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -24,7 +24,7 @@ LL | LL | bar(foo); | --- borrow later used here | - = note: the result of `format_args!` can only be assigned directly if no placeholders in it's arguments are used + = note: the result of `format_args!` can only be assigned directly if no placeholders in its arguments are used = note: to learn more, visit <https://doc.rust-lang.org/std/macro.format_args.html> = note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/const_prop/overwrite_with_const_with_params.rs b/tests/ui/const_prop/overwrite_with_const_with_params.rs new file mode 100644 index 00000000000..6f533919a47 --- /dev/null +++ b/tests/ui/const_prop/overwrite_with_const_with_params.rs @@ -0,0 +1,21 @@ +// compile-flags: -O +// run-pass + +// Regression test for https://github.com/rust-lang/rust/issues/118328 + +#![allow(unused_assignments)] + +struct SizeOfConst<T>(std::marker::PhantomData<T>); +impl<T> SizeOfConst<T> { + const SIZE: usize = std::mem::size_of::<T>(); +} + +fn size_of<T>() -> usize { + let mut a = 0; + a = SizeOfConst::<T>::SIZE; + a +} + +fn main() { + assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>()); +} diff --git a/tests/ui/coroutine/auxiliary/unwind-aux.rs b/tests/ui/coroutine/auxiliary/unwind-aux.rs new file mode 100644 index 00000000000..215d6769116 --- /dev/null +++ b/tests/ui/coroutine/auxiliary/unwind-aux.rs @@ -0,0 +1,11 @@ +// compile-flags: -Cpanic=unwind --crate-type=lib +// no-prefer-dynamic +// edition:2021 + +#![feature(coroutines)] +pub fn run<T>(a: T) { + let _ = move || { + drop(a); + yield; + }; +} diff --git a/tests/ui/coroutine/unwind-abort-mix.rs b/tests/ui/coroutine/unwind-abort-mix.rs new file mode 100644 index 00000000000..869b3e4f433 --- /dev/null +++ b/tests/ui/coroutine/unwind-abort-mix.rs @@ -0,0 +1,13 @@ +// Ensure that coroutine drop glue is valid when mixing different panic +// strategies. Regression test for #116953. +// +// no-prefer-dynamic +// build-pass +// aux-build:unwind-aux.rs +// compile-flags: -Cpanic=abort +// needs-unwind +extern crate unwind_aux; + +pub fn main() { + unwind_aux::run(String::new()); +} diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs index 590475fa03a..0331e75b2fe 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs +++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.rs @@ -29,7 +29,7 @@ mod x { mod y { use {Foo, Bar}; - #[rustc_then_this_would_need(typeck)] //~ ERROR OK + #[rustc_then_this_would_need(typeck)] //~ ERROR no path pub fn call_bar() { char::bar('a'); } diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr index 4e10437362c..08f382cc024 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr +++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr @@ -1,4 +1,4 @@ -error: OK +error: no path from `x::<impl Foo for char>` to `typeck` --> $DIR/dep-graph-trait-impl-two-traits.rs:32:5 | LL | #[rustc_then_this_would_need(typeck)] diff --git a/tests/ui/error-codes/E0458.stderr b/tests/ui/error-codes/E0458.stderr index e641bba541e..c13ae4e7862 100644 --- a/tests/ui/error-codes/E0458.stderr +++ b/tests/ui/error-codes/E0458.stderr @@ -1,4 +1,4 @@ -error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib +error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib, link-arg --> $DIR/E0458.rs:1:15 | LL | #[link(kind = "wonderful_unicorn")] extern "C" {} diff --git a/tests/ui/expr/if/bad-if-let-suggestion.rs b/tests/ui/expr/if/bad-if-let-suggestion.rs index 99d584ac7a5..b0d0676e1ea 100644 --- a/tests/ui/expr/if/bad-if-let-suggestion.rs +++ b/tests/ui/expr/if/bad-if-let-suggestion.rs @@ -1,6 +1,3 @@ -// FIXME(compiler-errors): This really should suggest `let` on the RHS of the -// `&&` operator, but that's kinda hard to do because of precedence. -// Instead, for now we just make sure not to suggest `if let let`. fn a() { if let x = 1 && i = 2 {} //~^ ERROR cannot find value `i` in this scope diff --git a/tests/ui/expr/if/bad-if-let-suggestion.stderr b/tests/ui/expr/if/bad-if-let-suggestion.stderr index 20ac9ca76ba..0d1f895bd82 100644 --- a/tests/ui/expr/if/bad-if-let-suggestion.stderr +++ b/tests/ui/expr/if/bad-if-let-suggestion.stderr @@ -1,19 +1,27 @@ error: expected expression, found `let` statement - --> $DIR/bad-if-let-suggestion.rs:5:8 + --> $DIR/bad-if-let-suggestion.rs:2:8 | LL | if let x = 1 && i = 2 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions +help: you might have meant to continue the let-chain + | +LL | if let x = 1 && let i = 2 {} + | +++ +help: you might have meant to compare for equality + | +LL | if let x = 1 && i == 2 {} + | + error[E0425]: cannot find value `i` in this scope - --> $DIR/bad-if-let-suggestion.rs:5:21 + --> $DIR/bad-if-let-suggestion.rs:2:21 | LL | if let x = 1 && i = 2 {} | ^ not found in this scope error[E0425]: cannot find value `i` in this scope - --> $DIR/bad-if-let-suggestion.rs:12:9 + --> $DIR/bad-if-let-suggestion.rs:9:9 | LL | fn a() { | ------ similarly named function `a` defined here @@ -22,7 +30,7 @@ LL | if (i + j) = i {} | ^ help: a function with a similar name exists: `a` error[E0425]: cannot find value `j` in this scope - --> $DIR/bad-if-let-suggestion.rs:12:13 + --> $DIR/bad-if-let-suggestion.rs:9:13 | LL | fn a() { | ------ similarly named function `a` defined here @@ -31,7 +39,7 @@ LL | if (i + j) = i {} | ^ help: a function with a similar name exists: `a` error[E0425]: cannot find value `i` in this scope - --> $DIR/bad-if-let-suggestion.rs:12:18 + --> $DIR/bad-if-let-suggestion.rs:9:18 | LL | fn a() { | ------ similarly named function `a` defined here @@ -40,7 +48,7 @@ LL | if (i + j) = i {} | ^ help: a function with a similar name exists: `a` error[E0425]: cannot find value `x` in this scope - --> $DIR/bad-if-let-suggestion.rs:19:8 + --> $DIR/bad-if-let-suggestion.rs:16:8 | LL | fn a() { | ------ similarly named function `a` defined here @@ -49,7 +57,7 @@ LL | if x[0] = 1 {} | ^ help: a function with a similar name exists: `a` error[E0308]: mismatched types - --> $DIR/bad-if-let-suggestion.rs:5:8 + --> $DIR/bad-if-let-suggestion.rs:2:8 | LL | if let x = 1 && i = 2 {} | ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` diff --git a/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs b/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs new file mode 100644 index 00000000000..9036095fbc4 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-link-arg-attribute.rs @@ -0,0 +1,5 @@ +#[link(kind = "link-arg", name = "foo")] +//~^ ERROR link kind `link-arg` is unstable +extern "C" {} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr b/tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr new file mode 100644 index 00000000000..673835b8b9e --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-link-arg-attribute.stderr @@ -0,0 +1,12 @@ +error[E0658]: link kind `link-arg` is unstable + --> $DIR/feature-gate-link-arg-attribute.rs:1:15 + | +LL | #[link(kind = "link-arg", name = "foo")] + | ^^^^^^^^^^ + | + = note: see issue #99427 <https://github.com/rust-lang/rust/issues/99427> for more information + = help: add `#![feature(link_arg_attribute)]` to the crate attributes to enable + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-never_patterns.rs b/tests/ui/feature-gates/feature-gate-never_patterns.rs new file mode 100644 index 00000000000..69e9f62abf0 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-never_patterns.rs @@ -0,0 +1,27 @@ +// Check that never patterns require the feature gate. +use std::ptr::NonNull; + +enum Void {} + +fn main() { + let res: Result<u32, Void> = Ok(0); + let (Ok(_x) | Err(&!)) = res.as_ref(); + //~^ ERROR `!` patterns are experimental + //~| ERROR: is not bound in all patterns + + unsafe { + let ptr: *const Void = NonNull::dangling().as_ptr(); + match *ptr { + ! => {} //~ ERROR `!` patterns are experimental + } + } + + // Check that the gate operates even behind `cfg`. + #[cfg(FALSE)] + unsafe { + let ptr: *const Void = NonNull::dangling().as_ptr(); + match *ptr { + ! => {} //~ ERROR `!` patterns are experimental + } + } +} diff --git a/tests/ui/feature-gates/feature-gate-never_patterns.stderr b/tests/ui/feature-gates/feature-gate-never_patterns.stderr new file mode 100644 index 00000000000..b7290eeb36d --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-never_patterns.stderr @@ -0,0 +1,39 @@ +error[E0408]: variable `_x` is not bound in all patterns + --> $DIR/feature-gate-never_patterns.rs:8:19 + | +LL | let (Ok(_x) | Err(&!)) = res.as_ref(); + | -- ^^^^^^^ pattern doesn't bind `_x` + | | + | variable not in all patterns + +error[E0658]: `!` patterns are experimental + --> $DIR/feature-gate-never_patterns.rs:8:24 + | +LL | let (Ok(_x) | Err(&!)) = res.as_ref(); + | ^ + | + = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information + = help: add `#![feature(never_patterns)]` to the crate attributes to enable + +error[E0658]: `!` patterns are experimental + --> $DIR/feature-gate-never_patterns.rs:15:13 + | +LL | ! => {} + | ^ + | + = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information + = help: add `#![feature(never_patterns)]` to the crate attributes to enable + +error[E0658]: `!` patterns are experimental + --> $DIR/feature-gate-never_patterns.rs:24:13 + | +LL | ! => {} + | ^ + | + = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information + = help: add `#![feature(never_patterns)]` to the crate attributes to enable + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0408, E0658. +For more information about an error, try `rustc --explain E0408`. diff --git a/tests/ui/generic-associated-types/bugs/issue-88382.stderr b/tests/ui/generic-associated-types/bugs/issue-88382.stderr index 624fe2799e0..9b061528e3b 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88382.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88382.stderr @@ -16,6 +16,10 @@ note: required by a bound in `do_something` | LL | fn do_something<I: Iterable>(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something` +help: consider wrapping the function in a closure + | +LL | do_something(SomeImplementation(), |arg0: &mut std::iter::Empty<usize>| test(/* &mut <_ as Iterable>::Iterator<'_> */)); + | ++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr index e6ff9d5a0df..bf91dc72cc1 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.stderr +++ b/tests/ui/intrinsics/const-eval-select-bad.stderr @@ -86,6 +86,10 @@ LL | const_eval_select((true,), foo, baz); found function signature `fn(i32) -> _` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | const_eval_select((true,), |arg0: bool| foo(/* i32 */), baz); + | ++++++++++++ +++++++++++ error: this argument must be a `const fn` --> $DIR/const-eval-select-bad.rs:42:29 diff --git a/tests/ui/invalid-compile-flags/function-return/requires-x86-or-x86_64.aarch64.stderr b/tests/ui/invalid-compile-flags/function-return/requires-x86-or-x86_64.aarch64.stderr new file mode 100644 index 00000000000..a4fe77f5cbb --- /dev/null +++ b/tests/ui/invalid-compile-flags/function-return/requires-x86-or-x86_64.aarch64.stderr @@ -0,0 +1,4 @@ +error: `-Zfunction-return` (except `keep`) is only supported on x86 and x86_64 + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/function-return/requires-x86-or-x86_64.rs b/tests/ui/invalid-compile-flags/function-return/requires-x86-or-x86_64.rs new file mode 100644 index 00000000000..15a88ebdb11 --- /dev/null +++ b/tests/ui/invalid-compile-flags/function-return/requires-x86-or-x86_64.rs @@ -0,0 +1,20 @@ +// revisions: x86 x86_64 aarch64 + +// compile-flags: -Zfunction-return=thunk-extern + +//[x86] check-pass +//[x86] needs-llvm-components: x86 +//[x86] compile-flags: --target i686-unknown-linux-gnu + +//[x86_64] check-pass +//[x86_64] needs-llvm-components: x86 +//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu + +//[aarch64] check-fail +//[aarch64] needs-llvm-components: aarch64 +//[aarch64] compile-flags: --target aarch64-unknown-linux-gnu +//[aarch64] error-pattern: `-Zfunction-return` (except `keep`) is only supported on x86 and x86_64 + +#![feature(no_core)] +#![no_core] +#![no_main] diff --git a/tests/ui/invalid-compile-flags/function-return/thunk-extern-requires-non-large-code-model.large.stderr b/tests/ui/invalid-compile-flags/function-return/thunk-extern-requires-non-large-code-model.large.stderr new file mode 100644 index 00000000000..683b3213d07 --- /dev/null +++ b/tests/ui/invalid-compile-flags/function-return/thunk-extern-requires-non-large-code-model.large.stderr @@ -0,0 +1,4 @@ +error: `-Zfunction-return=thunk-extern` is only supported on non-large code models + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/function-return/thunk-extern-requires-non-large-code-model.rs b/tests/ui/invalid-compile-flags/function-return/thunk-extern-requires-non-large-code-model.rs new file mode 100644 index 00000000000..f925905de36 --- /dev/null +++ b/tests/ui/invalid-compile-flags/function-return/thunk-extern-requires-non-large-code-model.rs @@ -0,0 +1,21 @@ +// revisions: small kernel medium large + +// needs-llvm-components: x86 +// compile-flags: --target x86_64-unknown-linux-gnu -Zfunction-return=thunk-extern + +//[small] check-pass +//[small] compile-flags: -Ccode-model=small + +//[kernel] check-pass +//[kernel] compile-flags: -Ccode-model=kernel + +//[medium] check-pass +//[medium] compile-flags: -Ccode-model=medium + +//[large] check-fail +//[large] compile-flags: -Ccode-model=large +//[large] error-pattern: `-Zfunction-return=thunk-extern` is only supported on non-large code models + +#![feature(no_core)] +#![no_core] +#![no_main] diff --git a/tests/ui/issues/issue-66706.stderr b/tests/ui/issues/issue-66706.stderr index 8a30c0cad39..ffdd61e7723 100644 --- a/tests/ui/issues/issue-66706.stderr +++ b/tests/ui/issues/issue-66706.stderr @@ -24,7 +24,9 @@ error: expected identifier, found reserved identifier `_` --> $DIR/issue-66706.rs:18:26 | LL | [0; match [|f @ &ref _| () ] {} ] - | ^ expected identifier, found reserved identifier + | ----- ^ expected identifier, found reserved identifier + | | + | while parsing this `match` expression error[E0282]: type annotations needed --> $DIR/issue-66706.rs:2:11 diff --git a/tests/ui/issues/issue-76077.stderr b/tests/ui/issues/issue-76077.stderr index 4c510e91ada..3fef5ffce30 100644 --- a/tests/ui/issues/issue-76077.stderr +++ b/tests/ui/issues/issue-76077.stderr @@ -4,7 +4,7 @@ error: cannot construct `Foo` with struct literal syntax due to private fields LL | foo::Foo {}; | ^^^^^^^^ | - = note: ... and other private field `you_cant_use_this_field` that was not provided + = note: private field `you_cant_use_this_field` that was not provided error: aborting due to 1 previous error diff --git a/tests/ui/lint/issue-103435-extra-parentheses.fixed b/tests/ui/lint/issue-103435-extra-parentheses.fixed index 2b01b414baa..74b5aa06e35 100644 --- a/tests/ui/lint/issue-103435-extra-parentheses.fixed +++ b/tests/ui/lint/issue-103435-extra-parentheses.fixed @@ -13,6 +13,5 @@ fn main() { // reported by parser for _x in 1..10 {} - //~^ ERROR expected one of - //~| ERROR unexpected parentheses surrounding + //~^ ERROR unexpected parentheses surrounding } diff --git a/tests/ui/lint/issue-103435-extra-parentheses.rs b/tests/ui/lint/issue-103435-extra-parentheses.rs index 8261610cf56..cc81a64f217 100644 --- a/tests/ui/lint/issue-103435-extra-parentheses.rs +++ b/tests/ui/lint/issue-103435-extra-parentheses.rs @@ -8,11 +8,10 @@ fn main() { for(_x)in 1..10 {} //~^ ERROR unnecessary parentheses around pattern - if(2 == 1){} + if(2 == 1) {} //~^ ERROR unnecessary parentheses around `if` condition // reported by parser - for(_x in 1..10){} - //~^ ERROR expected one of - //~| ERROR unexpected parentheses surrounding + for(_x in 1..10) {} + //~^ ERROR unexpected parentheses surrounding } diff --git a/tests/ui/lint/issue-103435-extra-parentheses.stderr b/tests/ui/lint/issue-103435-extra-parentheses.stderr index 29c41c91050..5a166eb5008 100644 --- a/tests/ui/lint/issue-103435-extra-parentheses.stderr +++ b/tests/ui/lint/issue-103435-extra-parentheses.stderr @@ -1,18 +1,12 @@ -error: expected one of `)`, `,`, `@`, or `|`, found keyword `in` - --> $DIR/issue-103435-extra-parentheses.rs:15:12 - | -LL | for(_x in 1..10){} - | ^^ expected one of `)`, `,`, `@`, or `|` - error: unexpected parentheses surrounding `for` loop head --> $DIR/issue-103435-extra-parentheses.rs:15:8 | -LL | for(_x in 1..10){} +LL | for(_x in 1..10) {} | ^ ^ | help: remove parentheses in `for` loop | -LL - for(_x in 1..10){} +LL - for(_x in 1..10) {} LL + for _x in 1..10 {} | @@ -48,14 +42,14 @@ LL + for _x in 1..10 {} error: unnecessary parentheses around `if` condition --> $DIR/issue-103435-extra-parentheses.rs:11:7 | -LL | if(2 == 1){} +LL | if(2 == 1) {} | ^ ^ | help: remove these parentheses | -LL - if(2 == 1){} +LL - if(2 == 1) {} LL + if 2 == 1 {} | -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 70ca00285c4..c0eb7f01fdb 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -11,6 +11,7 @@ #![feature(decl_macro)] #![feature(explicit_tail_calls)] #![feature(more_qualified_paths)] +#![feature(never_patterns)] #![feature(raw_ref_op)] #![feature(trait_alias)] #![feature(try_blocks)] @@ -635,6 +636,10 @@ fn test_pat() { // PatKind::Rest c1!(pat, [ .. ], ".."); + // PatKind::Never + c1!(pat, [ Some(!) ], "Some(!)"); + c1!(pat, [ None | Some(!) ], "None | Some(!)"); + // PatKind::Paren c1!(pat, [ (pat) ], "(pat)"); diff --git a/tests/ui/mismatched_types/E0631.stderr b/tests/ui/mismatched_types/E0631.stderr index 410ea4b0b34..9ba8f5035c5 100644 --- a/tests/ui/mismatched_types/E0631.stderr +++ b/tests/ui/mismatched_types/E0631.stderr @@ -48,6 +48,10 @@ note: required by a bound in `foo` | LL | fn foo<F: Fn(usize)>(_: F) {} | ^^^^^^^^^ required by this bound in `foo` +help: consider wrapping the function in a closure + | +LL | foo(|arg0: usize| f(/* u64 */)); + | +++++++++++++ +++++++++++ error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:10:9 @@ -67,6 +71,10 @@ note: required by a bound in `bar` | LL | fn bar<F: Fn<(usize,)>>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `bar` +help: consider wrapping the function in a closure + | +LL | bar(|arg0: usize| f(/* u64 */)); + | +++++++++++++ +++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/mismatched_types/closure-ref-114180.stderr b/tests/ui/mismatched_types/closure-ref-114180.stderr index 798c4e00aa7..27649822e69 100644 --- a/tests/ui/mismatched_types/closure-ref-114180.stderr +++ b/tests/ui/mismatched_types/closure-ref-114180.stderr @@ -12,6 +12,10 @@ LL | v.sort_by(compare); found closure signature `fn((_,), (_,)) -> _` note: required by a bound in `slice::<impl [T]>::sort_by` --> $SRC_DIR/alloc/src/slice.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | v.sort_by(|arg0, arg1| compare(*arg0, *arg1)); + | ++++++++++++ ++++++++++++++ help: consider adjusting the signature so it borrows its arguments | LL | let compare = |&(a,), &(e,)| todo!(); diff --git a/tests/ui/mismatched_types/fn-variance-1.stderr b/tests/ui/mismatched_types/fn-variance-1.stderr index 5794e606eeb..fdb2e6f0097 100644 --- a/tests/ui/mismatched_types/fn-variance-1.stderr +++ b/tests/ui/mismatched_types/fn-variance-1.stderr @@ -16,6 +16,10 @@ note: required by a bound in `apply` | LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { | ^^^^^^^^^ required by this bound in `apply` +help: consider wrapping the function in a closure + | +LL | apply(&3, |x| takes_mut(&mut *x)); + | +++ +++++++++ error[E0631]: type mismatch in function arguments --> $DIR/fn-variance-1.rs:15:19 @@ -35,6 +39,10 @@ note: required by a bound in `apply` | LL | fn apply<T, F>(t: T, f: F) where F: FnOnce(T) { | ^^^^^^^^^ required by this bound in `apply` +help: consider wrapping the function in a closure + | +LL | apply(&mut 3, |x| takes_imm(&*x)); + | +++ +++++ error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.fixed b/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.fixed new file mode 100644 index 00000000000..15d4e393874 --- /dev/null +++ b/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.fixed @@ -0,0 +1,20 @@ +// run-rustfix +#![allow(unused, dead_code)] + +#[derive(Clone, Copy)] +struct Stuff { + count: i32, +} +struct Error; + +fn demo() -> Result<Stuff, Error> { + let count = Ok(1); + Ok(Stuff { count: count? }) //~ ERROR mismatched types +} + +fn demo_unwrap() -> Stuff { + let count = Some(1); + Stuff { count: count.expect("REASON") } //~ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.rs b/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.rs new file mode 100644 index 00000000000..8e811caa3bd --- /dev/null +++ b/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.rs @@ -0,0 +1,20 @@ +// run-rustfix +#![allow(unused, dead_code)] + +#[derive(Clone, Copy)] +struct Stuff { + count: i32, +} +struct Error; + +fn demo() -> Result<Stuff, Error> { + let count = Ok(1); + Ok(Stuff { count }) //~ ERROR mismatched types +} + +fn demo_unwrap() -> Stuff { + let count = Some(1); + Stuff { count } //~ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.stderr b/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.stderr new file mode 100644 index 00000000000..0bcbd6f27c4 --- /dev/null +++ b/tests/ui/mismatched_types/issue-118145-unwrap-for-shorthand.stderr @@ -0,0 +1,29 @@ +error[E0308]: mismatched types + --> $DIR/issue-118145-unwrap-for-shorthand.rs:12:16 + | +LL | Ok(Stuff { count }) + | ^^^^^ expected `i32`, found `Result<{integer}, _>` + | + = note: expected type `i32` + found enum `Result<{integer}, _>` +help: use the `?` operator to extract the `Result<{integer}, _>` value, propagating a `Result::Err` value to the caller + | +LL | Ok(Stuff { count: count? }) + | ++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-118145-unwrap-for-shorthand.rs:17:13 + | +LL | Stuff { count } + | ^^^^^ expected `i32`, found `Option<{integer}>` + | + = note: expected type `i32` + found enum `Option<{integer}>` +help: consider using `Option::expect` to unwrap the `Option<{integer}>` value, panicking if the value is an `Option::None` + | +LL | Stuff { count: count.expect("REASON") } + | ++++++++++++++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.fixed b/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.fixed new file mode 100644 index 00000000000..e1f929e6170 --- /dev/null +++ b/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.fixed @@ -0,0 +1,77 @@ +// run-rustfix +// edition:2021 +#![allow(dead_code)] +#![allow(unused_variables)] +use std::future::Future; +use std::pin::Pin; + +fn test1() { + let string = String::from("Hello, world"); + + struct Demo<'a> { + option: Option<&'a str>, + } + + let option: Option<String> = Some(string.clone()); + let s = Demo { option: option.as_deref() }; //~ ERROR mismatched types +} + +fn test2() { + let string = String::from("Hello, world"); + + struct Demo<'a> { + option_ref: Option<&'a str>, + } + + let option_ref = Some(&string); + let s = Demo { option_ref: option_ref.map(|x| x.as_str()) }; //~ ERROR mismatched types +} + +fn test3() { + let string = String::from("Hello, world"); + + struct Demo<'a> { + option_ref_ref: Option<&'a str>, + } + + let option_ref = Some(&string); + let option_ref_ref = option_ref.as_ref(); + + let s = Demo { option_ref_ref: option_ref_ref.map(|x| x.as_str()) }; //~ ERROR mismatched types +} + +fn test4() { + let a = 1; + struct Demo { + a: String, + } + let s = Demo { a: a.to_string() }; //~ ERROR mismatched types +} + +type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>; +fn test5() { + let a = async { 42 }; + struct Demo { + a: BoxFuture<'static, i32>, + } + let s = Demo { a: Box::pin(a) }; //~ ERROR mismatched types +} + +fn test6() { + struct A; + struct B; + + impl From<B> for A { + fn from(_: B) -> Self { + A + } + } + + struct Demo { + a: A, + } + let a = B; + let s = Demo { a: a.into() }; //~ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.rs b/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.rs new file mode 100644 index 00000000000..956936c925b --- /dev/null +++ b/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.rs @@ -0,0 +1,77 @@ +// run-rustfix +// edition:2021 +#![allow(dead_code)] +#![allow(unused_variables)] +use std::future::Future; +use std::pin::Pin; + +fn test1() { + let string = String::from("Hello, world"); + + struct Demo<'a> { + option: Option<&'a str>, + } + + let option: Option<String> = Some(string.clone()); + let s = Demo { option }; //~ ERROR mismatched types +} + +fn test2() { + let string = String::from("Hello, world"); + + struct Demo<'a> { + option_ref: Option<&'a str>, + } + + let option_ref = Some(&string); + let s = Demo { option_ref }; //~ ERROR mismatched types +} + +fn test3() { + let string = String::from("Hello, world"); + + struct Demo<'a> { + option_ref_ref: Option<&'a str>, + } + + let option_ref = Some(&string); + let option_ref_ref = option_ref.as_ref(); + + let s = Demo { option_ref_ref }; //~ ERROR mismatched types +} + +fn test4() { + let a = 1; + struct Demo { + a: String, + } + let s = Demo { a }; //~ ERROR mismatched types +} + +type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>; +fn test5() { + let a = async { 42 }; + struct Demo { + a: BoxFuture<'static, i32>, + } + let s = Demo { a }; //~ ERROR mismatched types +} + +fn test6() { + struct A; + struct B; + + impl From<B> for A { + fn from(_: B) -> Self { + A + } + } + + struct Demo { + a: A, + } + let a = B; + let s = Demo { a }; //~ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.stderr b/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.stderr new file mode 100644 index 00000000000..1baf95d2bf7 --- /dev/null +++ b/tests/ui/mismatched_types/mismatch-sugg-for-shorthand-field.stderr @@ -0,0 +1,80 @@ +error[E0308]: mismatched types + --> $DIR/mismatch-sugg-for-shorthand-field.rs:16:20 + | +LL | let s = Demo { option }; + | ^^^^^^ expected `Option<&str>`, found `Option<String>` + | + = note: expected enum `Option<&str>` + found enum `Option<String>` +help: try using `: option.as_deref()` to convert `Option<String>` to `Option<&str>` + | +LL | let s = Demo { option: option.as_deref() }; + | +++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/mismatch-sugg-for-shorthand-field.rs:27:20 + | +LL | let s = Demo { option_ref }; + | ^^^^^^^^^^ expected `Option<&str>`, found `Option<&String>` + | + = note: expected enum `Option<&str>` + found enum `Option<&String>` +help: try converting the passed type into a `&str` + | +LL | let s = Demo { option_ref: option_ref.map(|x| x.as_str()) }; + | ++++++++++++++++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/mismatch-sugg-for-shorthand-field.rs:40:20 + | +LL | let s = Demo { option_ref_ref }; + | ^^^^^^^^^^^^^^ expected `Option<&str>`, found `Option<&&String>` + | + = note: expected enum `Option<&str>` + found enum `Option<&&String>` +help: try converting the passed type into a `&str` + | +LL | let s = Demo { option_ref_ref: option_ref_ref.map(|x| x.as_str()) }; + | ++++++++++++++++++++++++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/mismatch-sugg-for-shorthand-field.rs:48:20 + | +LL | let s = Demo { a }; + | ^ expected `String`, found integer + | +help: try using a conversion method + | +LL | let s = Demo { a: a.to_string() }; + | ++ ++++++++++++ + +error[E0308]: mismatched types + --> $DIR/mismatch-sugg-for-shorthand-field.rs:57:20 + | +LL | let a = async { 42 }; + | ------------ the found `async` block +... +LL | let s = Demo { a }; + | ^ expected `Pin<Box<...>>`, found `async` block + | + = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` + found `async` block `{async block@$DIR/mismatch-sugg-for-shorthand-field.rs:53:13: 53:25}` +help: you need to pin and box this expression + | +LL | let s = Demo { a: Box::pin(a) }; + | ++++++++++++ + + +error[E0308]: mismatched types + --> $DIR/mismatch-sugg-for-shorthand-field.rs:74:20 + | +LL | let s = Demo { a }; + | ^ expected `A`, found `B` + | +help: call `Into::into` on this expression to convert `B` into `A` + | +LL | let s = Demo { a: a.into() }; + | ++ +++++++ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr b/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr index 3db9803d58f..0ed57466e9c 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr +++ b/tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr @@ -13,6 +13,10 @@ LL | let _has_inference_vars: Option<i32> = Some(0).map(deref_int); found function signature `for<'a> fn(&'a i32) -> _` note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _has_inference_vars: Option<i32> = Some(0).map(|a| deref_int(&a)); + | +++ ++++ help: consider adjusting the signature so it does not borrow its argument | LL - fn deref_int(a: &i32) -> i32 { diff --git a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr index 3175a258906..1ac057a5f38 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr +++ b/tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr @@ -13,6 +13,10 @@ LL | let _ = produces_string().and_then(takes_str_but_too_many_refs); found function signature `for<'a, 'b> fn(&'a &'b str) -> _` note: required by a bound in `Option::<T>::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _ = produces_string().and_then(|arg0: String| takes_str_but_too_many_refs(/* &&str */)); + | ++++++++++++++ +++++++++++++ error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}` --> $DIR/suggest-option-asderef-unfixable.rs:26:40 @@ -68,6 +72,10 @@ LL | let _ = Some(TypeWithoutDeref).and_then(takes_str_but_too_many_refs); found function signature `for<'a, 'b> fn(&'a &'b str) -> _` note: required by a bound in `Option::<T>::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _ = Some(TypeWithoutDeref).and_then(|arg0: TypeWithoutDeref| takes_str_but_too_many_refs(/* &&str */)); + | ++++++++++++++++++++++++ +++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/mismatched_types/suggest-option-asderef.fixed b/tests/ui/mismatched_types/suggest-option-asderef.fixed deleted file mode 100644 index fc488b790b3..00000000000 --- a/tests/ui/mismatched_types/suggest-option-asderef.fixed +++ /dev/null @@ -1,39 +0,0 @@ -// run-rustfix - -fn produces_string() -> Option<String> { - Some("my cool string".to_owned()) -} - -fn takes_str(_: &str) -> Option<()> { - Some(()) -} - -fn takes_str_mut(_: &mut str) -> Option<()> { - Some(()) -} - -fn generic<T>(_: T) -> Option<()> { - Some(()) -} - -fn generic_ref<T>(_: T) -> Option<()> { - //~^ HELP consider adjusting the signature so it does not borrow its argument - Some(()) -} - -fn main() { - let _: Option<()> = produces_string().as_deref().and_then(takes_str); - //~^ ERROR type mismatch in function arguments - //~| HELP call `Option::as_deref()` first - let _: Option<Option<()>> = produces_string().as_deref().map(takes_str); - //~^ ERROR type mismatch in function arguments - //~| HELP call `Option::as_deref()` first - let _: Option<Option<()>> = produces_string().as_deref_mut().map(takes_str_mut); - //~^ ERROR type mismatch in function arguments - //~| HELP call `Option::as_deref_mut()` first - let _ = produces_string().and_then(generic); - - let _ = produces_string().as_deref().and_then(generic_ref); - //~^ ERROR type mismatch in function arguments - //~| HELP call `Option::as_deref()` first -} diff --git a/tests/ui/mismatched_types/suggest-option-asderef.rs b/tests/ui/mismatched_types/suggest-option-asderef.rs index 28f46808a39..5f5617e1741 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef.rs +++ b/tests/ui/mismatched_types/suggest-option-asderef.rs @@ -1,4 +1,4 @@ -// run-rustfix +// this isn't auto-fixable now because we produce two similar suggestions fn produces_string() -> Option<String> { Some("my cool string".to_owned()) @@ -25,15 +25,19 @@ fn main() { let _: Option<()> = produces_string().and_then(takes_str); //~^ ERROR type mismatch in function arguments //~| HELP call `Option::as_deref()` first + //~| HELP consider wrapping the function in a closure let _: Option<Option<()>> = produces_string().map(takes_str); //~^ ERROR type mismatch in function arguments //~| HELP call `Option::as_deref()` first + //~| HELP consider wrapping the function in a closure let _: Option<Option<()>> = produces_string().map(takes_str_mut); //~^ ERROR type mismatch in function arguments //~| HELP call `Option::as_deref_mut()` first + //~| HELP consider wrapping the function in a closure let _ = produces_string().and_then(generic); let _ = produces_string().and_then(generic_ref); //~^ ERROR type mismatch in function arguments //~| HELP call `Option::as_deref()` first + //~| HELP consider wrapping the function in a closure } diff --git a/tests/ui/mismatched_types/suggest-option-asderef.stderr b/tests/ui/mismatched_types/suggest-option-asderef.stderr index bfea0867350..1702a7f1dec 100644 --- a/tests/ui/mismatched_types/suggest-option-asderef.stderr +++ b/tests/ui/mismatched_types/suggest-option-asderef.stderr @@ -13,13 +13,17 @@ LL | let _: Option<()> = produces_string().and_then(takes_str); found function signature `for<'a> fn(&'a str) -> _` note: required by a bound in `Option::<T>::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _: Option<()> = produces_string().and_then(|arg0: String| takes_str(/* &str */)); + | ++++++++++++++ ++++++++++++ help: call `Option::as_deref()` first | LL | let _: Option<()> = produces_string().as_deref().and_then(takes_str); | +++++++++++ error[E0631]: type mismatch in function arguments - --> $DIR/suggest-option-asderef.rs:28:55 + --> $DIR/suggest-option-asderef.rs:29:55 | LL | fn takes_str(_: &str) -> Option<()> { | ----------------------------------- found signature defined here @@ -33,13 +37,17 @@ LL | let _: Option<Option<()>> = produces_string().map(takes_str); found function signature `for<'a> fn(&'a str) -> _` note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _: Option<Option<()>> = produces_string().map(|arg0: String| takes_str(/* &str */)); + | ++++++++++++++ ++++++++++++ help: call `Option::as_deref()` first | LL | let _: Option<Option<()>> = produces_string().as_deref().map(takes_str); | +++++++++++ error[E0631]: type mismatch in function arguments - --> $DIR/suggest-option-asderef.rs:31:55 + --> $DIR/suggest-option-asderef.rs:33:55 | LL | fn takes_str_mut(_: &mut str) -> Option<()> { | ------------------------------------------- found signature defined here @@ -53,13 +61,17 @@ LL | let _: Option<Option<()>> = produces_string().map(takes_str_mut); found function signature `for<'a> fn(&'a mut str) -> _` note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _: Option<Option<()>> = produces_string().map(|arg0: String| takes_str_mut(/* &mut str */)); + | ++++++++++++++ ++++++++++++++++ help: call `Option::as_deref_mut()` first | LL | let _: Option<Option<()>> = produces_string().as_deref_mut().map(takes_str_mut); | +++++++++++++++ error[E0631]: type mismatch in function arguments - --> $DIR/suggest-option-asderef.rs:36:40 + --> $DIR/suggest-option-asderef.rs:39:40 | LL | fn generic_ref<T>(_: &T) -> Option<()> { | -------------------------------------- found signature defined here @@ -73,6 +85,10 @@ LL | let _ = produces_string().and_then(generic_ref); found function signature `for<'a> fn(&'a _) -> _` note: required by a bound in `Option::<T>::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | let _ = produces_string().and_then(|arg0: String| generic_ref(&arg0)); + | ++++++++++++++ +++++++ help: consider adjusting the signature so it does not borrow its argument | LL - fn generic_ref<T>(_: &T) -> Option<()> { diff --git a/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index a900a49c710..d92d5dbd16f 100644 --- a/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/tests/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -16,6 +16,10 @@ note: required by a bound in `call_it` | LL | fn call_it<F: FnMut(isize, isize) -> isize>(y: isize, mut f: F) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it` +help: consider wrapping the function in a closure + | +LL | let z = call_it(3, |arg0: isize, arg1: isize| f(/* usize */, arg1)); + | ++++++++++++++++++++++++++ +++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.rs b/tests/ui/native-library-link-flags/link-arg-from-rs.rs index 075e4d9e79e..4a6017fea33 100644 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.rs +++ b/tests/ui/native-library-link-flags/link-arg-from-rs.rs @@ -1,8 +1,7 @@ -// link-arg is not supposed to be usable in #[link] attributes +#![feature(link_arg_attribute)] -// compile-flags: -// error-pattern: error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib - -#[link(kind = "link-arg")] +#[link(kind = "link-arg", name = "arg", modifiers = "+bundle")] +//~^ ERROR linking modifier `bundle` is only compatible with `static` linking kind extern "C" {} + pub fn main() {} diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr b/tests/ui/native-library-link-flags/link-arg-from-rs.stderr index 69a7825c0b1..f31e15f1da6 100644 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr +++ b/tests/ui/native-library-link-flags/link-arg-from-rs.stderr @@ -1,16 +1,8 @@ -error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib - --> $DIR/link-arg-from-rs.rs:6:15 +error: linking modifier `bundle` is only compatible with `static` linking kind + --> $DIR/link-arg-from-rs.rs:3:53 | -LL | #[link(kind = "link-arg")] - | ^^^^^^^^^^ unknown link kind +LL | #[link(kind = "link-arg", name = "arg", modifiers = "+bundle")] + | ^^^^^^^^^ -error[E0459]: `#[link]` attribute requires a `name = "string"` argument - --> $DIR/link-arg-from-rs.rs:6:1 - | -LL | #[link(kind = "link-arg")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0458, E0459. -For more information about an error, try `rustc --explain E0458`. diff --git a/tests/ui/numbers-arithmetic/location-add-assign-overflow.rs b/tests/ui/numbers-arithmetic/location-add-assign-overflow.rs new file mode 100644 index 00000000000..2c4bdad3e91 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-add-assign-overflow.rs @@ -0,0 +1,8 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-add-assign-overflow.rs + +fn main() { + let mut a: u8 = 255; + a += &1; +} diff --git a/tests/ui/numbers-arithmetic/location-add-overflow.rs b/tests/ui/numbers-arithmetic/location-add-overflow.rs new file mode 100644 index 00000000000..085623c9bf7 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-add-overflow.rs @@ -0,0 +1,7 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-add-overflow.rs + +fn main() { + let _: u8 = 255 + &1; +} diff --git a/tests/ui/numbers-arithmetic/location-divide-assign-by-zero.rs b/tests/ui/numbers-arithmetic/location-divide-assign-by-zero.rs new file mode 100644 index 00000000000..21b5e7a8110 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-divide-assign-by-zero.rs @@ -0,0 +1,8 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-divide-assign-by-zero.rs + +fn main() { + let mut a = 1; + a /= &0; +} diff --git a/tests/ui/numbers-arithmetic/location-divide-by-zero.rs b/tests/ui/numbers-arithmetic/location-divide-by-zero.rs new file mode 100644 index 00000000000..7d045fc5602 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-divide-by-zero.rs @@ -0,0 +1,9 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-divide-by-zero.rs + +// https://github.com/rust-lang/rust/issues/114814 + +fn main() { + let _ = 1 / &0; +} diff --git a/tests/ui/numbers-arithmetic/location-mod-assign-by-zero.rs b/tests/ui/numbers-arithmetic/location-mod-assign-by-zero.rs new file mode 100644 index 00000000000..88d602e4b6d --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-mod-assign-by-zero.rs @@ -0,0 +1,8 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-mod-assign-by-zero.rs + +fn main() { + let mut a = 1; + a %= &0; +} diff --git a/tests/ui/numbers-arithmetic/location-mod-by-zero.rs b/tests/ui/numbers-arithmetic/location-mod-by-zero.rs new file mode 100644 index 00000000000..4397adb75d1 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-mod-by-zero.rs @@ -0,0 +1,7 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-mod-by-zero.rs + +fn main() { + let _ = 1 % &0; +} diff --git a/tests/ui/numbers-arithmetic/location-mul-assign-overflow.rs b/tests/ui/numbers-arithmetic/location-mul-assign-overflow.rs new file mode 100644 index 00000000000..b042751ded9 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-mul-assign-overflow.rs @@ -0,0 +1,8 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-mul-assign-overflow.rs + +fn main() { + let mut a: u8 = 255; + a *= &2; +} diff --git a/tests/ui/numbers-arithmetic/location-mul-overflow.rs b/tests/ui/numbers-arithmetic/location-mul-overflow.rs new file mode 100644 index 00000000000..6dd58874874 --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-mul-overflow.rs @@ -0,0 +1,7 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-mul-overflow.rs + +fn main() { + let _: u8 = 255 * &2; +} diff --git a/tests/ui/numbers-arithmetic/location-sub-assign-overflow.rs b/tests/ui/numbers-arithmetic/location-sub-assign-overflow.rs new file mode 100644 index 00000000000..5b92ada2e0b --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-sub-assign-overflow.rs @@ -0,0 +1,8 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-sub-assign-overflow.rs + +fn main() { + let mut a: u8 = 0; + a -= &1; +} diff --git a/tests/ui/numbers-arithmetic/location-sub-overflow.rs b/tests/ui/numbers-arithmetic/location-sub-overflow.rs new file mode 100644 index 00000000000..2d77cb8f55e --- /dev/null +++ b/tests/ui/numbers-arithmetic/location-sub-overflow.rs @@ -0,0 +1,7 @@ +// run-fail +// ignore-wasm32 +// error-pattern:location-sub-overflow.rs + +fn main() { + let _: u8 = 0 - &1; +} diff --git a/tests/ui/parser/issues/issue-68890.stderr b/tests/ui/parser/issues/issue-68890.stderr index 0d7b53a67c5..43ed69dcf24 100644 --- a/tests/ui/parser/issues/issue-68890.stderr +++ b/tests/ui/parser/issues/issue-68890.stderr @@ -8,7 +8,11 @@ error: expected one of `)`, `+`, or `,`, found `a` --> $DIR/issue-68890.rs:1:15 | LL | enum e{A((?'a a+?+l))} - | ^ expected one of `)`, `+`, or `,` + | - ^ expected one of `)`, `+`, or `,` + | | + | while parsing this enum + | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` error: expected item, found `)` --> $DIR/issue-68890.rs:1:21 diff --git a/tests/ui/parser/mut-patterns.rs b/tests/ui/parser/mut-patterns.rs index 8b83d6ab2f8..f2d2df0af29 100644 --- a/tests/ui/parser/mut-patterns.rs +++ b/tests/ui/parser/mut-patterns.rs @@ -27,7 +27,7 @@ pub fn main() { struct r#yield(u8, u8); let mut mut yield(become, await) = r#yield(0, 0); //~^ ERROR `mut` on a binding may not be repeated - //~| ERROR `mut` must be attached to each individual binding + //~| ERROR `mut` must be followed by a named binding //~| ERROR expected identifier, found reserved keyword `yield` //~| ERROR expected identifier, found reserved keyword `become` //~| ERROR expected identifier, found keyword `await` diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index 66985c9f5e4..6559cf09cdf 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -83,11 +83,11 @@ help: escape `await` to use it as an identifier LL | let mut mut yield(become, r#await) = r#yield(0, 0); | ++ -error: `mut` must be attached to each individual binding +error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:28:9 | LL | let mut mut yield(become, await) = r#yield(0, 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `r#yield(mut r#become, mut r#await)` + | ^^^^^^^^ help: remove the `mut` prefix | = note: `mut` may be followed by `variable` and `variable @ pattern` diff --git a/tests/ui/parser/issues/issue-104088.rs b/tests/ui/parser/recover/binding-name-starting-with-number.rs index 3dc636b6a33..6b279c5539e 100644 --- a/tests/ui/parser/issues/issue-104088.rs +++ b/tests/ui/parser/recover/binding-name-starting-with-number.rs @@ -8,10 +8,12 @@ fn 1234test() { let 23name = 123; //~^ ERROR expected identifier, found `23name` - +} +fn foo() { let 2x: i32 = 123; //~^ ERROR expected identifier, found `2x` - +} +fn bar() { let 1x = 123; //~^ ERROR expected identifier, found `1x` } diff --git a/tests/ui/parser/issues/issue-104088.stderr b/tests/ui/parser/recover/binding-name-starting-with-number.stderr index 8b751759d69..de59a7de043 100644 --- a/tests/ui/parser/issues/issue-104088.stderr +++ b/tests/ui/parser/recover/binding-name-starting-with-number.stderr @@ -1,53 +1,53 @@ error: expected identifier, found `1234test` - --> $DIR/issue-104088.rs:1:4 + --> $DIR/binding-name-starting-with-number.rs:1:4 | LL | fn 1234test() { | ^^^^^^^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:1:4 + --> $DIR/binding-name-starting-with-number.rs:1:4 | LL | fn 1234test() { | ^^^^ error: expected identifier, found `23name` - --> $DIR/issue-104088.rs:9:9 + --> $DIR/binding-name-starting-with-number.rs:9:9 | LL | let 23name = 123; | ^^^^^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:9:9 + --> $DIR/binding-name-starting-with-number.rs:9:9 | LL | let 23name = 123; | ^^ error: expected identifier, found `2x` - --> $DIR/issue-104088.rs:12:9 + --> $DIR/binding-name-starting-with-number.rs:13:9 | LL | let 2x: i32 = 123; | ^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:12:9 + --> $DIR/binding-name-starting-with-number.rs:13:9 | LL | let 2x: i32 = 123; | ^ error: expected identifier, found `1x` - --> $DIR/issue-104088.rs:15:9 + --> $DIR/binding-name-starting-with-number.rs:17:9 | LL | let 1x = 123; | ^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:15:9 + --> $DIR/binding-name-starting-with-number.rs:17:9 | LL | let 1x = 123; | ^ error[E0308]: mismatched types - --> $DIR/issue-104088.rs:5:12 + --> $DIR/binding-name-starting-with-number.rs:5:12 | LL | if let 2e1 = 123 { | ^^^ --- this expression has type `{integer}` diff --git a/tests/ui/parser/recover/recover-enum2.rs b/tests/ui/parser/recover/recover-enum2.rs index 0c942088955..56b57f625ba 100644 --- a/tests/ui/parser/recover/recover-enum2.rs +++ b/tests/ui/parser/recover/recover-enum2.rs @@ -8,7 +8,7 @@ fn main() { } // recover... - let a = 1; + let () = 1; //~ ERROR mismatched types enum Test2 { Fine, } @@ -24,5 +24,6 @@ fn main() { enum Test4 { Nope(i32 {}) //~ ERROR: found `{` } + let () = 1; //~ ERROR mismatched types } } diff --git a/tests/ui/parser/recover/recover-enum2.stderr b/tests/ui/parser/recover/recover-enum2.stderr index 7634bca921c..132f84cc76b 100644 --- a/tests/ui/parser/recover/recover-enum2.stderr +++ b/tests/ui/parser/recover/recover-enum2.stderr @@ -9,8 +9,29 @@ LL | abc: {}, error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` --> $DIR/recover-enum2.rs:25:22 | +LL | enum Test4 { + | ----- while parsing this enum LL | Nope(i32 {}) | ^ expected one of 7 possible tokens + | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` + +error[E0308]: mismatched types + --> $DIR/recover-enum2.rs:11:9 + | +LL | let () = 1; + | ^^ - this expression has type `{integer}` + | | + | expected integer, found `()` + +error[E0308]: mismatched types + --> $DIR/recover-enum2.rs:27:13 + | +LL | let () = 1; + | ^^ - this expression has type `{integer}` + | | + | expected integer, found `()` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.fixed b/tests/ui/parser/recover/recover-for-loop-parens-around-head.fixed new file mode 100644 index 00000000000..6afc2d99355 --- /dev/null +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.fixed @@ -0,0 +1,15 @@ +// run-rustfix +// Here we test that the parser is able to recover in a situation like +// `for ( $pat in $expr )` since that is familiar syntax in other languages. +// Instead we suggest that the user writes `for $pat in $expr`. + +#![deny(unused)] // Make sure we don't trigger `unused_parens`. + +fn main() { + let vec = vec![1, 2, 3]; + + for _elem in vec { + //~^ ERROR unexpected parentheses surrounding `for` loop head + const _RECOVERY_WITNESS: u32 = 0u32; //~ ERROR mismatched types + } +} diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.rs b/tests/ui/parser/recover/recover-for-loop-parens-around-head.rs index 053b428bd12..b1716900c49 100644 --- a/tests/ui/parser/recover/recover-for-loop-parens-around-head.rs +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.rs @@ -1,3 +1,4 @@ +// run-rustfix // Here we test that the parser is able to recover in a situation like // `for ( $pat in $expr )` since that is familiar syntax in other languages. // Instead we suggest that the user writes `for $pat in $expr`. @@ -7,9 +8,8 @@ fn main() { let vec = vec![1, 2, 3]; - for ( elem in vec ) { - //~^ ERROR expected one of `)`, `,`, `@`, or `|`, found keyword `in` - //~| ERROR unexpected parentheses surrounding `for` loop head - const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types + for ( _elem in vec ) { + //~^ ERROR unexpected parentheses surrounding `for` loop head + const _RECOVERY_WITNESS: u32 = 0u8; //~ ERROR mismatched types } } diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr index 3bad29f20af..beaa346e76c 100644 --- a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr @@ -1,27 +1,26 @@ -error: expected one of `)`, `,`, `@`, or `|`, found keyword `in` - --> $DIR/recover-for-loop-parens-around-head.rs:10:16 - | -LL | for ( elem in vec ) { - | ^^ expected one of `)`, `,`, `@`, or `|` - error: unexpected parentheses surrounding `for` loop head - --> $DIR/recover-for-loop-parens-around-head.rs:10:9 + --> $DIR/recover-for-loop-parens-around-head.rs:11:9 | -LL | for ( elem in vec ) { - | ^ ^ +LL | for ( _elem in vec ) { + | ^ ^ | help: remove parentheses in `for` loop | -LL - for ( elem in vec ) { -LL + for elem in vec { +LL - for ( _elem in vec ) { +LL + for _elem in vec { | error[E0308]: mismatched types - --> $DIR/recover-for-loop-parens-around-head.rs:13:38 + --> $DIR/recover-for-loop-parens-around-head.rs:13:40 + | +LL | const _RECOVERY_WITNESS: u32 = 0u8; + | ^^^ expected `u32`, found `u8` + | +help: change the type of the numeric literal from `u8` to `u32` | -LL | const RECOVERY_WITNESS: () = 0; - | ^ expected `()`, found integer +LL | const _RECOVERY_WITNESS: u32 = 0u32; + | ~~~ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed new file mode 100644 index 00000000000..6b9b7fa882a --- /dev/null +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + let val = 42; + let x = match val { + 0 if true => { + //~^ ERROR unexpected parentheses surrounding `match` arm pattern + 42u8 + } + _ => 0u8, + }; + let _y: u32 = x.into(); //~ ERROR mismatched types +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs index 9ed733bf079..f523581e2da 100644 --- a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs @@ -1,11 +1,9 @@ +// run-rustfix fn main() { let val = 42; let x = match val { (0 if true) => { - //~^ ERROR expected identifier, found keyword `if` - //~| ERROR expected one of `)`, `,`, `...`, `..=`, `..`, or `|`, found keyword `if` - //~| ERROR expected one of `)`, `,`, `@`, or `|`, found keyword `true` - //~| ERROR mismatched types + //~^ ERROR unexpected parentheses surrounding `match` arm pattern 42u8 } _ => 0u8, diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr index 6542f440e4b..bad4d7d2f19 100644 --- a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr @@ -1,38 +1,17 @@ -error: expected identifier, found keyword `if` - --> $DIR/recover-parens-around-match-arm-head.rs:4:12 +error: unexpected parentheses surrounding `match` arm pattern + --> $DIR/recover-parens-around-match-arm-head.rs:5:9 | LL | (0 if true) => { - | ^^ expected identifier, found keyword - -error: expected one of `)`, `,`, `...`, `..=`, `..`, or `|`, found keyword `if` - --> $DIR/recover-parens-around-match-arm-head.rs:4:12 - | -LL | (0 if true) => { - | -^^ expected one of `)`, `,`, `...`, `..=`, `..`, or `|` - | | - | help: missing `,` - -error: expected one of `)`, `,`, `@`, or `|`, found keyword `true` - --> $DIR/recover-parens-around-match-arm-head.rs:4:15 + | ^ ^ | -LL | (0 if true) => { - | -^^^^ expected one of `)`, `,`, `@`, or `|` - | | - | help: missing `,` - -error[E0308]: mismatched types - --> $DIR/recover-parens-around-match-arm-head.rs:4:9 +help: remove parentheses surrounding the pattern | -LL | let x = match val { - | --- this expression has type `{integer}` -LL | (0 if true) => { - | ^^^^^^^^^^^ expected integer, found `(_, _, _)` +LL - (0 if true) => { +LL + 0 if true => { | - = note: expected type `{integer}` - found tuple `(_, _, _)` error[E0308]: mismatched types - --> $DIR/recover-parens-around-match-arm-head.rs:13:19 + --> $DIR/recover-parens-around-match-arm-head.rs:11:19 | LL | let _y: u32 = x; | --- ^ expected `u32`, found `u8` @@ -44,6 +23,6 @@ help: you can convert a `u8` to a `u32` LL | let _y: u32 = x.into(); | +++++++ -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/never_patterns.rs b/tests/ui/pattern/never_patterns.rs new file mode 100644 index 00000000000..e2e17e0e9a7 --- /dev/null +++ b/tests/ui/pattern/never_patterns.rs @@ -0,0 +1,99 @@ +#![feature(never_patterns)] +#![allow(incomplete_features)] + +enum Void {} + +fn main() {} + +// The classic use for empty types. +fn safe_unwrap_result<T>(res: Result<T, Void>) { + let Ok(_x) = res; + // FIXME(never_patterns): These should be allowed + let (Ok(_x) | Err(!)) = &res; + //~^ ERROR: is not bound in all patterns + let (Ok(_x) | Err(&!)) = res.as_ref(); + //~^ ERROR: is not bound in all patterns +} + +// Check we only accept `!` where we want to. +fn never_pattern_location(void: Void) { + // FIXME(never_patterns): Don't accept on a non-empty type. + match Some(0) { + None => {} + Some(!) => {} + } + // FIXME(never_patterns): Don't accept on an arbitrary type, even if there are no more branches. + match () { + () => {} + ! => {} + } + // FIXME(never_patterns): Don't accept even on an empty branch. + match None::<Void> { + None => {} + ! => {} + } + // FIXME(never_patterns): Let alone if the emptiness is behind a reference. + match None::<&Void> { + None => {} + ! => {} + } + // Participate in match ergonomics. + match &void { + ! => {} + } + match &&void { + ! => {} + } + match &&void { + &! => {} + } + match &None::<Void> { + None => {} + Some(!) => {} + } + match None::<&Void> { + None => {} + Some(!) => {} + } + // Accept on a composite empty type. + match None::<&(u32, Void)> { + None => {} + Some(&!) => {} + } + // Accept on an simple empty type. + match None::<Void> { + None => {} + Some(!) => {} + } + match None::<&Void> { + None => {} + Some(&!) => {} + } + match None::<&(u32, Void)> { + None => {} + Some(&(_, !)) => {} + } +} + +fn never_and_bindings() { + let x: Result<bool, &(u32, Void)> = Ok(false); + + // FIXME(never_patterns): Never patterns in or-patterns don't need to share the same bindings. + match x { + Ok(_x) | Err(&!) => {} + //~^ ERROR: is not bound in all patterns + } + let (Ok(_x) | Err(&!)) = x; + //~^ ERROR: is not bound in all patterns + + // FIXME(never_patterns): A never pattern mustn't have bindings. + match x { + Ok(_) => {} + Err(&(_b, !)) => {} + } + match x { + Ok(_a) | Err(&(_b, !)) => {} + //~^ ERROR: is not bound in all patterns + //~| ERROR: is not bound in all patterns + } +} diff --git a/tests/ui/pattern/never_patterns.stderr b/tests/ui/pattern/never_patterns.stderr new file mode 100644 index 00000000000..11e50debfd3 --- /dev/null +++ b/tests/ui/pattern/never_patterns.stderr @@ -0,0 +1,51 @@ +error[E0408]: variable `_x` is not bound in all patterns + --> $DIR/never_patterns.rs:12:19 + | +LL | let (Ok(_x) | Err(!)) = &res; + | -- ^^^^^^ pattern doesn't bind `_x` + | | + | variable not in all patterns + +error[E0408]: variable `_x` is not bound in all patterns + --> $DIR/never_patterns.rs:14:19 + | +LL | let (Ok(_x) | Err(&!)) = res.as_ref(); + | -- ^^^^^^^ pattern doesn't bind `_x` + | | + | variable not in all patterns + +error[E0408]: variable `_x` is not bound in all patterns + --> $DIR/never_patterns.rs:83:18 + | +LL | Ok(_x) | Err(&!) => {} + | -- ^^^^^^^ pattern doesn't bind `_x` + | | + | variable not in all patterns + +error[E0408]: variable `_x` is not bound in all patterns + --> $DIR/never_patterns.rs:86:19 + | +LL | let (Ok(_x) | Err(&!)) = x; + | -- ^^^^^^^ pattern doesn't bind `_x` + | | + | variable not in all patterns + +error[E0408]: variable `_b` is not bound in all patterns + --> $DIR/never_patterns.rs:95:9 + | +LL | Ok(_a) | Err(&(_b, !)) => {} + | ^^^^^^ -- variable not in all patterns + | | + | pattern doesn't bind `_b` + +error[E0408]: variable `_a` is not bound in all patterns + --> $DIR/never_patterns.rs:95:18 + | +LL | Ok(_a) | Err(&(_b, !)) => {} + | -- ^^^^^^^^^^^^^ pattern doesn't bind `_a` + | | + | variable not in all patterns + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0408`. diff --git a/tests/ui/privacy/issue-79593.stderr b/tests/ui/privacy/issue-79593.stderr index 21ba760ad0b..5bb69836f60 100644 --- a/tests/ui/privacy/issue-79593.stderr +++ b/tests/ui/privacy/issue-79593.stderr @@ -16,7 +16,7 @@ error: cannot construct `Pub` with struct literal syntax due to private fields LL | foo::Pub {}; | ^^^^^^^^ | - = note: ... and other private field `private` that was not provided + = note: private field `private` that was not provided error[E0063]: missing field `y` in initializer of `Enum` --> $DIR/issue-79593.rs:23:5 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 2224f1c60d6..8b01e8c3c10 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -56,7 +56,7 @@ error: cannot construct `HashMap<_, _, _>` with struct literal syntax due to pri LL | let _ = std::collections::HashMap {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: ... and other private field `base` that was not provided + = note: private field `base` that was not provided help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); @@ -78,7 +78,7 @@ error: cannot construct `Box<_, _>` with struct literal syntax due to private fi LL | let _ = Box {}; | ^^^ | - = note: ... and other private fields `0` and `1` that were not provided + = note: private fields `0` and `1` that were not provided help: you might have meant to use an associated function to build this type | LL | let _ = Box::new(_); diff --git a/tests/ui/resolve/resolve-dont-hint-macro.rs b/tests/ui/resolve/resolve-dont-hint-macro.rs new file mode 100644 index 00000000000..da1752b337e --- /dev/null +++ b/tests/ui/resolve/resolve-dont-hint-macro.rs @@ -0,0 +1,4 @@ +fn main() { + let zero = assert_eq::<()>(); + //~^ ERROR expected function, found macro `assert_eq` +} diff --git a/tests/ui/resolve/resolve-dont-hint-macro.stderr b/tests/ui/resolve/resolve-dont-hint-macro.stderr new file mode 100644 index 00000000000..597e014d255 --- /dev/null +++ b/tests/ui/resolve/resolve-dont-hint-macro.stderr @@ -0,0 +1,9 @@ +error[E0423]: expected function, found macro `assert_eq` + --> $DIR/resolve-dont-hint-macro.rs:2:16 + | +LL | let zero = assert_eq::<()>(); + | ^^^^^^^^^^^^^^^ not a function + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr index 0ef7b8b09f1..cabc475fa61 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr @@ -1,83 +1,115 @@ error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:23:5 + --> $DIR/safe-calls.rs:28:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:26:5 + --> $DIR/safe-calls.rs:31:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:29:5 + --> $DIR/safe-calls.rs:34:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:36:5 + --> $DIR/safe-calls.rs:41:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:39:5 + --> $DIR/safe-calls.rs:44:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:46:5 + --> $DIR/safe-calls.rs:51:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:49:5 + --> $DIR/safe-calls.rs:54:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:52:5 + --> $DIR/safe-calls.rs:57:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:60:5 + --> $DIR/safe-calls.rs:65:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:65:18 + --> $DIR/safe-calls.rs:70:15 | -LL | const name: () = sse2(); - | ^^^^^^ call to function with `#[target_feature]` +LL | const _: () = sse2(); + | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -error: aborting due to 10 previous errors +error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:74:15 + | +LL | const _: () = sse2_and_fxsr(); + | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr + = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` + +error: call to function with `#[target_feature]` is unsafe and requires unsafe block (error E0133) + --> $DIR/safe-calls.rs:82:5 + | +LL | sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` +note: an unsafe function restricts its caller, but its body is safe by default + --> $DIR/safe-calls.rs:81:1 + | +LL | unsafe fn needs_unsafe_block() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/safe-calls.rs:78:8 + | +LL | #[deny(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs index cebc6f94784..f17dab269bc 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs @@ -7,6 +7,11 @@ #[target_feature(enable = "sse2")] const fn sse2() {} +#[target_feature(enable = "sse2")] +#[target_feature(enable = "fxsr")] +const fn sse2_and_fxsr() {} + + #[target_feature(enable = "avx")] #[target_feature(enable = "bmi2")] fn avx_bmi2() {} @@ -62,8 +67,21 @@ fn qux() { //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe } -const name: () = sse2(); +const _: () = sse2(); //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe +const _: () = sse2_and_fxsr(); +//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe +//[thir]~^^ ERROR call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe + +#[deny(unsafe_op_in_unsafe_fn)] +#[target_feature(enable = "avx")] +#[target_feature(enable = "bmi2")] +unsafe fn needs_unsafe_block() { + sse2(); + //[mir]~^ ERROR call to function with `#[target_feature]` is unsafe + //[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe +} + fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr index c75ac6e8b9a..13b58fde862 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr @@ -1,83 +1,115 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:23:5 + --> $DIR/safe-calls.rs:28:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:26:5 + --> $DIR/safe-calls.rs:31:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:29:5 + --> $DIR/safe-calls.rs:34:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:36:5 + --> $DIR/safe-calls.rs:41:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:39:5 + --> $DIR/safe-calls.rs:44:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:46:5 + --> $DIR/safe-calls.rs:51:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:49:5 + --> $DIR/safe-calls.rs:54:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:52:5 + --> $DIR/safe-calls.rs:57:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:60:5 + --> $DIR/safe-calls.rs:65:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:65:18 + --> $DIR/safe-calls.rs:70:15 | -LL | const name: () = sse2(); - | ^^^^^^ call to function with `#[target_feature]` +LL | const _: () = sse2(); + | ^^^^^^ call to function with `#[target_feature]` | - = note: can only be called if the required target features are available + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -error: aborting due to 10 previous errors +error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block + --> $DIR/safe-calls.rs:74:15 + | +LL | const _: () = sse2_and_fxsr(); + | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr + = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` + +error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133) + --> $DIR/safe-calls.rs:82:5 + | +LL | sse2(); + | ^^^^^^ call to function with `#[target_feature]` + | + = help: in order for the call to be safe, the context requires the following additional target feature: sse2 + = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` +note: an unsafe function restricts its caller, but its body is safe by default + --> $DIR/safe-calls.rs:81:1 + | +LL | unsafe fn needs_unsafe_block() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/safe-calls.rs:78:8 + | +LL | #[deny(unsafe_op_in_unsafe_fn)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr index 247fad2e992..f3726166eba 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.stderr @@ -29,6 +29,10 @@ LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some( | ^^^^^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions +help: you might have meant to compare for equality + | +LL | if let Some(elem) = _opt && [1, 2, 3][let _ = &&let Some(x) = Some(42)] == 1 { + | + error: expected expression, found `let` statement --> $DIR/invalid-let-in-a-valid-let-context.rs:24:23 @@ -53,6 +57,10 @@ LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] = 1 { | ^^^^^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions +help: you might have meant to compare for equality + | +LL | if let Some(elem) = _opt && [1, 2, 3][let _ = ()] == 1 { + | + error: expected expression, found `let` statement --> $DIR/invalid-let-in-a-valid-let-context.rs:42:21 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs index 67da5f9533c..ecf45c97dcd 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs @@ -336,7 +336,7 @@ fn from_str(s: &str) -> Result<bool, ()> { } #[lang = "eq"] -// FIXME #[const_trait] +#[const_trait] trait PartialEq<Rhs: ?Sized = Self> { fn eq(&self, other: &Rhs) -> bool; fn ne(&self, other: &Rhs) -> bool { @@ -344,6 +344,15 @@ trait PartialEq<Rhs: ?Sized = Self> { } } +impl<A: ?Sized, B: ?Sized> const PartialEq<&B> for &A +where + A: ~const PartialEq<B>, +{ + fn eq(&self, other: &&B) -> bool { + PartialEq::eq(*self, *other) + } +} + // FIXME(effects): again, this should not error without Rhs specified impl PartialEq<str> for str { fn eq(&self, other: &str) -> bool { diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr index 19e6f6bffc6..461133e6c3e 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr @@ -1,24 +1,5 @@ -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:332:9 - | -LL | "true" => Ok(true), - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - = note: `#[warn(const_patterns_without_partial_eq)]` on by default - -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:333:9 - | -LL | "false" => Ok(false), - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - error[E0493]: destructor of `Self` cannot be evaluated at compile-time - --> $DIR/minicore.rs:494:9 + --> $DIR/minicore.rs:503:9 | LL | *self = source.clone() | ^^^^^ @@ -27,35 +8,13 @@ LL | *self = source.clone() | value is dropped here error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/minicore.rs:504:35 + --> $DIR/minicore.rs:513:35 | LL | const fn drop<T: ~const Destruct>(_: T) {} | ^ - value is dropped here | | | the destructor for this type cannot be evaluated in constant functions -error: aborting due to 2 previous errors; 2 warnings emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0493`. -Future incompatibility report: Future breakage diagnostic: -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:332:9 - | -LL | "true" => Ok(true), - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - = note: `#[warn(const_patterns_without_partial_eq)]` on by default - -Future breakage diagnostic: -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:333:9 - | -LL | "false" => Ok(false), - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - = note: `#[warn(const_patterns_without_partial_eq)]` on by default - diff --git a/tests/ui/suggestions/enum-variant-arg-mismatch.stderr b/tests/ui/suggestions/enum-variant-arg-mismatch.stderr index 6d72dabf70e..16f03d16d8c 100644 --- a/tests/ui/suggestions/enum-variant-arg-mismatch.stderr +++ b/tests/ui/suggestions/enum-variant-arg-mismatch.stderr @@ -16,6 +16,10 @@ note: required by a bound in `map` | LL | fn map<'a, F: Fn(String) -> Sexpr<'a>>(f: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` +help: consider wrapping the function in a closure + | +LL | map(|arg0: String| Sexpr::Ident(/* &str */)); + | ++++++++++++++ ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr index d78de6a460c..ee924522564 100644 --- a/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr +++ b/tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr @@ -16,6 +16,10 @@ note: required by a bound in `Trader::<'a>::set_closure` | LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) { | ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure` +help: consider wrapping the function in a closure + | +LL | trader.set_closure(|arg0: &mut Trader<'_>| closure(*arg0)); + | +++++++++++++++++++++++ +++++++ help: consider adjusting the signature so it borrows its argument | LL | let closure = |trader : &mut Trader| { diff --git a/tests/ui/symbol-names/foreign-types.stderr b/tests/ui/symbol-names/foreign-types.stderr index 9c8633742b2..63044991485 100644 --- a/tests/ui/symbol-names/foreign-types.stderr +++ b/tests/ui/symbol-names/foreign-types.stderr @@ -1,4 +1,4 @@ -error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNvB<REF>_11ForeignTypeE) +error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNtB<REF>_11ForeignTypeE) --> $DIR/foreign-types.rs:13:1 | LL | #[rustc_symbol_name] diff --git a/tests/ui/typeck/issue-87872-missing-inaccessible-field-literal.stderr b/tests/ui/typeck/issue-87872-missing-inaccessible-field-literal.stderr index eab494ffbdf..899dd02583a 100644 --- a/tests/ui/typeck/issue-87872-missing-inaccessible-field-literal.stderr +++ b/tests/ui/typeck/issue-87872-missing-inaccessible-field-literal.stderr @@ -4,7 +4,7 @@ error: cannot construct `Foo` with struct literal syntax due to private fields LL | foo::Foo {}; | ^^^^^^^^ | - = note: ... and other private field `you_cant_use_this_field` that was not provided + = note: private field `you_cant_use_this_field` that was not provided error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 51491407c49..41391720a28 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -30,6 +30,10 @@ LL | self.map(Insertable::values).unwrap_or_default() found function signature `for<'a> fn(&'a _) -> _` note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL +help: consider wrapping the function in a closure + | +LL | self.map(|arg0: T| Insertable::values(&arg0)).unwrap_or_default() + | +++++++++ +++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/missing-private-fields-in-struct-literal.stderr b/tests/ui/typeck/missing-private-fields-in-struct-literal.stderr index 96998ca244d..003eaa40592 100644 --- a/tests/ui/typeck/missing-private-fields-in-struct-literal.stderr +++ b/tests/ui/typeck/missing-private-fields-in-struct-literal.stderr @@ -9,7 +9,7 @@ LL | a: (), LL | b: (), | ----- private field | - = note: ... and other private fields `c`, `d` and `e` that were not provided + = note: ...and other private fields `c`, `d` and `e` that were not provided error: aborting due to 1 previous error |
