From bdf490bf331ddc320bf00ad14f4930f79843f4c7 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 30 Aug 2021 16:10:19 -0400 Subject: Fix loading large rlibs Bumps object crate to permit parsing archives with 64-bit table entries. These are primarily encountered when there's more than 4GB of archive data. --- src/test/run-make/issue-88351-large-rlib/Makefile | 7 +++ src/test/run-make/issue-88351-large-rlib/bar.rs | 5 ++ src/test/run-make/issue-88351-large-rlib/main.rs | 64 +++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/test/run-make/issue-88351-large-rlib/Makefile create mode 100644 src/test/run-make/issue-88351-large-rlib/bar.rs create mode 100644 src/test/run-make/issue-88351-large-rlib/main.rs (limited to 'src/test') diff --git a/src/test/run-make/issue-88351-large-rlib/Makefile b/src/test/run-make/issue-88351-large-rlib/Makefile new file mode 100644 index 00000000000..98938e5ebc4 --- /dev/null +++ b/src/test/run-make/issue-88351-large-rlib/Makefile @@ -0,0 +1,7 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + $(RUSTC) main.rs + $(TMPDIR)/main $(TMPDIR) + $(RUSTC) $(TMPDIR)/foo.rs --crate-type=rlib -l static=foo -L$(TMPDIR) + RUSTC_LOG=rustc_metadata=debug $(RUSTC) bar.rs --extern foo=$(TMPDIR)/libfoo.rlib --edition=2018 diff --git a/src/test/run-make/issue-88351-large-rlib/bar.rs b/src/test/run-make/issue-88351-large-rlib/bar.rs new file mode 100644 index 00000000000..1b600036490 --- /dev/null +++ b/src/test/run-make/issue-88351-large-rlib/bar.rs @@ -0,0 +1,5 @@ +fn main() { + unsafe { + println!("{}", foo::FOO_11_49[0]); + } +} diff --git a/src/test/run-make/issue-88351-large-rlib/main.rs b/src/test/run-make/issue-88351-large-rlib/main.rs new file mode 100644 index 00000000000..f97830f3d86 --- /dev/null +++ b/src/test/run-make/issue-88351-large-rlib/main.rs @@ -0,0 +1,64 @@ +//! Large archive example. +//! +//! This creates several C files with a bunch of global arrays. The goal is to +//! create an rlib that is over 4GB in size so that the LLVM archiver creates +//! a /SYM64/ entry instead of /. +//! +//! It compiles the C files to .o files, and then uses `ar` to collect them +//! into a static library. It creates `foo.rs` with references to all the C +//! arrays, and then uses `rustc` to build an rlib with that static +//! information. It then creates `bar.rs` which links the giant libfoo.rlib, +//! which should fail since it can't read the large libfoo.rlib file. + +use std::env; +use std::fs::File; +use std::io::{BufWriter, Write}; +use std::process::Command; + +// Number of object files to create. +const NOBJ: u32 = 12; +// Make the filename longer than 16 characters to force names to be placed in // +const PREFIX: &str = "abcdefghijklmnopqrstuvwxyz"; + +fn main() { + let tmpdir = std::path::PathBuf::from(env::args_os().nth(1).unwrap()); + let mut foo_rs = File::create(tmpdir.join("foo.rs")).unwrap(); + write!(foo_rs, "extern \"C\" {{\n").unwrap(); + for obj in 0..NOBJ { + let filename = tmpdir.join(&format!("{}{}.c", PREFIX, obj)); + let f = File::create(&filename).unwrap(); + let mut buf = BufWriter::new(f); + write!(buf, "#include\n").unwrap(); + for n in 0..50 { + write!(buf, "int64_t FOO_{}_{}[] = {{\n", obj, n).unwrap(); + for x in 0..1024 { + for y in 0..1024 { + write!(buf, "{},", (obj + n + x + y) % 10).unwrap(); + } + write!(buf, "\n").unwrap(); + } + write!(buf, "}};\n").unwrap(); + write!(foo_rs, " pub static FOO_{}_{}: [i64; 1024*1024];\n", obj, n).unwrap(); + } + drop(buf); + println!("compile {:?}", filename); + let status = + Command::new("cc").current_dir(&tmpdir).arg("-c").arg(&filename).status().unwrap(); + if !status.success() { + panic!("failed: {:?}", status); + } + } + write!(foo_rs, "}}\n").unwrap(); + drop(foo_rs); + let mut cmd = Command::new("ar"); + cmd.arg("-crs"); + cmd.arg(tmpdir.join("libfoo.a")); + for obj in 0..NOBJ { + cmd.arg(tmpdir.join(&format!("{}{}.o", PREFIX, obj))); + } + println!("archiving: {:?}", cmd); + let status = cmd.status().unwrap(); + if !status.success() { + panic!("failed: {:?}", status); + } +} -- cgit 1.4.1-3-g733a5 From cf546d6c63fdf5cfcd0f98230349ebd77997b5d4 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 31 Aug 2021 10:20:49 -0400 Subject: Delete long-running large rlibs test This is kept to a separate commit so that the test itself is preserved in the commit history. --- src/test/run-make/issue-88351-large-rlib/Makefile | 7 --- src/test/run-make/issue-88351-large-rlib/bar.rs | 5 -- src/test/run-make/issue-88351-large-rlib/main.rs | 64 ----------------------- 3 files changed, 76 deletions(-) delete mode 100644 src/test/run-make/issue-88351-large-rlib/Makefile delete mode 100644 src/test/run-make/issue-88351-large-rlib/bar.rs delete mode 100644 src/test/run-make/issue-88351-large-rlib/main.rs (limited to 'src/test') diff --git a/src/test/run-make/issue-88351-large-rlib/Makefile b/src/test/run-make/issue-88351-large-rlib/Makefile deleted file mode 100644 index 98938e5ebc4..00000000000 --- a/src/test/run-make/issue-88351-large-rlib/Makefile +++ /dev/null @@ -1,7 +0,0 @@ --include ../../run-make-fulldeps/tools.mk - -all: - $(RUSTC) main.rs - $(TMPDIR)/main $(TMPDIR) - $(RUSTC) $(TMPDIR)/foo.rs --crate-type=rlib -l static=foo -L$(TMPDIR) - RUSTC_LOG=rustc_metadata=debug $(RUSTC) bar.rs --extern foo=$(TMPDIR)/libfoo.rlib --edition=2018 diff --git a/src/test/run-make/issue-88351-large-rlib/bar.rs b/src/test/run-make/issue-88351-large-rlib/bar.rs deleted file mode 100644 index 1b600036490..00000000000 --- a/src/test/run-make/issue-88351-large-rlib/bar.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - unsafe { - println!("{}", foo::FOO_11_49[0]); - } -} diff --git a/src/test/run-make/issue-88351-large-rlib/main.rs b/src/test/run-make/issue-88351-large-rlib/main.rs deleted file mode 100644 index f97830f3d86..00000000000 --- a/src/test/run-make/issue-88351-large-rlib/main.rs +++ /dev/null @@ -1,64 +0,0 @@ -//! Large archive example. -//! -//! This creates several C files with a bunch of global arrays. The goal is to -//! create an rlib that is over 4GB in size so that the LLVM archiver creates -//! a /SYM64/ entry instead of /. -//! -//! It compiles the C files to .o files, and then uses `ar` to collect them -//! into a static library. It creates `foo.rs` with references to all the C -//! arrays, and then uses `rustc` to build an rlib with that static -//! information. It then creates `bar.rs` which links the giant libfoo.rlib, -//! which should fail since it can't read the large libfoo.rlib file. - -use std::env; -use std::fs::File; -use std::io::{BufWriter, Write}; -use std::process::Command; - -// Number of object files to create. -const NOBJ: u32 = 12; -// Make the filename longer than 16 characters to force names to be placed in // -const PREFIX: &str = "abcdefghijklmnopqrstuvwxyz"; - -fn main() { - let tmpdir = std::path::PathBuf::from(env::args_os().nth(1).unwrap()); - let mut foo_rs = File::create(tmpdir.join("foo.rs")).unwrap(); - write!(foo_rs, "extern \"C\" {{\n").unwrap(); - for obj in 0..NOBJ { - let filename = tmpdir.join(&format!("{}{}.c", PREFIX, obj)); - let f = File::create(&filename).unwrap(); - let mut buf = BufWriter::new(f); - write!(buf, "#include\n").unwrap(); - for n in 0..50 { - write!(buf, "int64_t FOO_{}_{}[] = {{\n", obj, n).unwrap(); - for x in 0..1024 { - for y in 0..1024 { - write!(buf, "{},", (obj + n + x + y) % 10).unwrap(); - } - write!(buf, "\n").unwrap(); - } - write!(buf, "}};\n").unwrap(); - write!(foo_rs, " pub static FOO_{}_{}: [i64; 1024*1024];\n", obj, n).unwrap(); - } - drop(buf); - println!("compile {:?}", filename); - let status = - Command::new("cc").current_dir(&tmpdir).arg("-c").arg(&filename).status().unwrap(); - if !status.success() { - panic!("failed: {:?}", status); - } - } - write!(foo_rs, "}}\n").unwrap(); - drop(foo_rs); - let mut cmd = Command::new("ar"); - cmd.arg("-crs"); - cmd.arg(tmpdir.join("libfoo.a")); - for obj in 0..NOBJ { - cmd.arg(tmpdir.join(&format!("{}{}.o", PREFIX, obj))); - } - println!("archiving: {:?}", cmd); - let status = cmd.status().unwrap(); - if !status.success() { - panic!("failed: {:?}", status); - } -} -- cgit 1.4.1-3-g733a5 From 61922fe789c38d666e169aee471130b6abc10cbe Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 30 Aug 2021 16:47:17 +0200 Subject: Add tests for implementors associated types display --- src/test/rustdoc-gui/implementors.goml | 18 +++++++++--------- src/test/rustdoc-gui/src/lib2/implementors/lib.rs | 6 +++++- src/test/rustdoc-gui/src/lib2/lib.rs | 4 +++- src/test/rustdoc-gui/toggle-implementors.goml | 13 +++++++++++++ src/test/rustdoc/trait-impl-items-links-and-anchors.rs | 11 ++++++++++- 5 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 src/test/rustdoc-gui/toggle-implementors.goml (limited to 'src/test') diff --git a/src/test/rustdoc-gui/implementors.goml b/src/test/rustdoc-gui/implementors.goml index 87e4f2a7bd1..c9042eb4813 100644 --- a/src/test/rustdoc-gui/implementors.goml +++ b/src/test/rustdoc-gui/implementors.goml @@ -3,14 +3,14 @@ goto: file://|DOC_PATH|/implementors/trait.Whatever.html assert: "#implementors-list" // There are supposed to be two implementors listed. -assert-count: ("#implementors-list > .impl", 2) +assert-count: ("#implementors-list .impl", 2) // Now we check that both implementors have an anchor, an ID and a similar DOM. -assert: ("#implementors-list > .impl:nth-child(1) > a.anchor") -assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"}) -assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"}) -assert: "#implementors-list > .impl:nth-child(1) > .code-header.in-band" +assert: ("#implementors-list .impl:nth-child(1) > a.anchor") +assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever"}) +assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"}) +assert: "#implementors-list .impl:nth-child(1) > .code-header.in-band" -assert: ("#implementors-list > .impl:nth-child(2) > a.anchor") -assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"}) -assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) -assert: "#implementors-list > .impl:nth-child(2) > .code-header.in-band" +assert: ("#implementors-list .impl:nth-child(2) > a.anchor") +assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"}) +assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) +assert: "#implementors-list .impl:nth-child(2) > .code-header.in-band" diff --git a/src/test/rustdoc-gui/src/lib2/implementors/lib.rs b/src/test/rustdoc-gui/src/lib2/implementors/lib.rs index 4b2f6962e30..6417a6ac5af 100644 --- a/src/test/rustdoc-gui/src/lib2/implementors/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/implementors/lib.rs @@ -1,7 +1,11 @@ pub trait Whatever { + type Foo; + fn method() {} } pub struct Struct; -impl Whatever for Struct {} +impl Whatever for Struct { + type Foo = u8; +} diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 36373d24971..cb63a9f6002 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -38,7 +38,9 @@ impl Trait for Foo { } -impl implementors::Whatever for Foo {} +impl implementors::Whatever for Foo { + type Foo = u32; +} pub mod sub_mod { /// ```txt diff --git a/src/test/rustdoc-gui/toggle-implementors.goml b/src/test/rustdoc-gui/toggle-implementors.goml new file mode 100644 index 00000000000..4b2a266c712 --- /dev/null +++ b/src/test/rustdoc-gui/toggle-implementors.goml @@ -0,0 +1,13 @@ +// This test ensures two things: +// +// 1. The implementors toggle are not open by default. +// 2. The "auto-collapse-implementors" setting is working as expected. +goto: file://|DOC_PATH|/implementors/trait.Whatever.html + +// First, checking that they are not open by default. +assert-attribute-false: ("#implementors-list > details", {"open": ""}, ALL) + +// Second, checking "auto-collapse-implementors" setting. +local-storage: {"rustdoc-auto-collapse-implementors": false} +reload: +assert-attribute: ("#implementors-list > details", {"open": ""}, ALL) diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index ddbe93febdc..4d25835bf08 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -1,6 +1,6 @@ pub trait MyTrait { type Assoc; - const VALUE: u32; + const VALUE: u32 = 12; fn trait_function(&self); fn defaulted(&self) {} fn defaulted_override(&self) {} @@ -38,9 +38,11 @@ impl MyTrait for Vec { } impl MyTrait for MyStruct { + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc type Assoc = bool; + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE const VALUE: u32 = 20; @@ -55,3 +57,10 @@ impl MyTrait for MyStruct { } pub struct MyStruct; + +// We check that associated items with default values aren't generated in the implementors list. +impl MyTrait for (u8, u8) { + // @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' + type Assoc = bool; + fn trait_function(&self) {} +} -- cgit 1.4.1-3-g733a5 From 3a3bf5f1bae06e6cacf2b588a671b15fa796efff Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 1 Sep 2021 20:34:51 +0200 Subject: Remove implementors setting --- src/librustdoc/html/render/mod.rs | 1 - src/librustdoc/html/static/js/main.js | 5 ----- src/test/rustdoc-gui/toggle-implementors.goml | 11 +---------- 3 files changed, 1 insertion(+), 16 deletions(-) (limited to 'src/test') diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 864af075245..fab7440817c 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -451,7 +451,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result details", {"open": ""}, ALL) - -// Second, checking "auto-collapse-implementors" setting. -local-storage: {"rustdoc-auto-collapse-implementors": false} -reload: -assert-attribute: ("#implementors-list > details", {"open": ""}, ALL) -- cgit 1.4.1-3-g733a5 From 01ab4413e17bbbbcfe3aa32449379061a9ac9c0e Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Fri, 27 Aug 2021 19:27:45 +0300 Subject: Tracking issue for UNSUPPORTED_CALLING_CONVENTIONS --- compiler/rustc_lint_defs/src/builtin.rs | 2 +- src/test/ui/abi/unsupported.aarch64.stderr | 4 ++-- src/test/ui/abi/unsupported.x64.stderr | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/test') diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 5b1cd0bcb3f..1b416f37bde 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -3345,6 +3345,6 @@ declare_lint! { Warn, "use of unsupported calling convention", @future_incompatible = FutureIncompatibleInfo { - reference: "issue #00000 ", + reference: "issue #87678 ", }; } diff --git a/src/test/ui/abi/unsupported.aarch64.stderr b/src/test/ui/abi/unsupported.aarch64.stderr index 89017453759..fdeb79f93e9 100644 --- a/src/test/ui/abi/unsupported.aarch64.stderr +++ b/src/test/ui/abi/unsupported.aarch64.stderr @@ -42,7 +42,7 @@ LL | extern "stdcall" fn stdcall() {} | = note: `#[warn(unsupported_calling_conventions)]` on by default = 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 #00000 + = note: for more information, see issue #87678 warning: use of calling convention not supported on this target --> $DIR/unsupported.rs:44:1 @@ -51,7 +51,7 @@ LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = 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 #00000 + = note: for more information, see issue #87678 error: aborting due to 6 previous errors; 2 warnings emitted diff --git a/src/test/ui/abi/unsupported.x64.stderr b/src/test/ui/abi/unsupported.x64.stderr index 5c68461e4fb..60d067acf17 100644 --- a/src/test/ui/abi/unsupported.x64.stderr +++ b/src/test/ui/abi/unsupported.x64.stderr @@ -42,7 +42,7 @@ LL | extern "stdcall" fn stdcall() {} | = note: `#[warn(unsupported_calling_conventions)]` on by default = 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 #00000 + = note: for more information, see issue #87678 warning: use of calling convention not supported on this target --> $DIR/unsupported.rs:44:1 @@ -51,7 +51,7 @@ LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = 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 #00000 + = note: for more information, see issue #87678 error: aborting due to 6 previous errors; 2 warnings emitted -- cgit 1.4.1-3-g733a5