Skip to content

Commit 0d9a57d

Browse files
Rollup merge of rust-lang#133470 - jieyouxu:ugly, r=compiler-errors
Cleanup: delete `//@ pretty-expanded` directive This PR removes the `//@ pretty-expanded` directive support in compiletest and removes its usage inside ui tests because it does not actually do anything, and its existence is itself misleading. This PR is split into two commits: 1. The first commit just drops `pretty-expanded` directive support in compiletest. 2. The second commit is created by `sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs`[^1], reblessing, and slightly adjusting some leading whitespace in a few tests. We can tell this is fully removed because compiletest doesn't complain about unknown directive when running the `ui` test suite. cc rust-lang#23616 ### History Originally, there was some effort to introduce more test coverage for `-Z unpretty=expanded` (in 2015 this was called `--pretty=expanded`). In [Make it an error to not declare used features rust-lang#23598][pr-23598], there was a flip from `//@ no-pretty-expanded` (opt-out of `-Z unpretty=expanded` test) to `//@ pretty-expanded` (opt-in to `-Z unpretty=expanded` test). This was needed because back then the dedicated `tests/pretty` ("pretty") test suite did not existed, and the pretty tests were grouped together under `run-pass` tests (I believe the `ui` test suite didn't exist back then either). Unfortunately, in this process the replacement `//@ pretty-expanded` directives contained a `FIXME rust-lang#23616` linking to [There are very few tests for `-Z unpretty` expansion rust-lang#23616][issue-23616]. But this was arguably backwards and somewhat misleading, as noted in [rust-lang#23616](rust-lang#23616 (comment)): The attribute is off by default and things just work if you don't test it, people have not been adding the `pretty-expanded` annotation to new tests even if it would work. Which basically renders this useless. ### Current status As of Nov 2024, we have a dedicated `pretty` test suite, and some time over the years the split between `run-pass` into `ui` and `pretty` test suites caused all the `//@ pretty-expanded` in `ui` tests to do absolutely nothing: the compiletest logic for `pretty-expanded` only triggers in the *pretty* test suite, but none of the pretty tests use it. Oops. Nobody remembers this, nobody uses this, it's misleading in ui tests. Let's get rid of this directive altogether. [pr-23598]: rust-lang#23598 [issue-23616]: rust-lang#23616 ### Follow-ups - [x] Yeet this directive from rustc-dev-guide docs. rust-lang/rustc-dev-guide#2147 [^1]: https://github.com/chmln/sd r? compiler
2 parents c8c225f + 95ff642 commit 0d9a57d

File tree

659 files changed

+23
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

659 files changed

+23
-684
lines changed

Diff for: src/tools/compiletest/src/directive-list.rs

-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
214214
"only-x86_64-unknown-linux-gnu",
215215
"pp-exact",
216216
"pretty-compare-only",
217-
"pretty-expanded",
218217
"pretty-mode",
219218
"reference",
220219
"regex-error-pattern",

Diff for: src/tools/compiletest/src/header.rs

-5
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ pub struct TestProps {
124124
// a proc-macro and needs `#![crate_type = "proc-macro"]`. This ensures
125125
// that the aux file is compiled as a `proc-macro` and not as a `dylib`.
126126
pub no_prefer_dynamic: bool,
127-
// Run -Zunpretty expanded when running pretty printing tests
128-
pub pretty_expanded: bool,
129127
// Which pretty mode are we testing with, default to 'normal'
130128
pub pretty_mode: String,
131129
// Only compare pretty output and don't try compiling
@@ -218,7 +216,6 @@ mod directives {
218216
pub const DONT_CHECK_COMPILER_STDOUT: &'static str = "dont-check-compiler-stdout";
219217
pub const DONT_CHECK_COMPILER_STDERR: &'static str = "dont-check-compiler-stderr";
220218
pub const NO_PREFER_DYNAMIC: &'static str = "no-prefer-dynamic";
221-
pub const PRETTY_EXPANDED: &'static str = "pretty-expanded";
222219
pub const PRETTY_MODE: &'static str = "pretty-mode";
223220
pub const PRETTY_COMPARE_ONLY: &'static str = "pretty-compare-only";
224221
pub const AUX_BIN: &'static str = "aux-bin";
@@ -278,7 +275,6 @@ impl TestProps {
278275
dont_check_compiler_stderr: false,
279276
compare_output_lines_by_subset: false,
280277
no_prefer_dynamic: false,
281-
pretty_expanded: false,
282278
pretty_mode: "normal".to_string(),
283279
pretty_compare_only: false,
284280
forbid_output: vec![],
@@ -425,7 +421,6 @@ impl TestProps {
425421
&mut self.dont_check_compiler_stderr,
426422
);
427423
config.set_name_directive(ln, NO_PREFER_DYNAMIC, &mut self.no_prefer_dynamic);
428-
config.set_name_directive(ln, PRETTY_EXPANDED, &mut self.pretty_expanded);
429424

430425
if let Some(m) = config.parse_name_value_directive(ln, PRETTY_MODE) {
431426
self.pretty_mode = m;

Diff for: src/tools/compiletest/src/runtest/pretty.rs

-16
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,5 @@ impl TestCx<'_> {
8484
if !proc_res.status.success() {
8585
self.fatal_proc_rec("pretty-printed source does not typecheck", &proc_res);
8686
}
87-
88-
if !self.props.pretty_expanded {
89-
return;
90-
}
91-
92-
// additionally, run `-Zunpretty=expanded` and try to build it.
93-
let proc_res = self.print_source(ReadFrom::Path, "expanded");
94-
if !proc_res.status.success() {
95-
self.fatal_proc_rec("pretty-printing (expanded) failed", &proc_res);
96-
}
97-
98-
let ProcRes { stdout: expanded_src, .. } = proc_res;
99-
let proc_res = self.typecheck_source(expanded_src);
100-
if !proc_res.status.success() {
101-
self.fatal_proc_rec("pretty-printed source (expanded) does not typecheck", &proc_res);
102-
}
10387
}
10488
}

Diff for: tests/ui/abi/anon-extern-mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ run-pass
2-
//@ pretty-expanded FIXME #23616
32

43
#[link(name = "rust_test_helpers", kind = "static")]
54
extern "C" {

Diff for: tests/ui/abi/c-stack-as-value.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ run-pass
2-
//@ pretty-expanded FIXME #23616
32

43
mod rustrt {
54
#[link(name = "rust_test_helpers", kind = "static")]

Diff for: tests/ui/abi/cross-crate/anon-extern-mod-cross-crate-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ run-pass
22
//@ aux-build:anon-extern-mod-cross-crate-1.rs
3-
//@ pretty-expanded FIXME #23616
43

54
extern crate anonexternmod;
65

Diff for: tests/ui/abi/cross-crate/duplicated-external-mods.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ run-pass
22
//@ aux-build:anon-extern-mod-cross-crate-1.rs
33
//@ aux-build:anon-extern-mod-cross-crate-1.rs
4-
//@ pretty-expanded FIXME #23616
54

65
extern crate anonexternmod;
76

Diff for: tests/ui/abi/extern/extern-pass-empty.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
// Test a foreign function that accepts empty struct.
55

6-
//@ pretty-expanded FIXME #23616
76
//@ ignore-msvc
87
//@ ignore-emscripten emcc asserts on an empty struct as an argument
98

Diff for: tests/ui/abi/foreign/invoke-external-foreign.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// successfully (and safely) invoke external, cdecl
66
// functions from outside the crate.
77

8-
//@ pretty-expanded FIXME #23616
98

109
extern crate foreign_lib;
1110

Diff for: tests/ui/alias-uninit-value.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
// Regression test for issue #374
99

10-
//@ pretty-expanded FIXME #23616
1110

1211
enum sty { ty_nil, }
1312

Diff for: tests/ui/array-slice-vec/cast-in-array-size.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
// issues #10618 and #16382
5-
//@ pretty-expanded FIXME #23616
65

76
const SIZE: isize = 25;
87

Diff for: tests/ui/array-slice-vec/empty-mutable-vec.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ run-pass
22

3-
//@ pretty-expanded FIXME #23616
43

54
#![allow(unused_mut)]
65

Diff for: tests/ui/array-slice-vec/issue-15730.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ run-pass
22
#![allow(unused_mut)]
33
#![allow(unused_variables)]
4-
//@ pretty-expanded FIXME #23616
54

65
fn main() {
76
let mut array = [1, 2, 3];

Diff for: tests/ui/array-slice-vec/issue-18425.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Check that codegen doesn't ICE when codegenning an array repeat
33
// expression with a count of 1 and a non-Copy element type.
44

5-
//@ pretty-expanded FIXME #23616
65

76
fn main() {
87
let _ = [Box::new(1_usize); 1];

Diff for: tests/ui/array-slice-vec/mut-vstore-expr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ run-pass
2-
//@ pretty-expanded FIXME #23616
32

43
pub fn main() {
54
let _x: &mut [isize] = &mut [ 1, 2, 3 ];

Diff for: tests/ui/array-slice-vec/vec-macro-with-brackets.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ run-pass
22
#![allow(unused_variables)]
33

4-
//@ pretty-expanded FIXME #23616
54

65
macro_rules! vec [
76
($($e:expr),*) => ({

Diff for: tests/ui/array-slice-vec/vec-repeat-with-cast.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ run-pass
22

3-
//@ pretty-expanded FIXME #23616
43

54
pub fn main() { let _a = [0; 1 as usize]; }

Diff for: tests/ui/array-slice-vec/vector-no-ann-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ run-pass
22

3-
//@ pretty-expanded FIXME #23616
43

54
pub fn main() {
65
let _quux: Box<Vec<usize>> = Box::new(Vec::new());

Diff for: tests/ui/associated-types/associated-types-binding-in-where-clause.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ run-pass
22
// Test equality constraints on associated types in a where clause.
33

4-
//@ pretty-expanded FIXME #23616
54

65
pub trait Foo {
76
type A;

Diff for: tests/ui/associated-types/associated-types-conditional-dispatch.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// `Target=[A]`, then the impl marked with `(*)` is seen to conflict
66
// with all the others.
77

8-
//@ pretty-expanded FIXME #23616
98

109
use std::marker::PhantomData;
1110
use std::ops::Deref;

Diff for: tests/ui/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// (modulo bound lifetime names) appears in the environment
55
// twice. Issue #21965.
66

7-
//@ pretty-expanded FIXME #23616
87

98
fn foo<T>(t: T) -> i32
109
where T : for<'a> Fn(&'a u8) -> i32,

Diff for: tests/ui/associated-types/associated-types-duplicate-binding-in-env.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Check that we do not report ambiguities when the same predicate
44
// appears in the environment twice. Issue #21965.
55

6-
//@ pretty-expanded FIXME #23616
76

87
trait Foo {
98
type B;

Diff for: tests/ui/associated-types/associated-types-eq-obj.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ run-pass
22
// Test equality constraints on associated types inside of an object type
33

4-
//@ pretty-expanded FIXME #23616
54

65
pub trait Foo {
76
type A;

Diff for: tests/ui/associated-types/associated-types-issue-20371.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Test that we are able to have an impl that defines an associated type
33
// before the actual trait.
44

5-
//@ pretty-expanded FIXME #23616
65

76
impl X for f64 { type Y = isize; }
87
trait X { type Y; }

Diff for: tests/ui/associated-types/associated-types-nested-projections.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(unused_variables)]
33
// Test that we can resolve nested projection types. Issue #20666.
44

5-
//@ pretty-expanded FIXME #23616
65

76
use std::slice;
87

Diff for: tests/ui/associated-types/associated-types-nested-projections.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: method `into_iter` is never used
2-
--> $DIR/associated-types-nested-projections.rs:16:8
2+
--> $DIR/associated-types-nested-projections.rs:15:8
33
|
44
LL | trait IntoIterator {
55
| ------------ method in this trait

Diff for: tests/ui/associated-types/associated-types-normalize-in-bounds-binding.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Test that we normalize associated types that appear in a bound that
44
// contains a binding. Issue #21664.
55

6-
//@ pretty-expanded FIXME #23616
76

87
#![allow(dead_code)]
98

Diff for: tests/ui/associated-types/associated-types-normalize-in-bounds-ufcs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Test that we normalize associated types that appear in bounds; if
44
// we didn't, the call to `self.split2()` fails to type check.
55

6-
//@ pretty-expanded FIXME #23616
76

87
use std::marker::PhantomData;
98

Diff for: tests/ui/associated-types/associated-types-normalize-in-bounds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Test that we normalize associated types that appear in bounds; if
44
// we didn't, the call to `self.split2()` fails to type check.
55

6-
//@ pretty-expanded FIXME #23616
76

87
use std::marker::PhantomData;
98

Diff for: tests/ui/associated-types/associated-types-projection-in-object-type.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// appear in associated type bindings in object types, which were not
77
// being properly flagged.
88

9-
//@ pretty-expanded FIXME #23616
109

1110
use std::ops::{Shl, Shr};
1211
use std::cell::RefCell;

Diff for: tests/ui/associated-types/associated-types-projection-in-where-clause.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![allow(unused_variables)]
44
// Test a where clause that uses a non-normalized projection type.
55

6-
//@ pretty-expanded FIXME #23616
76

87
trait Int
98
{

Diff for: tests/ui/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ check-pass
2-
//@ pretty-expanded FIXME #23616
32

43
trait Foo<T> {
54
type Bar;

Diff for: tests/ui/associated-types/associated-types-ref-from-struct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ run-pass
22
// Test associated type references in structure fields.
33

4-
//@ pretty-expanded FIXME #23616
54

65
trait Test {
76
type V;

Diff for: tests/ui/associated-types/associated-types-region-erasure-issue-20582.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Regression test for #20582. This test caused an ICE related to
44
// inconsistent region erasure in codegen.
55

6-
//@ pretty-expanded FIXME #23616
76

87
struct Foo<'a> {
98
buf: &'a[u8]

Diff for: tests/ui/associated-types/associated-types-resolve-lifetime.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ check-pass
2-
//@ pretty-expanded FIXME #23616
32

43
trait Get<T> {
54
fn get(&self) -> T;

Diff for: tests/ui/associated-types/issue-19129-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ check-pass
2-
//@ pretty-expanded FIXME #23616
32

43
trait Trait<Input> {
54
type Output;

Diff for: tests/ui/associated-types/issue-19129-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22
#![allow(unused_variables)]
3-
//@ pretty-expanded FIXME #23616
43

54
trait Trait<Input> {
65
type Output;

Diff for: tests/ui/associated-types/issue-20763-1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22
#![allow(dead_code)]
3-
//@ pretty-expanded FIXME #23616
43

54
trait T0 {
65
type O;

Diff for: tests/ui/associated-types/issue-20763-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22
#![allow(dead_code)]
3-
//@ pretty-expanded FIXME #23616
43

54
trait T0 {
65
type O;

Diff for: tests/ui/associated-types/issue-21363.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ check-pass
2-
//@ pretty-expanded FIXME #23616
32

43
#![no_implicit_prelude]
54

Diff for: tests/ui/associated-types/issue-21726.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// subtyping of projection types that resulted in an unconstrained
55
// region, yielding region inference failures.
66

7-
//@ pretty-expanded FIXME #23616
87

98
fn main() { }
109

Diff for: tests/ui/associated-types/issue-22828.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Test transitive analysis for associated types. Collected types
44
// should be normalized and new obligations generated.
55

6-
//@ pretty-expanded FIXME #23616
76

87
trait Foo {
98
type A;

Diff for: tests/ui/attr-start.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ run-pass
2-
//@ pretty-expanded FIXME #23616
32

43
#![feature(start)]
54

Diff for: tests/ui/attributes/attr-before-view-item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ build-pass (FIXME(62277): could be check-pass?)
2-
//@ pretty-expanded FIXME #23616
32

43
#![feature(rustc_attrs)]
54
#![feature(test)]

Diff for: tests/ui/attributes/attr-before-view-item2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ build-pass (FIXME(62277): could be check-pass?)
2-
//@ pretty-expanded FIXME #23616
32

43
#![feature(rustc_attrs)]
54
#![feature(test)]

Diff for: tests/ui/attributes/attr-mix-new.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ build-pass (FIXME(62277): could be check-pass?)
2-
//@ pretty-expanded FIXME #23616
32

43
#![feature(rustc_attrs)]
54

Diff for: tests/ui/attributes/method-attributes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ build-pass (FIXME(62277): could be check-pass?)
22
//@ pp-exact - Make sure we print all the attributes
3-
//@ pretty-expanded FIXME #23616
43

54
#![feature(rustc_attrs)]
65

Diff for: tests/ui/attributes/variant-attributes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ build-pass (FIXME(62277): could be check-pass?)
22
//@ pp-exact - Make sure we actually print the attributes
3-
//@ pretty-expanded FIXME #23616
43

54
#![allow(non_camel_case_types)]
65
#![feature(rustc_attrs)]

Diff for: tests/ui/autoref-autoderef/autoderef-and-borrow-method-receiver.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ run-pass
22
#![allow(dead_code)]
3-
//@ pretty-expanded FIXME #23616
43

54
struct Foo {
65
x: isize,

0 commit comments

Comments
 (0)