You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
strip prefix of temporary file names when it exceeds filesystem name length limit
When doing lto, rustc generates filenames that are concatenating many information.
In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension.
In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where
filename max length is 255
This commit is ensuring that the temporary file names are limited in size, while still reasonabily ensuring the unicity (with hashing of the stripped part)
// This file has very long lines, but there is no way to avoid it as we are testing
2
+
// long crate names. so:
3
+
// ignore-tidy-linelength
4
+
5
+
// A variant of the smoke test to check that link time optimization
6
+
// (LTO) is accepted by the compiler, and that
7
+
// passing its various flags still results in successful compilation, even for very long crate names.
8
+
// See https://github.com/rust-lang/rust/issues/49914
9
+
10
+
//@ ignore-cross-compile
11
+
12
+
use std::fs;
13
+
14
+
use run_make_support::rustc;
15
+
16
+
// This test make sure we don't get such following error:
17
+
// error: could not write output to generated_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_crate_name.generated_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_crate_name.9384edb61bfd127c-cgu.0.rcgu.o: File name too long
18
+
// as reported in issue #49914
19
+
fnmain(){
20
+
let lto_flags = ["-Clto","-Clto=yes","-Clto=off","-Clto=thin","-Clto=fat"];
21
+
let aux_file = "generated_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_large_crate_name.rs";
22
+
// The auxiliary file is used to test long crate names.
23
+
// The file name is intentionally long to test the handling of long filenames.
24
+
// but we don't commit it to avoid issues with windows paths, which have a limitation for the full path length.
25
+
// Linux only has a limit for the length of the file name.
26
+
// and we want to make sure we can compile files with long names.
27
+
fs::write(aux_file,"#![crate_type = \"rlib\"]\n").expect("Failed to write lib.rs");
0 commit comments