forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the ICE described in rust-lang#83693
- Loading branch information
1 parent
619c27a
commit 6f0fe9b
Showing
5 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Regression test for the ICE described in #83693. | ||
|
||
#![feature(fn_traits)] | ||
#![crate_type="lib"] | ||
|
||
impl F { | ||
//~^ ERROR: cannot find type `F` in this scope [E0412] | ||
fn call() { | ||
<Self as Fn(&TestResult)>::call | ||
//~^ ERROR: cannot find type `TestResult` in this scope [E0412] | ||
//~| associated type bindings are not allowed here [E0229] | ||
} | ||
} | ||
|
||
fn call() { | ||
<x as Fn(&usize)>::call | ||
//~^ ERROR: cannot find type `x` in this scope [E0412] | ||
//~| ERROR: associated type bindings are not allowed here [E0229] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
error[E0412]: cannot find type `F` in this scope | ||
--> $DIR/issue-83693.rs:6:6 | ||
| | ||
LL | impl F { | ||
| ^ help: a trait with a similar name exists: `Fn` | ||
| | ||
::: $SRC_DIR/core/src/ops/function.rs:LL:COL | ||
| | ||
LL | pub trait Fn<Args>: FnMut<Args> { | ||
| ------------------------------- similarly named trait `Fn` defined here | ||
|
||
error[E0412]: cannot find type `TestResult` in this scope | ||
--> $DIR/issue-83693.rs:9:22 | ||
| | ||
LL | <Self as Fn(&TestResult)>::call | ||
| ^^^^^^^^^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `x` in this scope | ||
--> $DIR/issue-83693.rs:16:6 | ||
| | ||
LL | <x as Fn(&usize)>::call | ||
| ^ not found in this scope | ||
|
||
error[E0229]: associated type bindings are not allowed here | ||
--> $DIR/issue-83693.rs:9:18 | ||
| | ||
LL | <Self as Fn(&TestResult)>::call | ||
| ^^^^^^^^^^^^^^^ associated type not allowed here | ||
|
||
error[E0229]: associated type bindings are not allowed here | ||
--> $DIR/issue-83693.rs:16:11 | ||
| | ||
LL | <x as Fn(&usize)>::call | ||
| ^^^^^^^^^^ associated type not allowed here | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
Some errors have detailed explanations: E0229, E0412. | ||
For more information about an error, try `rustc --explain E0229`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Regression test for the ICE described in #84768. | ||
|
||
#![feature(fn_traits)] | ||
#![crate_type="lib"] | ||
|
||
fn transform_mut<F>(f: F) where F: for<'b> FnOnce(&'b mut u8) { | ||
<F as FnOnce(&mut u8)>::call_once(f, 1) | ||
//~^ ERROR: associated type bindings are not allowed here [E0229] | ||
//~| ERROR: mismatched types [E0308] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error[E0229]: associated type bindings are not allowed here | ||
--> $DIR/issue-84768.rs:7:11 | ||
| | ||
LL | <F as FnOnce(&mut u8)>::call_once(f, 1) | ||
| ^^^^^^^^^^^^^^^ associated type not allowed here | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-84768.rs:7:42 | ||
| | ||
LL | <F as FnOnce(&mut u8)>::call_once(f, 1) | ||
| ^ expected tuple, found integer | ||
| | ||
= note: expected tuple `(&mut u8,)` | ||
found type `{integer}` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0229, E0308. | ||
For more information about an error, try `rustc --explain E0229`. |