about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-05-30 19:58:49 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-06-10 14:09:51 -0700
commit7cde07e5cc5cfc1665dd64e4c06482c2f10b693a (patch)
tree3ab5cf21ade5b31a5e21aa79724b2d47837a5333
parentc29b3fa1484c625bd34cb4d94fc76f36c6233447 (diff)
downloadrust-7cde07e5cc5cfc1665dd64e4c06482c2f10b693a.tar.gz
rust-7cde07e5cc5cfc1665dd64e4c06482c2f10b693a.zip
review comments: only suggest one substitution
-rw-r--r--src/librustc_trait_selection/traits/error_reporting/mod.rs49
-rw-r--r--src/test/ui/infinite/infinite-tag-type-recursion.stderr6
-rw-r--r--src/test/ui/issues/issue-17431-1.stderr6
-rw-r--r--src/test/ui/issues/issue-17431-2.stderr12
-rw-r--r--src/test/ui/issues/issue-17431-3.stderr6
-rw-r--r--src/test/ui/issues/issue-17431-4.stderr6
-rw-r--r--src/test/ui/issues/issue-17431-5.stderr6
-rw-r--r--src/test/ui/issues/issue-17431-6.stderr6
-rw-r--r--src/test/ui/issues/issue-17431-7.stderr6
-rw-r--r--src/test/ui/issues/issue-2718-a.stderr6
-rw-r--r--src/test/ui/issues/issue-3008-1.stderr6
-rw-r--r--src/test/ui/issues/issue-3008-2.stderr6
-rw-r--r--src/test/ui/issues/issue-3008-3.stderr6
-rw-r--r--src/test/ui/issues/issue-3779.stderr6
-rw-r--r--src/test/ui/issues/issue-57271.stderr12
-rw-r--r--src/test/ui/recursion/recursive-enum.stderr6
-rw-r--r--src/test/ui/sized-cycle-note.stderr12
-rw-r--r--src/test/ui/span/E0072.stderr6
-rw-r--r--src/test/ui/span/multiline-span-E0072.stderr6
-rw-r--r--src/test/ui/span/recursive-type-field.stderr6
-rw-r--r--src/test/ui/type/type-recursive.stderr6
-rw-r--r--src/test/ui/union/union-nonrepresentable.stderr6
22 files changed, 38 insertions, 155 deletions
diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs
index 3457f7b4580..d31e04cffd5 100644
--- a/src/librustc_trait_selection/traits/error_reporting/mod.rs
+++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs
@@ -1759,48 +1759,27 @@ pub fn recursive_type_with_infinite_size_error(
     for &span in &spans {
         err.span_label(span, "recursive without indirection");
     }
-    let short_msg = format!("insert some indirection to make `{}` representable", path);
     let msg = format!(
         "insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `{}` representable",
         path,
     );
-    match &spans[..] {
-        [span] => {
-            err.multipart_suggestions(
-                &short_msg,
-                vec![
+    if spans.len() <= 4 {
+        err.multipart_suggestion(
+            &msg,
+            spans
+                .iter()
+                .flat_map(|&span| {
                     vec![
                         (span.shrink_to_lo(), "Box<".to_string()),
                         (span.shrink_to_hi(), ">".to_string()),
-                    ],
-                    vec![
-                        (span.shrink_to_lo(), "Rc<".to_string()),
-                        (span.shrink_to_hi(), ">".to_string()),
-                    ],
-                    vec![(span.shrink_to_lo(), "&".to_string())],
-                ],
-                Applicability::HasPlaceholders,
-            );
-        }
-        _ if spans.len() <= 4 => {
-            err.multipart_suggestion(
-                &msg,
-                spans
-                    .iter()
-                    .flat_map(|&span| {
-                        vec![
-                            (span.shrink_to_lo(), "Box<".to_string()),
-                            (span.shrink_to_hi(), ">".to_string()),
-                        ]
-                        .into_iter()
-                    })
-                    .collect(),
-                Applicability::HasPlaceholders,
-            );
-        }
-        _ => {
-            err.help(&msg);
-        }
+                    ]
+                    .into_iter()
+                })
+                .collect(),
+            Applicability::HasPlaceholders,
+        );
+    } else {
+        err.help(&msg);
     }
     err.emit();
 }
diff --git a/src/test/ui/infinite/infinite-tag-type-recursion.stderr b/src/test/ui/infinite/infinite-tag-type-recursion.stderr
index b6a4d8f4cf5..6d1df4fda2e 100644
--- a/src/test/ui/infinite/infinite-tag-type-recursion.stderr
+++ b/src/test/ui/infinite/infinite-tag-type-recursion.stderr
@@ -6,14 +6,10 @@ LL | enum MList { Cons(isize, MList), Nil }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `MList` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `MList` representable
    |
 LL | enum MList { Cons(isize, Box<MList>), Nil }
    |                          ^^^^     ^
-LL | enum MList { Cons(isize, Rc<MList>), Nil }
-   |                          ^^^     ^
-LL | enum MList { Cons(isize, &MList), Nil }
-   |                          ^
 
 error[E0391]: cycle detected when computing drop-check constraints for `MList`
   --> $DIR/infinite-tag-type-recursion.rs:1:1
diff --git a/src/test/ui/issues/issue-17431-1.stderr b/src/test/ui/issues/issue-17431-1.stderr
index 8d44154650e..58d087ca199 100644
--- a/src/test/ui/issues/issue-17431-1.stderr
+++ b/src/test/ui/issues/issue-17431-1.stderr
@@ -6,14 +6,10 @@ LL | struct Foo { foo: Option<Option<Foo>> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | struct Foo { foo: Box<Option<Option<Foo>>> }
    |                   ^^^^                   ^
-LL | struct Foo { foo: Rc<Option<Option<Foo>>> }
-   |                   ^^^                   ^
-LL | struct Foo { foo: &Option<Option<Foo>> }
-   |                   ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-17431-2.stderr b/src/test/ui/issues/issue-17431-2.stderr
index b06184e84da..eba4bf6d1d5 100644
--- a/src/test/ui/issues/issue-17431-2.stderr
+++ b/src/test/ui/issues/issue-17431-2.stderr
@@ -6,14 +6,10 @@ LL | struct Baz { q: Option<Foo> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Baz` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Baz` representable
    |
 LL | struct Baz { q: Box<Option<Foo>> }
    |                 ^^^^           ^
-LL | struct Baz { q: Rc<Option<Foo>> }
-   |                 ^^^           ^
-LL | struct Baz { q: &Option<Foo> }
-   |                 ^
 
 error[E0072]: recursive type `Foo` has infinite size
   --> $DIR/issue-17431-2.rs:4:1
@@ -23,14 +19,10 @@ LL | struct Foo { q: Option<Baz> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | struct Foo { q: Box<Option<Baz>> }
    |                 ^^^^           ^
-LL | struct Foo { q: Rc<Option<Baz>> }
-   |                 ^^^           ^
-LL | struct Foo { q: &Option<Baz> }
-   |                 ^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-17431-3.stderr b/src/test/ui/issues/issue-17431-3.stderr
index f32bd70fd6d..f6b15d0528a 100644
--- a/src/test/ui/issues/issue-17431-3.stderr
+++ b/src/test/ui/issues/issue-17431-3.stderr
@@ -6,14 +6,10 @@ LL | struct Foo { foo: Mutex<Option<Foo>> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | struct Foo { foo: Box<Mutex<Option<Foo>>> }
    |                   ^^^^                  ^
-LL | struct Foo { foo: Rc<Mutex<Option<Foo>>> }
-   |                   ^^^                  ^
-LL | struct Foo { foo: &Mutex<Option<Foo>> }
-   |                   ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-17431-4.stderr b/src/test/ui/issues/issue-17431-4.stderr
index 372c5e975c8..aa709e1ad51 100644
--- a/src/test/ui/issues/issue-17431-4.stderr
+++ b/src/test/ui/issues/issue-17431-4.stderr
@@ -6,14 +6,10 @@ LL | struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T>
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | struct Foo<T> { foo: Box<Option<Option<Foo<T>>>>, marker: marker::PhantomData<T> }
    |                      ^^^^                      ^
-LL | struct Foo<T> { foo: Rc<Option<Option<Foo<T>>>>, marker: marker::PhantomData<T> }
-   |                      ^^^                      ^
-LL | struct Foo<T> { foo: &Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
-   |                      ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-17431-5.stderr b/src/test/ui/issues/issue-17431-5.stderr
index 01b850ac336..1558cffb036 100644
--- a/src/test/ui/issues/issue-17431-5.stderr
+++ b/src/test/ui/issues/issue-17431-5.stderr
@@ -6,14 +6,10 @@ LL | struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Bar` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Bar` representable
    |
 LL | struct Bar<T> { x: Box<Bar<Foo>> , marker: marker::PhantomData<T> }
    |                    ^^^^        ^
-LL | struct Bar<T> { x: Rc<Bar<Foo>> , marker: marker::PhantomData<T> }
-   |                    ^^^        ^
-LL | struct Bar<T> { x: &Bar<Foo> , marker: marker::PhantomData<T> }
-   |                    ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-17431-6.stderr b/src/test/ui/issues/issue-17431-6.stderr
index ce6c2db07fb..f2aa2a79c82 100644
--- a/src/test/ui/issues/issue-17431-6.stderr
+++ b/src/test/ui/issues/issue-17431-6.stderr
@@ -6,14 +6,10 @@ LL | enum Foo { X(Mutex<Option<Foo>>) }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | enum Foo { X(Box<Mutex<Option<Foo>>>) }
    |              ^^^^                  ^
-LL | enum Foo { X(Rc<Mutex<Option<Foo>>>) }
-   |              ^^^                  ^
-LL | enum Foo { X(&Mutex<Option<Foo>>) }
-   |              ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-17431-7.stderr b/src/test/ui/issues/issue-17431-7.stderr
index 4fb563ba502..684c3089e85 100644
--- a/src/test/ui/issues/issue-17431-7.stderr
+++ b/src/test/ui/issues/issue-17431-7.stderr
@@ -6,14 +6,10 @@ LL | enum Foo { Voo(Option<Option<Foo>>) }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | enum Foo { Voo(Box<Option<Option<Foo>>>) }
    |                ^^^^                   ^
-LL | enum Foo { Voo(Rc<Option<Option<Foo>>>) }
-   |                ^^^                   ^
-LL | enum Foo { Voo(&Option<Option<Foo>>) }
-   |                ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-2718-a.stderr b/src/test/ui/issues/issue-2718-a.stderr
index 48b7a61e059..d152ffde4e5 100644
--- a/src/test/ui/issues/issue-2718-a.stderr
+++ b/src/test/ui/issues/issue-2718-a.stderr
@@ -7,14 +7,10 @@ LL |     pub struct Pong(SendPacket<Ping>);
    |     |               recursive without indirection
    |     recursive type has infinite size
    |
-help: insert some indirection to make `pingpong::Pong` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `pingpong::Pong` representable
    |
 LL |     pub struct Pong(Box<SendPacket<Ping>>);
    |                     ^^^^                ^
-LL |     pub struct Pong(Rc<SendPacket<Ping>>);
-   |                     ^^^                ^
-LL |     pub struct Pong(&SendPacket<Ping>);
-   |                     ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-3008-1.stderr b/src/test/ui/issues/issue-3008-1.stderr
index d1173a4b333..87ee36df216 100644
--- a/src/test/ui/issues/issue-3008-1.stderr
+++ b/src/test/ui/issues/issue-3008-1.stderr
@@ -7,14 +7,10 @@ LL | enum Bar {
 LL |     BarSome(Bar)
    |             --- recursive without indirection
    |
-help: insert some indirection to make `Bar` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Bar` representable
    |
 LL |     BarSome(Box<Bar>)
    |             ^^^^   ^
-LL |     BarSome(Rc<Bar>)
-   |             ^^^   ^
-LL |     BarSome(&Bar)
-   |             ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-3008-2.stderr b/src/test/ui/issues/issue-3008-2.stderr
index 4fd60639b21..369a19d37e6 100644
--- a/src/test/ui/issues/issue-3008-2.stderr
+++ b/src/test/ui/issues/issue-3008-2.stderr
@@ -6,14 +6,10 @@ LL | struct Bar { x: Bar }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Bar` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Bar` representable
    |
 LL | struct Bar { x: Box<Bar> }
    |                 ^^^^   ^
-LL | struct Bar { x: Rc<Bar> }
-   |                 ^^^   ^
-LL | struct Bar { x: &Bar }
-   |                 ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-3008-3.stderr b/src/test/ui/issues/issue-3008-3.stderr
index e6efad91883..0b162eff94a 100644
--- a/src/test/ui/issues/issue-3008-3.stderr
+++ b/src/test/ui/issues/issue-3008-3.stderr
@@ -6,14 +6,10 @@ LL | enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `E2` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `E2` representable
    |
 LL | enum E2<T> { V2(Box<E2<E1>>, marker::PhantomData<T>), }
    |                 ^^^^      ^
-LL | enum E2<T> { V2(Rc<E2<E1>>, marker::PhantomData<T>), }
-   |                 ^^^      ^
-LL | enum E2<T> { V2(&E2<E1>, marker::PhantomData<T>), }
-   |                 ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-3779.stderr b/src/test/ui/issues/issue-3779.stderr
index 9b50ddec12a..7b17e914216 100644
--- a/src/test/ui/issues/issue-3779.stderr
+++ b/src/test/ui/issues/issue-3779.stderr
@@ -7,14 +7,10 @@ LL |
 LL |     element: Option<S>
    |              --------- recursive without indirection
    |
-help: insert some indirection to make `S` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `S` representable
    |
 LL |     element: Box<Option<S>>
    |              ^^^^         ^
-LL |     element: Rc<Option<S>>
-   |              ^^^         ^
-LL |     element: &Option<S>
-   |              ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-57271.stderr b/src/test/ui/issues/issue-57271.stderr
index a6fe83a9b56..b7c799e163c 100644
--- a/src/test/ui/issues/issue-57271.stderr
+++ b/src/test/ui/issues/issue-57271.stderr
@@ -7,14 +7,10 @@ LL |     Class(ClassTypeSignature),
 LL |     Array(TypeSignature),
    |           ------------- recursive without indirection
    |
-help: insert some indirection to make `ObjectType` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ObjectType` representable
    |
 LL |     Array(Box<TypeSignature>),
    |           ^^^^             ^
-LL |     Array(Rc<TypeSignature>),
-   |           ^^^             ^
-LL |     Array(&TypeSignature),
-   |           ^
 
 error[E0072]: recursive type `TypeSignature` has infinite size
   --> $DIR/issue-57271.rs:19:1
@@ -25,14 +21,10 @@ LL |     Base(BaseType),
 LL |     Object(ObjectType),
    |            ---------- recursive without indirection
    |
-help: insert some indirection to make `TypeSignature` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `TypeSignature` representable
    |
 LL |     Object(Box<ObjectType>),
    |            ^^^^          ^
-LL |     Object(Rc<ObjectType>),
-   |            ^^^          ^
-LL |     Object(&ObjectType),
-   |            ^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/recursion/recursive-enum.stderr b/src/test/ui/recursion/recursive-enum.stderr
index c68badd458b..ab4709d8e70 100644
--- a/src/test/ui/recursion/recursive-enum.stderr
+++ b/src/test/ui/recursion/recursive-enum.stderr
@@ -6,14 +6,10 @@ LL | enum List<T> { Cons(T, List<T>), Nil }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `List` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `List` representable
    |
 LL | enum List<T> { Cons(T, Box<List<T>>), Nil }
    |                        ^^^^       ^
-LL | enum List<T> { Cons(T, Rc<List<T>>), Nil }
-   |                        ^^^       ^
-LL | enum List<T> { Cons(T, &List<T>), Nil }
-   |                        ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/sized-cycle-note.stderr b/src/test/ui/sized-cycle-note.stderr
index 99d8cfd0a05..45062c2ea6c 100644
--- a/src/test/ui/sized-cycle-note.stderr
+++ b/src/test/ui/sized-cycle-note.stderr
@@ -6,14 +6,10 @@ LL | struct Baz { q: Option<Foo> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Baz` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Baz` representable
    |
 LL | struct Baz { q: Box<Option<Foo>> }
    |                 ^^^^           ^
-LL | struct Baz { q: Rc<Option<Foo>> }
-   |                 ^^^           ^
-LL | struct Baz { q: &Option<Foo> }
-   |                 ^
 
 error[E0072]: recursive type `Foo` has infinite size
   --> $DIR/sized-cycle-note.rs:11:1
@@ -23,14 +19,10 @@ LL | struct Foo { q: Option<Baz> }
    | |
    | recursive type has infinite size
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL | struct Foo { q: Box<Option<Baz>> }
    |                 ^^^^           ^
-LL | struct Foo { q: Rc<Option<Baz>> }
-   |                 ^^^           ^
-LL | struct Foo { q: &Option<Baz> }
-   |                 ^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr
index 855e4facb7b..06493f05142 100644
--- a/src/test/ui/span/E0072.stderr
+++ b/src/test/ui/span/E0072.stderr
@@ -7,14 +7,10 @@ LL |     head: u8,
 LL |     tail: Option<ListNode>,
    |           ---------------- recursive without indirection
    |
-help: insert some indirection to make `ListNode` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ListNode` representable
    |
 LL |     tail: Box<Option<ListNode>>,
    |           ^^^^                ^
-LL |     tail: Rc<Option<ListNode>>,
-   |           ^^^                ^
-LL |     tail: &Option<ListNode>,
-   |           ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr
index 260c2157e96..55128347f74 100644
--- a/src/test/ui/span/multiline-span-E0072.stderr
+++ b/src/test/ui/span/multiline-span-E0072.stderr
@@ -10,14 +10,10 @@ LL | |     tail: Option<ListNode>,
 LL | | }
    | |_^ recursive type has infinite size
    |
-help: insert some indirection to make `ListNode` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ListNode` representable
    |
 LL |     tail: Box<Option<ListNode>>,
    |           ^^^^                ^
-LL |     tail: Rc<Option<ListNode>>,
-   |           ^^^                ^
-LL |     tail: &Option<ListNode>,
-   |           ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr
index c1a3270d0a5..fb1d98b58df 100644
--- a/src/test/ui/span/recursive-type-field.stderr
+++ b/src/test/ui/span/recursive-type-field.stderr
@@ -6,14 +6,10 @@ LL | struct Foo<'a> {
 LL |     bar: Bar<'a>,
    |          ------- recursive without indirection
    |
-help: insert some indirection to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
    |
 LL |     bar: Box<Bar<'a>>,
    |          ^^^^       ^
-LL |     bar: Rc<Bar<'a>>,
-   |          ^^^       ^
-LL |     bar: &Bar<'a>,
-   |          ^
 
 error[E0072]: recursive type `Bar` has infinite size
   --> $DIR/recursive-type-field.rs:8:1
diff --git a/src/test/ui/type/type-recursive.stderr b/src/test/ui/type/type-recursive.stderr
index b98a6eac49e..d6d32cc5d6f 100644
--- a/src/test/ui/type/type-recursive.stderr
+++ b/src/test/ui/type/type-recursive.stderr
@@ -7,14 +7,10 @@ LL |     foo: isize,
 LL |     foolish: T1
    |              -- recursive without indirection
    |
-help: insert some indirection to make `T1` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `T1` representable
    |
 LL |     foolish: Box<T1>
    |              ^^^^  ^
-LL |     foolish: Rc<T1>
-   |              ^^^  ^
-LL |     foolish: &T1
-   |              ^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/union/union-nonrepresentable.stderr b/src/test/ui/union/union-nonrepresentable.stderr
index 70863a549ad..c54d04de12c 100644
--- a/src/test/ui/union/union-nonrepresentable.stderr
+++ b/src/test/ui/union/union-nonrepresentable.stderr
@@ -7,14 +7,10 @@ LL |     a: u8,
 LL |     b: U,
    |        - recursive without indirection
    |
-help: insert some indirection to make `U` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `U` representable
    |
 LL |     b: Box<U>,
    |        ^^^^ ^
-LL |     b: Rc<U>,
-   |        ^^^ ^
-LL |     b: &U,
-   |        ^
 
 error: aborting due to previous error