1
Fork 0
This commit is contained in:
Boxy 2024-04-04 02:14:52 +01:00
parent 2b67f0104a
commit 82789763c7
6 changed files with 22 additions and 8 deletions

View file

@ -718,7 +718,7 @@ impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx> {
// FIXME(eddyb) add the type to `walker` instead of recursing. // FIXME(eddyb) add the type to `walker` instead of recursing.
let fn_sig = tcx.fn_sig(did).instantiate(tcx, args); let fn_sig = tcx.fn_sig(did).instantiate(tcx, args);
fn_sig.output().skip_binder().visit_with(self); fn_sig.output().skip_binder().visit_with(self);
let obligations = self.nominal_obligations(did, args); let obligations = self.nominal_obligations(did, args);
self.out.extend(obligations); 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 { fn visit_const(&mut self, c: <TyCtxt<'tcx> as ty::Interner>::Const) -> Self::Result {
let tcx = self.tcx(); let tcx = self.tcx();
match c.kind() { match c.kind() {
ty::ConstKind::Unevaluated(uv) => { ty::ConstKind::Unevaluated(uv) => {
if !c.has_escaping_bound_vars() { if !c.has_escaping_bound_vars() {

View file

@ -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 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 //~| ERROR function is expected to take 1 argument, but it takes 0 arguments

View file

@ -35,6 +35,18 @@ help: this trait has no implementations, consider adding one
LL | trait Project { 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 error[E0277]: the trait bound `(): Project` is not satisfied
--> $DIR/bad-projection.rs:14:40 --> $DIR/bad-projection.rs:14:40
| |
@ -47,7 +59,7 @@ help: this trait has no implementations, consider adding one
LL | trait Project { LL | trait Project {
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: aborting due to 4 previous errors error: aborting due to 5 previous errors
Some errors have detailed explanations: E0277, E0593. Some errors have detailed explanations: E0277, E0593.
For more information about an error, try `rustc --explain E0277`. For more information about an error, try `rustc --explain E0277`.

View file

@ -8,8 +8,8 @@ fn foo<'b, 'a>() -> PhantomData<&'b &'a ()> {
fn extend_lifetime<'a, 'b, T: ?Sized>(x: &'a T) -> &'b T { fn extend_lifetime<'a, 'b, T: ?Sized>(x: &'a T) -> &'b T {
let f = foo::<'b, 'a>; let f = foo::<'b, 'a>;
//~^ ERROR lifetime may not live long enough
f.baz(x) f.baz(x)
//~^ ERROR lifetime may not live long enough
} }
trait Foo<'a, 'b, T: ?Sized> { trait Foo<'a, 'b, T: ?Sized> {

View file

@ -1,14 +1,15 @@
error: lifetime may not live long enough 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 { LL | fn extend_lifetime<'a, 'b, T: ?Sized>(x: &'a T) -> &'b T {
| -- -- lifetime `'b` defined here | -- -- lifetime `'b` defined here
| | | |
| lifetime `'a` defined here | lifetime `'a` defined here
LL | let f = foo::<'b, 'a>; 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` = help: consider adding the following bound: `'a: 'b`
error: aborting due to previous error error: aborting due to 1 previous error

View file

@ -11,5 +11,5 @@ LL | f.baz(x)
| |
= help: consider adding the following bound: `'a: 'b` = help: consider adding the following bound: `'a: 'b`
error: aborting due to previous error error: aborting due to 1 previous error