diff options
| author | bors <bors@rust-lang.org> | 2022-01-18 22:46:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-18 22:46:47 +0000 |
| commit | e5e2b0be26ea177527b60d355bd8f56cd473bd00 (patch) | |
| tree | d88fe7568bde7be8c68938dc717b0c01ead17cdf /src/test | |
| parent | 9ad5d82f822b3cb67637f11be2e65c5662b66ec0 (diff) | |
| parent | f851a849cb29db5eb761fe68abf1ccaf33b7d544 (diff) | |
| download | rust-e5e2b0be26ea177527b60d355bd8f56cd473bd00.tar.gz rust-e5e2b0be26ea177527b60d355bd8f56cd473bd00.zip | |
Auto merge of #93048 - matthiaskrgr:rollup-cz5ma34, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #90782 (Implement raw-dylib support for windows-gnu) - #91150 (Let qpath contain NtTy: `<$:ty as $:ty>::…`) - #92425 (Improve SIMD casts) - #92692 (Simplify and unify rustdoc sidebar styles) - #92780 (Directly use ConstValue for single literals in blocks) - #92924 (Delete pretty printer tracing) - #93018 (Remove some unused `Ord` derives based on `Span`) - #93026 (fix typo in `max` description for f32/f64) - #93035 (Fix stdarch submodule pointing to commit outside tree) Failed merges: - #92861 (Rustdoc mobile: put out-of-band info on its own line) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
42 files changed, 266 insertions, 97 deletions
diff --git a/src/test/run-make/raw-dylib-c/Makefile b/src/test/run-make/raw-dylib-c/Makefile index 26ab4d34764..166305672e6 100644 --- a/src/test/run-make/raw-dylib-c/Makefile +++ b/src/test/run-make/raw-dylib-c/Makefile @@ -1,14 +1,19 @@ # Test the behavior of #[link(.., kind = "raw-dylib")] on windows-msvc -# only-windows-msvc +# only-windows -include ../../run-make-fulldeps/tools.mk all: $(call COMPILE_OBJ,"$(TMPDIR)"/extern_1.obj,extern_1.c) $(call COMPILE_OBJ,"$(TMPDIR)"/extern_2.obj,extern_2.c) +ifdef IS_MSVC $(CC) "$(TMPDIR)"/extern_1.obj -link -dll -out:"$(TMPDIR)"/extern_1.dll $(CC) "$(TMPDIR)"/extern_2.obj -link -dll -out:"$(TMPDIR)"/extern_2.dll +else + $(CC) "$(TMPDIR)"/extern_1.obj -shared -o "$(TMPDIR)"/extern_1.dll + $(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll +endif $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt diff --git a/src/test/run-make/raw-dylib-link-ordinal/Makefile b/src/test/run-make/raw-dylib-link-ordinal/Makefile index 04b257d0632..0e84a749b05 100644 --- a/src/test/run-make/raw-dylib-link-ordinal/Makefile +++ b/src/test/run-make/raw-dylib-link-ordinal/Makefile @@ -1,12 +1,16 @@ # Test the behavior of #[link(.., kind = "raw-dylib")] and #[link_ordinal] on windows-msvc -# only-windows-msvc +# only-windows -include ../../run-make-fulldeps/tools.mk all: $(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) +ifdef IS_MSVC $(CC) "$(TMPDIR)"/exporter.obj exporter.def -link -dll -out:"$(TMPDIR)"/exporter.dll +else + $(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll +endif $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/Makefile b/src/test/run-make/raw-dylib-stdcall-ordinal/Makefile new file mode 100644 index 00000000000..69f62669d62 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/Makefile @@ -0,0 +1,23 @@ +# Test the behavior of #[link(.., kind = "raw-dylib")], #[link_ordinal], and alternative calling conventions on i686 windows. + +# only-x86 +# only-windows + +-include ../../run-make-fulldeps/tools.mk + +all: + $(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) +ifdef IS_MSVC + $(CC) "$(TMPDIR)"/exporter.obj exporter-msvc.def -link -dll -out:"$(TMPDIR)"/exporter.dll +else + $(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll +endif + $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs + $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" + "$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt + +ifdef RUSTC_BLESS_TEST + cp "$(TMPDIR)"/actual_output.txt expected_output.txt +else + $(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt +endif diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/driver.rs b/src/test/run-make/raw-dylib-stdcall-ordinal/driver.rs new file mode 100644 index 00000000000..4059ede11fc --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/driver.rs @@ -0,0 +1,5 @@ +extern crate raw_dylib_test; + +fn main() { + raw_dylib_test::library_function(); +} diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt b/src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt new file mode 100644 index 00000000000..20157763745 --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt @@ -0,0 +1,2 @@ +exported_function_stdcall(6) +exported_function_fastcall(125) diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-gnu.def b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-gnu.def new file mode 100644 index 00000000000..8d28d714b7e --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-gnu.def @@ -0,0 +1,4 @@ +LIBRARY exporter +EXPORTS + exported_function_stdcall@4 @15 NONAME + @exported_function_fastcall@4 @18 NONAME \ No newline at end of file diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def new file mode 100644 index 00000000000..5a4c79a58ed --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def @@ -0,0 +1,4 @@ +LIBRARY exporter +EXPORTS + _exported_function_stdcall@4 @15 NONAME + @exported_function_fastcall@4 @18 NONAME \ No newline at end of file diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/exporter.c b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter.c new file mode 100644 index 00000000000..1fb45bf010f --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/exporter.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +void __stdcall exported_function_stdcall(int i) { + printf("exported_function_stdcall(%d)\n", i); + fflush(stdout); +} + +void __fastcall exported_function_fastcall(int i) { + printf("exported_function_fastcall(%d)\n", i); + fflush(stdout); +} diff --git a/src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs b/src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs new file mode 100644 index 00000000000..07dd3d7be9b --- /dev/null +++ b/src/test/run-make/raw-dylib-stdcall-ordinal/lib.rs @@ -0,0 +1,20 @@ +#![feature(raw_dylib)] + +#[link(name = "exporter", kind = "raw-dylib")] +extern "stdcall" { + #[link_ordinal(15)] + fn imported_function_stdcall(i: i32); +} + +#[link(name = "exporter", kind = "raw-dylib")] +extern "fastcall" { + #[link_ordinal(18)] + fn imported_function_fastcall(i: i32); +} + +pub fn library_function() { + unsafe { + imported_function_stdcall(6); + imported_function_fastcall(125); + } +} diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml index e6758287d8c..2d48d21dc1b 100644 --- a/src/test/rustdoc-gui/anchors.goml +++ b/src/test/rustdoc-gui/anchors.goml @@ -20,7 +20,7 @@ assert-css: (".srclink", {"text-decoration": "underline solid rgb(56, 115, 173)" assert-css: ("#top-doc-prose-title", {"color": "rgb(0, 0, 0)"}) -assert-css: (".sidebar a", {"color": "rgb(0, 0, 0)"}) +assert-css: (".sidebar a", {"color": "rgb(56, 115, 173)"}) assert-css: (".in-band a", {"color": "rgb(0, 0, 0)"}) // We move the cursor over the "Implementations" title so the anchor is displayed. diff --git a/src/test/rustdoc-gui/code-blocks-overflow.goml b/src/test/rustdoc-gui/code-blocks-overflow.goml index ee4dad444e9..f93f3f0aefc 100644 --- a/src/test/rustdoc-gui/code-blocks-overflow.goml +++ b/src/test/rustdoc-gui/code-blocks-overflow.goml @@ -5,4 +5,4 @@ size: (1080, 600) assert-count: (".docblock > .example-wrap", 2) assert: ".docblock > .example-wrap > .language-txt" assert: ".docblock > .example-wrap > .rust-example-rendered" -assert-css: (".docblock > .example-wrap > pre", {"width": "796px", "overflow-x": "auto"}, ALL) +assert-css: (".docblock > .example-wrap > pre", {"width": "785.25px", "overflow-x": "auto"}, ALL) diff --git a/src/test/rustdoc-gui/docblock-table-overflow.goml b/src/test/rustdoc-gui/docblock-table-overflow.goml index 1b3006155d8..a9af88189a6 100644 --- a/src/test/rustdoc-gui/docblock-table-overflow.goml +++ b/src/test/rustdoc-gui/docblock-table-overflow.goml @@ -4,7 +4,7 @@ goto: file://|DOC_PATH|/lib2/long_table/struct.Foo.html size: (1100, 800) // Logically, the ".docblock" and the "<p>" should have the same scroll width. compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"]) -assert-property: (".top-doc .docblock", {"scrollWidth": "816"}) +assert-property: (".top-doc .docblock", {"scrollWidth": "801"}) // However, since there is overflow in the <table>, its scroll width is bigger. assert-property: (".top-doc .docblock table", {"scrollWidth": "1573"}) @@ -16,6 +16,6 @@ compare-elements-property: ( "#implementations + details .docblock > p", ["scrollWidth"], ) -assert-property: ("#implementations + details .docblock", {"scrollWidth": "816"}) +assert-property: ("#implementations + details .docblock", {"scrollWidth": "801"}) // However, since there is overflow in the <table>, its scroll width is bigger. assert-property: ("#implementations + details .docblock table", {"scrollWidth": "1573"}) diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml index 34fadd84ae8..34ff2de3a9b 100644 --- a/src/test/rustdoc-gui/headings.goml +++ b/src/test/rustdoc-gui/headings.goml @@ -110,7 +110,7 @@ assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "15.2px" assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"}) assert-text: (".sidebar .others h3", "Modules") -assert-css: (".sidebar .others h3", {"border-bottom-width": "1px"}, ALL) +assert-css: (".sidebar .others h3", {"border-bottom-width": "0px"}, ALL) goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html diff --git a/src/test/rustdoc-gui/item-info-width.goml b/src/test/rustdoc-gui/item-info-width.goml index cdc00d34114..acb30141ce5 100644 --- a/src/test/rustdoc-gui/item-info-width.goml +++ b/src/test/rustdoc-gui/item-info-width.goml @@ -3,5 +3,5 @@ goto: file://|DOC_PATH|/lib2/struct.Foo.html // We set a fixed size so there is no chance of "random" resize. size: (1100, 800) // We check that ".item-info" is bigger than its content. -assert-css: (".item-info", {"width": "807px"}) +assert-css: (".item-info", {"width": "757px"}) assert-css: (".item-info .stab", {"width": "341px"}) diff --git a/src/test/rustdoc-gui/search-result-display.goml b/src/test/rustdoc-gui/search-result-display.goml index ea94e5640fb..3162a067d21 100644 --- a/src/test/rustdoc-gui/search-result-display.goml +++ b/src/test/rustdoc-gui/search-result-display.goml @@ -5,7 +5,7 @@ write: (".search-input", "test") wait-for: "#titles" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... -assert-css: (".search-results div.desc", {"width": "320px"}) +assert-css: (".search-results div.desc", {"width": "295px"}) size: (600, 100) // As counter-intuitive as it may seem, in this width, the width is "100%", which is why // when computed it's larger. diff --git a/src/test/rustdoc-gui/sidebar-mobile.goml b/src/test/rustdoc-gui/sidebar-mobile.goml index eecd584bca9..547eb3fd1b3 100644 --- a/src/test/rustdoc-gui/sidebar-mobile.goml +++ b/src/test/rustdoc-gui/sidebar-mobile.goml @@ -4,25 +4,28 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html // Switching to "mobile view" by reducing the width to 600px. size: (600, 600) -assert-css: (".sidebar-elems", {"display": "block", "left": "-246px"}) +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Opening the sidebar menu. -click: ".sidebar-menu" -assert-css: (".sidebar-elems", {"display": "block", "left": "0px"}) +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"display": "block", "left": "0px"}) // Closing the sidebar menu. -click: ".sidebar-menu" -assert-css: (".sidebar-elems", {"display": "block", "left": "-246px"}) +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Force the sidebar open by focusing a link inside it. // This makes it easier for keyboard users to get to it. focus: ".sidebar-title a" -assert-css: (".sidebar-elems", {"display": "block", "left": "0px"}) +assert-css: (".sidebar", {"display": "block", "left": "0px"}) // When we tab out of the sidebar, close it. focus: ".search-input" -assert-css: (".sidebar-elems", {"display": "block", "left": "-246px"}) +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Open the sidebar menu. -click: ".sidebar-menu" -assert-css: (".sidebar-elems", {"left": "0px"}) +click: ".sidebar-menu-toggle" +assert-css: (".sidebar", {"left": "0px"}) // Click elsewhere. click: "body" -assert-css: (".sidebar-elems", {"left": "-246px"}) +assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) + +// Check that the topbar is visible +assert-property: (".mobile-topbar", {"clientHeight": "45"}) diff --git a/src/test/rustdoc-gui/sidebar-source-code.goml b/src/test/rustdoc-gui/sidebar-source-code.goml index 98f4fdf4233..1c5eb9239ba 100644 --- a/src/test/rustdoc-gui/sidebar-source-code.goml +++ b/src/test/rustdoc-gui/sidebar-source-code.goml @@ -10,6 +10,7 @@ click: (10, 10) // We wait for the sidebar to be expanded (there is a 0.5s animation). wait-for: 600 assert-css: ("nav.sidebar.expanded", {"width": "300px"}) +assert-css: ("nav.sidebar.expanded a", {"font-size": "14.4px"}) // We collapse the sidebar. click: (10, 10) // We wait for the sidebar to be collapsed (there is a 0.5s animation). @@ -30,3 +31,6 @@ click: (10, 10) // We ensure that the class has been removed. assert-false: "nav.sidebar.expanded" assert: "nav.sidebar" + +// Check that the topbar is not visible +assert-property: (".mobile-topbar", {"offsetParent": "null"}) diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index 9289244f6f8..a1175525858 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -1,8 +1,14 @@ goto: file://|DOC_PATH|/test_docs/index.html +show-text: true +local-storage: {"rustdoc-theme": "light"} +// We reload the page so the local storage settings are being used. +reload: + assert-text: (".sidebar > .location", "Crate test_docs") // In modules, we only have one "location" element. assert-count: (".sidebar .location", 1) -assert-text: (".sidebar-elems > #all-types", "See all test_docs's items") +assert-text: ("#all-types", "All Items") +assert-css: ("#all-types", {"color": "rgb(56, 115, 173)"}) // We check that we have the crates list and that the "current" on is "test_docs". assert-text: (".sidebar-elems .crate > ul > li > a.current", "test_docs") // And we're also supposed to have the list of items in the current module. @@ -24,13 +30,14 @@ assert-count: (".sidebar .location", 2) assert-false: ".sidebar-elems > .crate" click: ".sidebar-links a" -assert-property: ("html", {"scrollTop": "389"}) +assert-property-false: ("html", {"scrollTop": "0"}) -click: ".sidebar h2.location" +click: ".sidebar h2.location a" assert-property: ("html", {"scrollTop": "0"}) // We now go back to the crate page to click on the "lib2" crate link. goto: file://|DOC_PATH|/test_docs/index.html +assert-css: (".sidebar-elems .crate > ul > li:first-child > a", {"color": "rgb(56, 115, 173)"}) click: ".sidebar-elems .crate > ul > li:first-child > a" // PAGE: lib2/index.html @@ -51,8 +58,7 @@ click: "#functions + .item-table .item-left > a" // In items containing no items (like functions or constants) and in modules, we have one // "location" elements. assert-count: (".sidebar .location", 1) -// There is a "<br>" tag between "in" and "lib2", but it doesn't count as a space. -assert-text: (".sidebar .sidebar-elems .location", "Other items inlib2") +assert-text: (".sidebar .sidebar-elems .location", "In lib2") // We check that we don't have the crate list. assert-false: ".sidebar-elems > .crate" diff --git a/src/test/rustdoc-gui/type-declation-overflow.goml b/src/test/rustdoc-gui/type-declation-overflow.goml index bb24d0ce792..21874f786f1 100644 --- a/src/test/rustdoc-gui/type-declation-overflow.goml +++ b/src/test/rustdoc-gui/type-declation-overflow.goml @@ -11,7 +11,7 @@ assert-property: (".item-decl pre", {"scrollWidth": "1324"}) goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html assert-property: ("body", {"scrollWidth": "1100"}) // We now check that the section width hasn't grown because of it. -assert-property: ("#main-content", {"scrollWidth": "840"}) +assert-property: ("#main-content", {"scrollWidth": "825"}) // And now checking that it has scrollable content. assert-property: (".item-decl pre", {"scrollWidth": "1103"}) @@ -20,6 +20,13 @@ assert-property: (".item-decl pre", {"scrollWidth": "1103"}) goto: file://|DOC_PATH|/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html assert-property: ("body", {"scrollWidth": "1100"}) // We now check that the section width hasn't grown because of it. -assert-property: ("#main-content", {"scrollWidth": "840"}) +assert-property: ("#main-content", {"scrollWidth": "825"}) // And now checking that it has scrollable content. assert-property: (".item-decl pre", {"scrollWidth": "950"}) + +// On mobile: +size: (600, 600) +goto: file://|DOC_PATH|/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html +assert-property: (".mobile-topbar .location", {"scrollWidth": "504"}) +assert-property: (".mobile-topbar .location", {"clientWidth": "504"}) +assert-css: (".mobile-topbar .location", {"overflow-x": "hidden"}) diff --git a/src/test/rustdoc/cap-lints.rs b/src/test/rustdoc/cap-lints.rs index 15910e1e900..08a35339680 100644 --- a/src/test/rustdoc/cap-lints.rs +++ b/src/test/rustdoc/cap-lints.rs @@ -3,7 +3,7 @@ // therefore should not concern itself with the lints. #[deny(warnings)] -// @has cap_lints/struct.Foo.html //* 'Struct Foo' +// @has cap_lints/struct.Foo.html //* 'Foo' pub struct Foo { field: i32, } diff --git a/src/test/rustdoc/crate-version-escape.rs b/src/test/rustdoc/crate-version-escape.rs index 2f91eea339b..8413709f15e 100644 --- a/src/test/rustdoc/crate-version-escape.rs +++ b/src/test/rustdoc/crate-version-escape.rs @@ -2,5 +2,4 @@ #![crate_name = "foo"] -// @has 'foo/index.html' '//div[@class="block version"]/p' 'Version <script>alert("hi")</script>' -// @has 'foo/all.html' '//div[@class="block version"]/p' 'Version <script>alert("hi")</script>' +// @has 'foo/index.html' '//li[@class="version"]' 'Version <script>alert("hi")</script>' diff --git a/src/test/rustdoc/crate-version.rs b/src/test/rustdoc/crate-version.rs index 893af5c6133..2592c98530f 100644 --- a/src/test/rustdoc/crate-version.rs +++ b/src/test/rustdoc/crate-version.rs @@ -1,3 +1,3 @@ // compile-flags: --crate-version=1.3.37 -// @has 'crate_version/index.html' '//div[@class="block version"]/p' 'Version 1.3.37' +// @has 'crate_version/index.html' '//*[@class="version"]' 'Version 1.3.37' diff --git a/src/test/rustdoc/titles.rs b/src/test/rustdoc/titles.rs index 016ec7bfaa3..69e8b856b0a 100644 --- a/src/test/rustdoc/titles.rs +++ b/src/test/rustdoc/titles.rs @@ -1,10 +1,11 @@ #![crate_name = "foo"] - #![feature(rustdoc_internals)] // @matches 'foo/index.html' '//h1' 'Crate foo' +// @matches 'foo/index.html' '//h2[@class="location"]' 'Crate foo' // @matches 'foo/foo_mod/index.html' '//h1' 'Module foo::foo_mod' +// @matches 'foo/foo_mod/index.html' '//h2[@class="location"]' 'Module foo_mod' pub mod foo_mod { pub struct __Thing {} } @@ -18,15 +19,19 @@ extern "C" { pub fn foo_fn() {} // @matches 'foo/trait.FooTrait.html' '//h1' 'Trait foo::FooTrait' +// @matches 'foo/trait.FooTrait.html' '//h2[@class="location"]' 'FooTrait' pub trait FooTrait {} // @matches 'foo/struct.FooStruct.html' '//h1' 'Struct foo::FooStruct' +// @matches 'foo/struct.FooStruct.html' '//h2[@class="location"]' 'FooStruct' pub struct FooStruct; // @matches 'foo/enum.FooEnum.html' '//h1' 'Enum foo::FooEnum' +// @matches 'foo/enum.FooEnum.html' '//h2[@class="location"]' 'FooEnum' pub enum FooEnum {} // @matches 'foo/type.FooType.html' '//h1' 'Type Definition foo::FooType' +// @matches 'foo/type.FooType.html' '//h2[@class="location"]' 'FooType' pub type FooType = FooStruct; // @matches 'foo/macro.foo_macro.html' '//h1' 'Macro foo::foo_macro' diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index 1fb28ee9970..4ecd62cded2 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -12,7 +12,7 @@ impl MyStruct { // @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyAlias' // @has - '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' 'impl MyTrait for MyAlias' // @has - 'Alias docstring' -// @has - '//*[@class="sidebar"]//*[@class="location"]' 'Type Definition MyAlias' +// @has - '//*[@class="sidebar"]//*[@class="location"]' 'MyAlias' // @has - '//*[@class="sidebar"]//a[@href="#implementations"]' 'Methods' // @has - '//*[@class="sidebar"]//a[@href="#trait-implementations"]' 'Trait Implementations' /// Alias docstring diff --git a/src/test/ui/const-generics/issues/issue-92186.rs b/src/test/ui/const-generics/issues/issue-92186.rs new file mode 100644 index 00000000000..9ced4667d24 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-92186.rs @@ -0,0 +1,12 @@ +// check-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub struct Foo<const N: usize>; +pub trait Bar<T> {} + +impl<T> Bar<T> for Foo<{ 1 }> {} +impl<T> Bar<T> for Foo<{ 2 }> {} + +fn main() {} diff --git a/src/test/ui/const-generics/types-mismatch-const-args.full.stderr b/src/test/ui/const-generics/types-mismatch-const-args.full.stderr index 565c9ba1ff1..4d6b752867f 100644 --- a/src/test/ui/const-generics/types-mismatch-const-args.full.stderr +++ b/src/test/ui/const-generics/types-mismatch-const-args.full.stderr @@ -15,9 +15,20 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data | | | expected due to this | - = note: expected struct `A<'a, u16, {2u32}, {3u32}>` - found struct `A<'b, u32, {2u32}, {3u32}>` + = note: expected struct `A<'a, u16, _, _>` + found struct `A<'b, u32, _, _>` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/types-mismatch-const-args.rs:18:41 + | +LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` + | | + | expected due to this + | + = note: expected struct `A<'a, u16, 4_u32, _>` + found struct `A<'b, u32, 2_u32, _>` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/types-mismatch-const-args.min.stderr b/src/test/ui/const-generics/types-mismatch-const-args.min.stderr index ec9221d2486..8b60238cb0c 100644 --- a/src/test/ui/const-generics/types-mismatch-const-args.min.stderr +++ b/src/test/ui/const-generics/types-mismatch-const-args.min.stderr @@ -20,6 +20,17 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data = note: expected struct `A<'a, u16, _, _>` found struct `A<'b, u32, _, _>` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/types-mismatch-const-args.rs:18:41 + | +LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; + | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32` + | | + | expected due to this + | + = note: expected struct `A<'a, u16, 4_u32, _>` + found struct `A<'b, u32, 2_u32, _>` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/types-mismatch-const-args.rs b/src/test/ui/const-generics/types-mismatch-const-args.rs index c2092c4268e..43ef28b268f 100644 --- a/src/test/ui/const-generics/types-mismatch-const-args.rs +++ b/src/test/ui/const-generics/types-mismatch-const-args.rs @@ -15,6 +15,8 @@ fn a<'a, 'b>() { //~^ ERROR mismatched types let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; //~^ ERROR mismatched types + let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; + //~^ ERROR mismatched types } pub fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs deleted file mode 100644 index 33f9c539313..00000000000 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs +++ /dev/null @@ -1,8 +0,0 @@ -// gate-test-raw_dylib -// only-windows-gnu -#[link(name = "foo", kind = "raw-dylib")] -//~^ ERROR: kind="raw-dylib" is unstable -//~| WARNING: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu -extern "C" {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.stderr deleted file mode 100644 index 14dfadf4126..00000000000 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu - --> $DIR/feature-gate-raw-dylib-windows-gnu.rs:3:1 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0658]: kind="raw-dylib" is unstable - --> $DIR/feature-gate-raw-dylib-windows-gnu.rs:3:1 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information - = help: add `#![feature(raw_dylib)]` to the crate attributes to enable - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.rs b/src/test/ui/feature-gates/feature-gate-raw-dylib.rs index 49de24ea9ab..995d9ced480 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.rs +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib.rs @@ -1,5 +1,4 @@ -// gate-test-raw_dylib -// only-windows-msvc +// only-windows #[link(name = "foo", kind = "raw-dylib")] //~^ ERROR: kind="raw-dylib" is unstable extern "C" {} diff --git a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.stderr b/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr index 11988080812..bb64af38b2c 100644 --- a/src/test/ui/feature-gates/feature-gate-raw-dylib-windows-msvc.stderr +++ b/src/test/ui/feature-gates/feature-gate-raw-dylib.stderr @@ -1,5 +1,5 @@ error[E0658]: kind="raw-dylib" is unstable - --> $DIR/feature-gate-raw-dylib-windows-msvc.rs:3:1 + --> $DIR/feature-gate-raw-dylib.rs:2:1 | LL | #[link(name = "foo", kind = "raw-dylib")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-interpolation.rs b/src/test/ui/macros/macro-interpolation.rs index abe1f2aaf15..35003a79ad7 100644 --- a/src/test/ui/macros/macro-interpolation.rs +++ b/src/test/ui/macros/macro-interpolation.rs @@ -14,8 +14,20 @@ macro_rules! overly_complicated { } +macro_rules! qpath { + (path, <$type:ty as $trait:path>::$name:ident) => { + <$type as $trait>::$name + }; + + (ty, <$type:ty as $trait:ty>::$name:ident) => { + <$type as $trait>::$name + }; +} + pub fn main() { + let _: qpath!(path, <str as ToOwned>::Owned); + let _: qpath!(ty, <str as ToOwned>::Owned); + assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); }, Some(8), Some(y), y) == 8) - } diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs index 0ab994ecd45..2a15b1d799f 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs @@ -1,4 +1,4 @@ -// only-windows-msvc +// only-windows #![feature(raw_dylib)] //~^ WARN the feature `raw_dylib` is incomplete diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs index d02bebc9d61..13c9aa01e34 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.rs @@ -1,4 +1,5 @@ -// only-i686-pc-windows-msvc +// only-x86 +// only-windows // compile-flags: --crate-type lib --emit link #![allow(clashing_extern_declarations)] #![feature(raw_dylib)] diff --git a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr index a9cfd6b23f9..93ca8f4d8d4 100644 --- a/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/multiple-declarations.stderr @@ -1,5 +1,5 @@ warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/multiple-declarations.rs:4:12 + --> $DIR/multiple-declarations.rs:5:12 | LL | #![feature(raw_dylib)] | ^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #![feature(raw_dylib)] = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information error: multiple declarations of external function `f` from library `foo.dll` have different calling conventions - --> $DIR/multiple-declarations.rs:14:9 + --> $DIR/multiple-declarations.rs:15:9 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.rs b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.rs deleted file mode 100644 index e9690f03f45..00000000000 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.rs +++ /dev/null @@ -1,8 +0,0 @@ -// only-windows-gnu -// check-pass -// compile-flags: --crate-type lib -#![feature(raw_dylib)] -//~^ WARNING: the feature `raw_dylib` is incomplete -#[link(name = "foo", kind = "raw-dylib")] -//~^ WARNING: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu -extern "C" {} diff --git a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.stderr b/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.stderr deleted file mode 100644 index 6e24112b3c3..00000000000 --- a/src/test/ui/rfc-2627-raw-dylib/raw-dylib-msvc-only.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: the feature `raw_dylib` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/raw-dylib-msvc-only.rs:4:12 - | -LL | #![feature(raw_dylib)] - | ^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information - -warning: `#[link(...)]` with `kind = "raw-dylib"` not supported on windows-gnu - --> $DIR/raw-dylib-msvc-only.rs:6:1 - | -LL | #[link(name = "foo", kind = "raw-dylib")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted - diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs index e5a5ac2eb2b..dc647fd63f5 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.rs @@ -1,4 +1,5 @@ -// only-x86_64-pc-windows-msvc +// only-x86_64 +// only-windows // compile-flags: --crate-type lib --emit link #![allow(incomplete_features)] #![feature(raw_dylib)] diff --git a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr index fc9008128ae..d8a2a6af9c1 100644 --- a/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/unsupported-abi.stderr @@ -1,5 +1,5 @@ error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture - --> $DIR/unsupported-abi.rs:7:5 + --> $DIR/unsupported-abi.rs:8:5 | LL | fn f(x: i32); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/simd/intrinsic/generic-as.rs b/src/test/ui/simd/intrinsic/generic-as.rs new file mode 100644 index 00000000000..a975190a2fa --- /dev/null +++ b/src/test/ui/simd/intrinsic/generic-as.rs @@ -0,0 +1,48 @@ +// run-pass + +#![feature(repr_simd, platform_intrinsics)] + +extern "platform-intrinsic" { + fn simd_as<T, U>(x: T) -> U; +} + +#[derive(Copy, Clone)] +#[repr(simd)] +struct V<T>([T; 2]); + +fn main() { + unsafe { + let u = V::<u32>([u32::MIN, u32::MAX]); + let i: V<i16> = simd_as(u); + assert_eq!(i.0[0], u.0[0] as i16); + assert_eq!(i.0[1], u.0[1] as i16); + } + + unsafe { + let f = V::<f32>([f32::MIN, f32::MAX]); + let i: V<i16> = simd_as(f); + assert_eq!(i.0[0], f.0[0] as i16); + assert_eq!(i.0[1], f.0[1] as i16); + } + + unsafe { + let f = V::<f32>([f32::MIN, f32::MAX]); + let u: V<u8> = simd_as(f); + assert_eq!(u.0[0], f.0[0] as u8); + assert_eq!(u.0[1], f.0[1] as u8); + } + + unsafe { + let f = V::<f64>([f64::MIN, f64::MAX]); + let i: V<isize> = simd_as(f); + assert_eq!(i.0[0], f.0[0] as isize); + assert_eq!(i.0[1], f.0[1] as isize); + } + + unsafe { + let f = V::<f64>([f64::MIN, f64::MAX]); + let u: V<usize> = simd_as(f); + assert_eq!(u.0[0], f.0[0] as usize); + assert_eq!(u.0[1], f.0[1] as usize); + } +} diff --git a/src/test/ui/simd/intrinsic/generic-cast-pointer-width.rs b/src/test/ui/simd/intrinsic/generic-cast-pointer-width.rs new file mode 100644 index 00000000000..b9382310deb --- /dev/null +++ b/src/test/ui/simd/intrinsic/generic-cast-pointer-width.rs @@ -0,0 +1,21 @@ +// run-pass +#![feature(repr_simd, platform_intrinsics)] + +extern "platform-intrinsic" { + fn simd_cast<T, U>(x: T) -> U; +} + +#[derive(Copy, Clone)] +#[repr(simd)] +struct V<T>([T; 4]); + +fn main() { + let u = V::<usize>([0, 1, 2, 3]); + let uu32: V<u32> = unsafe { simd_cast(u) }; + let ui64: V<i64> = unsafe { simd_cast(u) }; + + for (u, (uu32, ui64)) in u.0.iter().zip(uu32.0.iter().zip(ui64.0.iter())) { + assert_eq!(*u as u32, *uu32); + assert_eq!(*u as i64, *ui64); + } +} |
