about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2024-04-04 02:14:52 +0100
committerBoxy <supbscripter@gmail.com>2024-04-04 02:14:57 +0100
commit82789763c7c5c09c6b0481d18cf00ef67b4b6fa3 (patch)
treed9641aa69120129acaae31ed18cd35efd72b3c73
parent2b67f0104a9fcdb3a6aa41bceb33e62e609e6b6c (diff)
downloadrust-82789763c7c5c09c6b0481d18cf00ef67b4b6fa3.tar.gz
rust-82789763c7c5c09c6b0481d18cf00ef67b4b6fa3.zip
rebase
-rw-r--r--compiler/rustc_trait_selection/src/traits/wf.rs4
-rw-r--r--tests/ui/proc-macro/bad-projection.rs1
-rw-r--r--tests/ui/proc-macro/bad-projection.stderr14
-rw-r--r--tests/ui/wf/wf-fn-def-check-sig-1.rs2
-rw-r--r--tests/ui/wf/wf-fn-def-check-sig-1.stderr7
-rw-r--r--tests/ui/wf/wf-fn-def-check-sig-2.stderr2
6 files changed, 22 insertions, 8 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index 9b078e45c85..19ca147d3ad 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -718,7 +718,7 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
                 // FIXME(eddyb) add the type to `walker` instead of recursing.
                 let fn_sig = tcx.fn_sig(did).instantiate(tcx, args);
                 fn_sig.output().skip_binder().visit_with(self);
-                
+
                 let obligations = self.nominal_obligations(did, args);
                 self.out.extend(obligations);
             }
@@ -863,7 +863,7 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
 
     fn visit_const(&mut self, c: <TyCtxt<'tcx> as ty::Interner>::Const) -> Self::Result {
         let tcx = self.tcx();
-        
+
         match c.kind() {
             ty::ConstKind::Unevaluated(uv) => {
                 if !c.has_escaping_bound_vars() {
diff --git a/tests/ui/proc-macro/bad-projection.rs b/tests/ui/proc-macro/bad-projection.rs
index e633191bd31..0769a7f08c1 100644
--- a/tests/ui/proc-macro/bad-projection.rs
+++ b/tests/ui/proc-macro/bad-projection.rs
@@ -15,4 +15,5 @@ pub fn uwu() -> <() as Project>::Assoc {}
 //~^ ERROR the trait bound `(): Project` is not satisfied
 //~| ERROR the trait bound `(): Project` is not satisfied
 //~| ERROR the trait bound `(): Project` is not satisfied
+//~| ERROR the trait bound `(): Project` is not satisfied
 //~| ERROR function is expected to take 1 argument, but it takes 0 arguments
diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr
index 8e0d8461849..2e8668f60de 100644
--- a/tests/ui/proc-macro/bad-projection.stderr
+++ b/tests/ui/proc-macro/bad-projection.stderr
@@ -36,6 +36,18 @@ LL | trait Project {
    | ^^^^^^^^^^^^^
 
 error[E0277]: the trait bound `(): Project` is not satisfied
+  --> $DIR/bad-projection.rs:14:1
+   |
+LL | pub fn uwu() -> <() as Project>::Assoc {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Project` is not implemented for `()`
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/bad-projection.rs:9:1
+   |
+LL | trait Project {
+   | ^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `(): Project` is not satisfied
   --> $DIR/bad-projection.rs:14:40
    |
 LL | pub fn uwu() -> <() as Project>::Assoc {}
@@ -47,7 +59,7 @@ help: this trait has no implementations, consider adding one
 LL | trait Project {
    | ^^^^^^^^^^^^^
 
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0277, E0593.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/wf/wf-fn-def-check-sig-1.rs b/tests/ui/wf/wf-fn-def-check-sig-1.rs
index 621d1ac3fc1..6d9e1f38f8d 100644
--- a/tests/ui/wf/wf-fn-def-check-sig-1.rs
+++ b/tests/ui/wf/wf-fn-def-check-sig-1.rs
@@ -8,8 +8,8 @@ fn foo<'b, 'a>() -> PhantomData<&'b &'a ()> {
 
 fn extend_lifetime<'a, 'b, T: ?Sized>(x: &'a T) -> &'b T {
     let f = foo::<'b, 'a>;
-    //~^ ERROR lifetime may not live long enough
     f.baz(x)
+    //~^ ERROR lifetime may not live long enough
 }
 
 trait Foo<'a, 'b, T: ?Sized> {
diff --git a/tests/ui/wf/wf-fn-def-check-sig-1.stderr b/tests/ui/wf/wf-fn-def-check-sig-1.stderr
index 9501d6de8b5..a93449ad3c6 100644
--- a/tests/ui/wf/wf-fn-def-check-sig-1.stderr
+++ b/tests/ui/wf/wf-fn-def-check-sig-1.stderr
@@ -1,14 +1,15 @@
 error: lifetime may not live long enough
-  --> $DIR/wf-fn-def-check-sig-1.rs:10:13
+  --> $DIR/wf-fn-def-check-sig-1.rs:11:5
    |
 LL | fn extend_lifetime<'a, 'b, T: ?Sized>(x: &'a T) -> &'b T {
    |                    --  -- lifetime `'b` defined here
    |                    |
    |                    lifetime `'a` defined here
 LL |     let f = foo::<'b, 'a>;
-   |             ^^^^^^^^^^^^^ requires that `'a` must outlive `'b`
+LL |     f.baz(x)
+   |     ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
    |
    = help: consider adding the following bound: `'a: 'b`
 
-error: aborting due to previous error
+error: aborting due to 1 previous error
 
diff --git a/tests/ui/wf/wf-fn-def-check-sig-2.stderr b/tests/ui/wf/wf-fn-def-check-sig-2.stderr
index 70c0fd32e1b..404d3cc4513 100644
--- a/tests/ui/wf/wf-fn-def-check-sig-2.stderr
+++ b/tests/ui/wf/wf-fn-def-check-sig-2.stderr
@@ -11,5 +11,5 @@ LL |     f.baz(x)
    |
    = help: consider adding the following bound: `'a: 'b`
 
-error: aborting due to previous error
+error: aborting due to 1 previous error