about summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-12 07:40:32 +0000
committerbors <bors@rust-lang.org>2023-01-12 07:40:32 +0000
commit2b8590ef3bd1221830ec8a4131ea9d02b1636746 (patch)
tree7c99d064572f9d620f1e5d51db183bad0b785991 /tests/ui/error-codes
parent4887cb18dc2ef5b1bf3fc50ce6c267fde085032b (diff)
parente8ef83e4c060ec66a8dbb3d729af67ffd34f6a92 (diff)
downloadrust-2b8590ef3bd1221830ec8a4131ea9d02b1636746.tar.gz
rust-2b8590ef3bd1221830ec8a4131ea9d02b1636746.zip
Auto merge of #106757 - matthiaskrgr:rollup-9j8830g, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #106167 (Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311)
 - #106309 (Prefer non-`[type error]` candidates during selection)
 - #106532 (Allow codegen to unsize `dyn*` to `dyn`)
 - #106596 (Hide more of long types in E0271)
 - #106638 (std tests: use __OsLocalKeyInner from realstd)
 - #106676 (Test that we cannot use trait impl methods arguments as defining uses)
 - #106702 (Conserve cause of `ImplDerivedObligation` in E0599)
 - #106732 (rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.)
 - #106733 (Revert "warn newer available version of the x tool")
 - #106748 (Clean up `OnUnimplementedFormatString::verify`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0311.fixed13
-rw-r--r--tests/ui/error-codes/E0311.rs4
-rw-r--r--tests/ui/error-codes/E0311.stderr10
3 files changed, 22 insertions, 5 deletions
diff --git a/tests/ui/error-codes/E0311.fixed b/tests/ui/error-codes/E0311.fixed
new file mode 100644
index 00000000000..4410a4d707a
--- /dev/null
+++ b/tests/ui/error-codes/E0311.fixed
@@ -0,0 +1,13 @@
+// run-rustfix
+
+#![allow(warnings)]
+
+fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
+    with_restriction::<T>(x) //~ ERROR E0311
+}
+
+fn with_restriction<'a, T: 'a>(x: &'a ()) -> &'a () {
+    x
+}
+
+fn main() {}
diff --git a/tests/ui/error-codes/E0311.rs b/tests/ui/error-codes/E0311.rs
index 566b518b433..99e454f4d75 100644
--- a/tests/ui/error-codes/E0311.rs
+++ b/tests/ui/error-codes/E0311.rs
@@ -1,3 +1,7 @@
+// run-rustfix
+
+#![allow(warnings)]
+
 fn no_restriction<T>(x: &()) -> &() {
     with_restriction::<T>(x) //~ ERROR E0311
 }
diff --git a/tests/ui/error-codes/E0311.stderr b/tests/ui/error-codes/E0311.stderr
index 9873b5ae6ff..b0e6dd1e272 100644
--- a/tests/ui/error-codes/E0311.stderr
+++ b/tests/ui/error-codes/E0311.stderr
@@ -1,23 +1,23 @@
 error[E0311]: the parameter type `T` may not live long enough
-  --> $DIR/E0311.rs:2:5
+  --> $DIR/E0311.rs:6:5
    |
 LL |     with_restriction::<T>(x)
    |     ^^^^^^^^^^^^^^^^^^^^^
    |
 note: the parameter type `T` must be valid for the anonymous lifetime defined here...
-  --> $DIR/E0311.rs:1:25
+  --> $DIR/E0311.rs:5:25
    |
 LL | fn no_restriction<T>(x: &()) -> &() {
    |                         ^^^
 note: ...so that the type `T` will meet its required lifetime bounds
-  --> $DIR/E0311.rs:2:5
+  --> $DIR/E0311.rs:6:5
    |
 LL |     with_restriction::<T>(x)
    |     ^^^^^^^^^^^^^^^^^^^^^
 help: consider adding an explicit lifetime bound...
    |
-LL | fn no_restriction<'a, T: 'a>(x: &()) -> &() {
-   |                   +++  ++++
+LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() {
+   |                   +++  ++++      ++
 
 error: aborting due to previous error