mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
Visit delegation body under elided-infer lifetime rib
This commit is contained in:
@@ -3937,7 +3937,9 @@ fn resolve_delegation(
|
||||
|
||||
//As we lower target_expr_template body to a body of a function we need a label rib (#148889)
|
||||
this.with_label_rib(RibKind::FnOrCoroutine, |this| {
|
||||
this.visit_block(body);
|
||||
this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| {
|
||||
this.visit_block(body);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//~^ ERROR cannot find function `a` in this scope
|
||||
//~| ERROR functions delegation is not yet fully implemented
|
||||
dbg!(b);
|
||||
//~^ ERROR missing lifetime specifier
|
||||
//~^ ERROR: `fn() {b}` doesn't implement `Debug`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> $DIR/ice-line-bounds-issue-148732.rs:4:5
|
||||
|
|
||||
LL | dbg!(b);
|
||||
| ^^^^^^^ expected named lifetime parameter
|
||||
|
||||
error[E0425]: cannot find function `a` in this scope
|
||||
--> $DIR/ice-line-bounds-issue-148732.rs:1:7
|
||||
|
|
||||
@@ -25,7 +19,18 @@ LL | | }
|
||||
= help: add `#![feature(fn_delegation)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0277]: `fn() {b}` doesn't implement `Debug`
|
||||
--> $DIR/ice-line-bounds-issue-148732.rs:4:5
|
||||
|
|
||||
LL | reuse a as b {
|
||||
| - consider calling this function
|
||||
...
|
||||
LL | dbg!(b);
|
||||
| ^^^^^^^ the trait `Debug` is not implemented for fn item `fn() {b}`
|
||||
|
|
||||
= help: use parentheses to call this function: `b()`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0106, E0425, E0658.
|
||||
For more information about an error, try `rustc --explain E0106`.
|
||||
Some errors have detailed explanations: E0277, E0425, E0658.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
||||
@@ -29,4 +29,14 @@ impl X { //~ ERROR: expected a type, found a trait
|
||||
}
|
||||
}
|
||||
|
||||
mod ice_156806 {
|
||||
trait X {}
|
||||
|
||||
impl X { //~ ERROR: expected a type, found a trait
|
||||
reuse Iterator::fold { //~ ERROR: `()` is not an iterator
|
||||
let _: &X; //~ ERROR: expected a type, found a trait
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -19,6 +19,21 @@ help: you might have intended to implement this trait for a given type
|
||||
LL | impl X for /* Type */ {
|
||||
| ++++++++++++++
|
||||
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/wrong-lifetime-rib.rs:35:10
|
||||
|
|
||||
LL | impl X {
|
||||
| ^
|
||||
|
|
||||
help: you can add the `dyn` keyword if you want a trait object
|
||||
|
|
||||
LL | impl dyn X {
|
||||
| +++
|
||||
help: you might have intended to implement this trait for a given type
|
||||
|
|
||||
LL | impl X for /* Type */ {
|
||||
| ++++++++++++++
|
||||
|
||||
error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
|
||||
--> $DIR/wrong-lifetime-rib.rs:9:5
|
||||
|
|
||||
@@ -40,7 +55,28 @@ LL - reuse<<<&Project> :: Ty> :: Ty as Iterator>::next;
|
||||
LL + reuse<<<&() as Example>::Ty> :: Ty as Iterator>::next;
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0782]: expected a type, found a trait
|
||||
--> $DIR/wrong-lifetime-rib.rs:37:21
|
||||
|
|
||||
LL | let _: &X;
|
||||
| ^
|
||||
|
|
||||
help: you can add the `dyn` keyword if you want a trait object
|
||||
|
|
||||
LL | let _: &dyn X;
|
||||
| +++
|
||||
|
||||
Some errors have detailed explanations: E0116, E0223, E0423, E0782.
|
||||
error[E0599]: `()` is not an iterator
|
||||
--> $DIR/wrong-lifetime-rib.rs:36:25
|
||||
|
|
||||
LL | reuse Iterator::fold {
|
||||
| ^^^^ `()` is not an iterator
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`(): Iterator`
|
||||
which is required by `&mut (): Iterator`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0116, E0223, E0423, E0599, E0782.
|
||||
For more information about an error, try `rustc --explain E0116`.
|
||||
|
||||
Reference in New Issue
Block a user