Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3937,7 +3937,9 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {

//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);
});
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/delegation/ice-line-bounds-issue-148732.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ reuse a as b {
//~^ 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() {}
21 changes: 13 additions & 8 deletions tests/ui/delegation/ice-line-bounds-issue-148732.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand All @@ -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`.
10 changes: 10 additions & 0 deletions tests/ui/delegation/wrong-lifetime-rib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ mod ice_156758 {
}
}

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() {}
40 changes: 38 additions & 2 deletions tests/ui/delegation/wrong-lifetime-rib.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
|
Expand All @@ -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;
| +++

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, E0782.
Some errors have detailed explanations: E0116, E0223, E0423, E0599, E0782.
For more information about an error, try `rustc --explain E0116`.
Loading