about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-29 20:00:47 +0000
committerbors <bors@rust-lang.org>2022-04-29 20:00:47 +0000
commita707f401074bc769bab4efb2bfdde7f6c5a4068d (patch)
tree8146935aee88552868c76b369281cf69fc71b74a /src
parent1c8966e5e9dc099b55206f34af81242d03bdb413 (diff)
parent67ce547f474fbe34e8aafe4bfc284c3856673744 (diff)
downloadrust-a707f401074bc769bab4efb2bfdde7f6c5a4068d.tar.gz
rust-a707f401074bc769bab4efb2bfdde7f6c5a4068d.zip
Auto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebank
Enforce Copy bounds for repeat elements while considering lifetimes

fixes https://github.com/rust-lang/rust/issues/95477

this is a breaking change in order to fix a soundness bug.

Before this PR we only checked whether the repeat element type had an `impl Copy`, but not whether that impl also had the appropriate lifetimes. E.g. if the impl was for `YourType<'static>` and not a general `'a`, then copying any type other than a `'static` one should have been rejected, but wasn't.

r? `@lcnr`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/array-slice-vec/repeat_empty_ok.stderr12
-rw-r--r--src/test/ui/const-generics/issues/issue-61336-2.stderr6
-rw-r--r--src/test/ui/const-generics/issues/issue-61336.stderr6
-rw-r--r--src/test/ui/consts/const-blocks/fn-call-in-non-const.rs2
-rw-r--r--src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr14
-rw-r--r--src/test/ui/consts/const-blocks/migrate-fail.rs4
-rw-r--r--src/test/ui/consts/const-blocks/migrate-fail.stderr28
-rw-r--r--src/test/ui/consts/const-blocks/nll-fail.rs4
-rw-r--r--src/test/ui/consts/const-blocks/nll-fail.stderr28
-rw-r--r--src/test/ui/consts/const-blocks/trait-error.rs2
-rw-r--r--src/test/ui/consts/const-blocks/trait-error.stderr17
-rw-r--r--src/test/ui/consts/const-fn-in-vec.stderr6
-rw-r--r--src/test/ui/lifetimes/copy_modulo_regions.rs19
-rw-r--r--src/test/ui/lifetimes/copy_modulo_regions.stderr14
-rw-r--r--src/test/ui/repeat-expr/infer.rs16
-rw-r--r--src/test/ui/repeat-expr/repeat-expr-in-static.rs (renamed from src/test/ui/repeat-expr-in-static.rs)0
-rw-r--r--src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs (renamed from src/test/ui/repeat-to-run-dtor-twice.rs)0
-rw-r--r--src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr (renamed from src/test/ui/repeat-to-run-dtor-twice.stderr)6
-rw-r--r--src/test/ui/repeat-expr/repeat_count.rs (renamed from src/test/ui/repeat_count.rs)0
-rw-r--r--src/test/ui/repeat-expr/repeat_count.stderr (renamed from src/test/ui/repeat_count.stderr)0
-rw-r--r--src/tools/tidy/src/ui_tests.rs2
21 files changed, 131 insertions, 55 deletions
diff --git a/src/test/ui/array-slice-vec/repeat_empty_ok.stderr b/src/test/ui/array-slice-vec/repeat_empty_ok.stderr
index eba1a8e2278..724bdcd920a 100644
--- a/src/test/ui/array-slice-vec/repeat_empty_ok.stderr
+++ b/src/test/ui/array-slice-vec/repeat_empty_ok.stderr
@@ -1,22 +1,22 @@
 error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
-  --> $DIR/repeat_empty_ok.rs:8:19
+  --> $DIR/repeat_empty_ok.rs:8:20
    |
 LL |     let headers = [Header{value: &[]}; 128];
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
+   |                    ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
    |
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Header<'_>` with `#[derive(Copy)]`
    |
 LL | #[derive(Copy)]
    |
 
 error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
-  --> $DIR/repeat_empty_ok.rs:13:19
+  --> $DIR/repeat_empty_ok.rs:13:20
    |
 LL |     let headers = [Header{value: &[0]}; 128];
-   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
+   |                    ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Header<'_>`
    |
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Header<'_>` with `#[derive(Copy)]`
    |
 LL | #[derive(Copy)]
diff --git a/src/test/ui/const-generics/issues/issue-61336-2.stderr b/src/test/ui/const-generics/issues/issue-61336-2.stderr
index 48aaaf5e544..5bb35669623 100644
--- a/src/test/ui/const-generics/issues/issue-61336-2.stderr
+++ b/src/test/ui/const-generics/issues/issue-61336-2.stderr
@@ -1,10 +1,10 @@
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/issue-61336-2.rs:6:5
+  --> $DIR/issue-61336-2.rs:6:6
    |
 LL |     [x; { N }]
-   |     ^^^^^^^^^^ the trait `Copy` is not implemented for `T`
+   |      ^ the trait `Copy` is not implemented for `T`
    |
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider restricting type parameter `T`
    |
 LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
diff --git a/src/test/ui/const-generics/issues/issue-61336.stderr b/src/test/ui/const-generics/issues/issue-61336.stderr
index 665a1a677a1..8d9e545b456 100644
--- a/src/test/ui/const-generics/issues/issue-61336.stderr
+++ b/src/test/ui/const-generics/issues/issue-61336.stderr
@@ -1,10 +1,10 @@
 error[E0277]: the trait bound `T: Copy` is not satisfied
-  --> $DIR/issue-61336.rs:6:5
+  --> $DIR/issue-61336.rs:6:6
    |
 LL |     [x; N]
-   |     ^^^^^^ the trait `Copy` is not implemented for `T`
+   |      ^ the trait `Copy` is not implemented for `T`
    |
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider restricting type parameter `T`
    |
 LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
diff --git a/src/test/ui/consts/const-blocks/fn-call-in-non-const.rs b/src/test/ui/consts/const-blocks/fn-call-in-non-const.rs
index 19217843759..18b4dc714de 100644
--- a/src/test/ui/consts/const-blocks/fn-call-in-non-const.rs
+++ b/src/test/ui/consts/const-blocks/fn-call-in-non-const.rs
@@ -12,5 +12,5 @@ const fn copy() -> u32 {
 fn main() {
     let _: [u32; 2] = [copy(); 2];
     let _: [Option<Bar>; 2] = [no_copy(); 2];
-    //~^ ERROR the trait bound `Option<Bar>: Copy` is not satisfied
+    //~^ ERROR the trait bound `Bar: Copy` is not satisfied
 }
diff --git a/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr b/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr
index 52a1669e330..5306fed2251 100644
--- a/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr
+++ b/src/test/ui/consts/const-blocks/fn-call-in-non-const.stderr
@@ -1,13 +1,17 @@
-error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
-  --> $DIR/fn-call-in-non-const.rs:14:31
+error[E0277]: the trait bound `Bar: Copy` is not satisfied
+  --> $DIR/fn-call-in-non-const.rs:14:32
    |
 LL |     let _: [Option<Bar>; 2] = [no_copy(); 2];
-   |                               ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
+   |                                ^^^^^^^^^ the trait `Copy` is not implemented for `Bar`
    |
-   = help: the trait `Copy` is implemented for `Option<T>`
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
    = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
    = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+help: consider annotating `Bar` with `#[derive(Copy)]`
+   |
+LL | #[derive(Copy)]
+   |
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/const-blocks/migrate-fail.rs b/src/test/ui/consts/const-blocks/migrate-fail.rs
index bb12139a7ba..d5a17249cc9 100644
--- a/src/test/ui/consts/const-blocks/migrate-fail.rs
+++ b/src/test/ui/consts/const-blocks/migrate-fail.rs
@@ -11,13 +11,13 @@ mod non_constants {
     fn no_impl_copy_empty_value_multiple_elements() {
         let x = None;
         let arr: [Option<Bar>; 2] = [x; 2];
-        //~^ ERROR the trait bound `Option<Bar>: Copy` is not satisfied [E0277]
+        //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277]
     }
 
     fn no_impl_copy_value_multiple_elements() {
         let x = Some(Bar);
         let arr: [Option<Bar>; 2] = [x; 2];
-        //~^ ERROR the trait bound `Option<Bar>: Copy` is not satisfied [E0277]
+        //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277]
     }
 }
 
diff --git a/src/test/ui/consts/const-blocks/migrate-fail.stderr b/src/test/ui/consts/const-blocks/migrate-fail.stderr
index 318fec60290..2e7ff5cb8b3 100644
--- a/src/test/ui/consts/const-blocks/migrate-fail.stderr
+++ b/src/test/ui/consts/const-blocks/migrate-fail.stderr
@@ -1,20 +1,28 @@
-error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
-  --> $DIR/migrate-fail.rs:13:37
+error[E0277]: the trait bound `Bar: Copy` is not satisfied
+  --> $DIR/migrate-fail.rs:13:38
    |
 LL |         let arr: [Option<Bar>; 2] = [x; 2];
-   |                                     ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
+   |                                      ^ the trait `Copy` is not implemented for `Bar`
+   |
+   = note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
+help: consider annotating `Bar` with `#[derive(Copy)]`
+   |
+LL | #[derive(Copy)]
    |
-   = help: the trait `Copy` is implemented for `Option<T>`
-   = note: the `Copy` trait is required because the repeated element will be copied
 
-error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
-  --> $DIR/migrate-fail.rs:19:37
+error[E0277]: the trait bound `Bar: Copy` is not satisfied
+  --> $DIR/migrate-fail.rs:19:38
    |
 LL |         let arr: [Option<Bar>; 2] = [x; 2];
-   |                                     ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
+   |                                      ^ the trait `Copy` is not implemented for `Bar`
+   |
+   = note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
+help: consider annotating `Bar` with `#[derive(Copy)]`
+   |
+LL | #[derive(Copy)]
    |
-   = help: the trait `Copy` is implemented for `Option<T>`
-   = note: the `Copy` trait is required because the repeated element will be copied
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/const-blocks/nll-fail.rs b/src/test/ui/consts/const-blocks/nll-fail.rs
index 871387c1fd0..9d4aef39e54 100644
--- a/src/test/ui/consts/const-blocks/nll-fail.rs
+++ b/src/test/ui/consts/const-blocks/nll-fail.rs
@@ -10,13 +10,13 @@ mod non_constants {
     fn no_impl_copy_empty_value_multiple_elements() {
         let x = None;
         let arr: [Option<Bar>; 2] = [x; 2];
-        //~^ ERROR the trait bound `Option<Bar>: Copy` is not satisfied [E0277]
+        //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277]
     }
 
     fn no_impl_copy_value_multiple_elements() {
         let x = Some(Bar);
         let arr: [Option<Bar>; 2] = [x; 2];
-        //~^ ERROR the trait bound `Option<Bar>: Copy` is not satisfied [E0277]
+        //~^ ERROR the trait bound `Bar: Copy` is not satisfied [E0277]
     }
 }
 
diff --git a/src/test/ui/consts/const-blocks/nll-fail.stderr b/src/test/ui/consts/const-blocks/nll-fail.stderr
index 5a34361aa83..c0d273b5a9a 100644
--- a/src/test/ui/consts/const-blocks/nll-fail.stderr
+++ b/src/test/ui/consts/const-blocks/nll-fail.stderr
@@ -1,20 +1,28 @@
-error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
-  --> $DIR/nll-fail.rs:12:37
+error[E0277]: the trait bound `Bar: Copy` is not satisfied
+  --> $DIR/nll-fail.rs:12:38
    |
 LL |         let arr: [Option<Bar>; 2] = [x; 2];
-   |                                     ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
+   |                                      ^ the trait `Copy` is not implemented for `Bar`
+   |
+   = note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
+help: consider annotating `Bar` with `#[derive(Copy)]`
+   |
+LL | #[derive(Copy)]
    |
-   = help: the trait `Copy` is implemented for `Option<T>`
-   = note: the `Copy` trait is required because the repeated element will be copied
 
-error[E0277]: the trait bound `Option<Bar>: Copy` is not satisfied
-  --> $DIR/nll-fail.rs:18:37
+error[E0277]: the trait bound `Bar: Copy` is not satisfied
+  --> $DIR/nll-fail.rs:18:38
    |
 LL |         let arr: [Option<Bar>; 2] = [x; 2];
-   |                                     ^^^^^^ the trait `Copy` is not implemented for `Option<Bar>`
+   |                                      ^ the trait `Copy` is not implemented for `Bar`
+   |
+   = note: required because of the requirements on the impl of `Copy` for `Option<Bar>`
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
+help: consider annotating `Bar` with `#[derive(Copy)]`
+   |
+LL | #[derive(Copy)]
    |
-   = help: the trait `Copy` is implemented for `Option<T>`
-   = note: the `Copy` trait is required because the repeated element will be copied
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/consts/const-blocks/trait-error.rs b/src/test/ui/consts/const-blocks/trait-error.rs
index 5a614cbdd15..49d1e9b9434 100644
--- a/src/test/ui/consts/const-blocks/trait-error.rs
+++ b/src/test/ui/consts/const-blocks/trait-error.rs
@@ -3,5 +3,5 @@ struct Foo<T>(T);
 
 fn main() {
     [Foo(String::new()); 4];
-    //~^ ERROR the trait bound `Foo<String>: Copy` is not satisfied [E0277]
+    //~^ ERROR the trait bound `String: Copy` is not satisfied [E0277]
 }
diff --git a/src/test/ui/consts/const-blocks/trait-error.stderr b/src/test/ui/consts/const-blocks/trait-error.stderr
index 6979ff36176..ece200ad10b 100644
--- a/src/test/ui/consts/const-blocks/trait-error.stderr
+++ b/src/test/ui/consts/const-blocks/trait-error.stderr
@@ -1,11 +1,18 @@
-error[E0277]: the trait bound `Foo<String>: Copy` is not satisfied
-  --> $DIR/trait-error.rs:5:5
+error[E0277]: the trait bound `String: Copy` is not satisfied
+  --> $DIR/trait-error.rs:5:6
    |
 LL |     [Foo(String::new()); 4];
-   |     ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Foo<String>`
+   |      ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
    |
-   = help: the trait `Copy` is implemented for `Foo<T>`
-   = note: the `Copy` trait is required because the repeated element will be copied
+note: required because of the requirements on the impl of `Copy` for `Foo<String>`
+  --> $DIR/trait-error.rs:1:10
+   |
+LL | #[derive(Copy, Clone)]
+   |          ^^^^
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
+   = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
+   = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
+   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/consts/const-fn-in-vec.stderr b/src/test/ui/consts/const-fn-in-vec.stderr
index f02cb4f1ff1..9eb7524b504 100644
--- a/src/test/ui/consts/const-fn-in-vec.stderr
+++ b/src/test/ui/consts/const-fn-in-vec.stderr
@@ -1,10 +1,10 @@
 error[E0277]: the trait bound `String: Copy` is not satisfied
-  --> $DIR/const-fn-in-vec.rs:4:32
+  --> $DIR/const-fn-in-vec.rs:4:33
    |
 LL |     let strings: [String; 5] = [String::new(); 5];
-   |                                ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
+   |                                 ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
    |
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
    = help: consider creating a new `const` item and initializing it with the result of the function call to be used in the repeat position, like `const VAL: Type = const_fn();` and `let x = [VAL; 42];`
    = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
 
diff --git a/src/test/ui/lifetimes/copy_modulo_regions.rs b/src/test/ui/lifetimes/copy_modulo_regions.rs
new file mode 100644
index 00000000000..1d5d90ffcb4
--- /dev/null
+++ b/src/test/ui/lifetimes/copy_modulo_regions.rs
@@ -0,0 +1,19 @@
+#![feature(nll)]
+
+#[derive(Clone)]
+struct Foo<'a>(fn(&'a ()) -> &'a ());
+
+impl Copy for Foo<'static> {}
+
+fn mk_foo<'a>() -> Foo<'a> {
+    println!("mk_foo");
+    Foo(|x| x)
+}
+
+fn foo<'a>() -> [Foo<'a>; 100] {
+    [mk_foo::<'a>(); 100] //~ ERROR lifetime may not live long enough
+}
+
+fn main() {
+    foo();
+}
diff --git a/src/test/ui/lifetimes/copy_modulo_regions.stderr b/src/test/ui/lifetimes/copy_modulo_regions.stderr
new file mode 100644
index 00000000000..e027bc45426
--- /dev/null
+++ b/src/test/ui/lifetimes/copy_modulo_regions.stderr
@@ -0,0 +1,14 @@
+error: lifetime may not live long enough
+  --> $DIR/copy_modulo_regions.rs:14:5
+   |
+LL | fn foo<'a>() -> [Foo<'a>; 100] {
+   |        -- lifetime `'a` defined here
+LL |     [mk_foo::<'a>(); 100]
+   |     ^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+   |
+   = note: requirement occurs because of the type `Foo<'_>`, which makes the generic argument `'_` invariant
+   = note: the struct `Foo<'a>` is invariant over the parameter `'a`
+   = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/repeat-expr/infer.rs b/src/test/ui/repeat-expr/infer.rs
new file mode 100644
index 00000000000..8197713b97e
--- /dev/null
+++ b/src/test/ui/repeat-expr/infer.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+#[derive(Clone, Default)]
+struct MaybeCopy<T>(T);
+
+impl Copy for MaybeCopy<u8> {}
+
+fn is_copy<T: Copy>(x: T) {
+    println!("{}", std::any::type_name::<T>());
+}
+
+fn main() {
+    is_copy(MaybeCopy::default());
+    [MaybeCopy::default(); 13];
+    // didn't work, because `Copy` was only checked in the mir
+}
diff --git a/src/test/ui/repeat-expr-in-static.rs b/src/test/ui/repeat-expr/repeat-expr-in-static.rs
index 0b895379330..0b895379330 100644
--- a/src/test/ui/repeat-expr-in-static.rs
+++ b/src/test/ui/repeat-expr/repeat-expr-in-static.rs
diff --git a/src/test/ui/repeat-to-run-dtor-twice.rs b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs
index 0cd8eceefc5..0cd8eceefc5 100644
--- a/src/test/ui/repeat-to-run-dtor-twice.rs
+++ b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs
diff --git a/src/test/ui/repeat-to-run-dtor-twice.stderr b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr
index 904413712cd..36b93616375 100644
--- a/src/test/ui/repeat-to-run-dtor-twice.stderr
+++ b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.stderr
@@ -1,10 +1,10 @@
 error[E0277]: the trait bound `Foo: Copy` is not satisfied
-  --> $DIR/repeat-to-run-dtor-twice.rs:17:13
+  --> $DIR/repeat-to-run-dtor-twice.rs:17:15
    |
 LL |     let _ = [ a; 5 ];
-   |             ^^^^^^^^ the trait `Copy` is not implemented for `Foo`
+   |               ^ the trait `Copy` is not implemented for `Foo`
    |
-   = note: the `Copy` trait is required because the repeated element will be copied
+   = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Foo` with `#[derive(Copy)]`
    |
 LL | #[derive(Copy)]
diff --git a/src/test/ui/repeat_count.rs b/src/test/ui/repeat-expr/repeat_count.rs
index 96abff4ab41..96abff4ab41 100644
--- a/src/test/ui/repeat_count.rs
+++ b/src/test/ui/repeat-expr/repeat_count.rs
diff --git a/src/test/ui/repeat_count.stderr b/src/test/ui/repeat-expr/repeat_count.stderr
index 59bcd954a1f..59bcd954a1f 100644
--- a/src/test/ui/repeat_count.stderr
+++ b/src/test/ui/repeat-expr/repeat_count.stderr
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 1f6f2336481..6b715f727b2 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -7,7 +7,7 @@ use std::path::Path;
 
 const ENTRY_LIMIT: usize = 1000;
 // FIXME: The following limits should be reduced eventually.
-const ROOT_ENTRY_LIMIT: usize = 980;
+const ROOT_ENTRY_LIMIT: usize = 977;
 const ISSUES_ENTRY_LIMIT: usize = 2278;
 
 fn check_entries(path: &Path, bad: &mut bool) {