File tree Expand file tree Collapse file tree 5 files changed +35
-10
lines changed
lto-avoid-object-duplication Expand file tree Collapse file tree 5 files changed +35
-10
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,20 @@ impl CompletedProcess {
182182 self
183183 }
184184
185+ pub fn assert_stdout_contains < S : AsRef < str > > ( & self , expected : S ) -> & Self {
186+ let stdout = self . stdout_utf8 ( ) ;
187+ let stdout_trimmed = stdout. trim ( ) ;
188+ let expected_trimmed = expected. as_ref ( ) . trim ( ) ;
189+ if !self . stdout_utf8 ( ) . contains ( expected. as_ref ( ) ) {
190+ eprintln ! ( "=== STDOUT (ACTUAL) TRIMMED ===" ) ;
191+ eprintln ! ( "{}" , stdout_trimmed) ;
192+ eprintln ! ( "=== EXPECTED TRIMMED ===" ) ;
193+ eprintln ! ( "{}" , expected_trimmed) ;
194+ panic ! ( "trimmed stdout does not contain trimmed expected" ) ;
195+ }
196+ self
197+ }
198+
185199 /// Checks that trimmed `stderr` matches trimmed `content`.
186200 #[ track_caller]
187201 pub fn assert_stderr_equals < S : AsRef < str > > ( & self , content : S ) -> & Self {
Original file line number Diff line number Diff line change @@ -146,7 +146,6 @@ run-make/native-link-modifier-verbatim-rustc/Makefile
146146run-make/native-link-modifier-whole-archive/Makefile
147147run-make/no-alloc-shim/Makefile
148148run-make/no-builtins-attribute/Makefile
149- run-make/no-builtins-lto/Makefile
150149run-make/no-duplicate-libs/Makefile
151150run-make/obey-crate-type-flag/Makefile
152151run-make/optimization-remarks-dir-pgo/Makefile
Original file line number Diff line number Diff line change 1+ // ignore-tidy-tab
12// Staticlibs don't include Rust object files from upstream crates if the same
23// code was already pulled into the lib via LTO. However, the bug described in
34// https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // The rlib produced by a no_builtins crate should be explicitely linked
2+ // during compilation, and as a result be present in the linker arguments.
3+ // See the comments inside the test for more details.
4+ // See https://github.com/rust-lang/rust/pull/35637
5+
6+ use run_make_support:: { rust_lib_name, rustc} ;
7+
8+ fn main ( ) {
9+ // Compile a `#![no_builtins]` rlib crate
10+ rustc ( ) . input ( "no_builtins.rs" ) . run ( ) ;
11+ // Build an executable that depends on that crate using LTO. The no_builtins crate doesn't
12+ // participate in LTO, so its rlib must be explicitly
13+ // linked into the final binary. Verify this by grepping the linker arguments.
14+ rustc ( )
15+ . input ( "main.rs" )
16+ . arg ( "-Clto" )
17+ . print ( "link-args" )
18+ . run ( )
19+ . assert_stdout_contains ( rust_lib_name ( "no_builtins" ) ) ;
20+ }
You can’t perform that action at this time.
0 commit comments