mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
8df39667dc
This option guards the logic of writing long type names in files and instead using short forms in error messages in rustc_middle/ty/error behind a flag. The main motivation for this change is to disable this behaviour when running ui tests. This logic can be triggered by running tests in a directory that has a long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/ This means ui tests can fail depending on how long the path to their file is. Some ui tests actually rely on this behaviour for their assertions, so for those we enable the flag manually.
98 lines
2.6 KiB
Rust
98 lines
2.6 KiB
Rust
// compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
|
|
// normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
|
|
|
|
mod a {
|
|
// Force the "short path for unique types" machinery to trip up
|
|
pub struct Atype;
|
|
pub struct Btype;
|
|
pub struct Ctype;
|
|
}
|
|
|
|
mod b {
|
|
pub struct Atype<T, K>(T, K);
|
|
pub struct Btype<T, K>(T, K);
|
|
pub struct Ctype<T, K>(T, K);
|
|
}
|
|
|
|
use b::*;
|
|
|
|
fn main() {
|
|
let x: Atype<
|
|
Btype<
|
|
Ctype<
|
|
Atype<
|
|
Btype<
|
|
Ctype<
|
|
Atype<
|
|
Btype<
|
|
Ctype<i32, i32>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
> = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
|
Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
|
Ok("")
|
|
))))))))))))))))))))))))))))))
|
|
))))))))))))))))))))))))))))));
|
|
//~^^^^^ ERROR E0308
|
|
|
|
let _ = Some(Ok(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(
|
|
Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(
|
|
Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(
|
|
Some(Some(Some(Some(Some(Some(Some(Some(Some("")))))))))
|
|
)))))))))))))))))
|
|
))))))))))))))))))
|
|
))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
|
Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
|
Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
|
))))))))))))))))))))))))))))))
|
|
))))))))))))))))))))))));
|
|
//~^^^^^ ERROR E0308
|
|
|
|
let x: Atype<
|
|
Btype<
|
|
Ctype<
|
|
Atype<
|
|
Btype<
|
|
Ctype<
|
|
Atype<
|
|
Btype<
|
|
Ctype<i32, i32>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
>,
|
|
i32
|
|
> = ();
|
|
//~^ ERROR E0308
|
|
|
|
let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
|
Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(
|
|
Ok(Ok(Ok(Ok(Ok(Ok(Ok("")))))))
|
|
))))))))))))))))))))))))))))))
|
|
))))))))))))))))))))))));
|
|
//~^^^^^ ERROR E0308
|
|
}
|