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.
Rollup merge of rust-lang#108050 - martingms:issue-108042-fix, r=comp…
…iler-errors Fix index out of bounds ICE in `point_at_expr_source_of_inferred_type` There might be more type params than args to a method call, which leads to an index out of bounds panic. I'm not familiar with this code at all, so unsure whether this is the right fix, but at least this patch fixes rust-lang#108042 for me (I hit the same issue with similar code)
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 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,21 @@ | ||
struct S<A, B>(Option<(A, B)>); | ||
|
||
impl<A, B> S<A, B> { | ||
fn infer(&self, a: A, b: B) {} | ||
//~^ NOTE associated function defined here | ||
//~| NOTE | ||
//~| NOTE | ||
} | ||
|
||
fn main() { | ||
let s = S(None); | ||
s.infer(0i32); | ||
//~^ ERROR this method takes 2 arguments but 1 argument was supplied | ||
//~| NOTE an argument is missing | ||
//~| HELP provide the argument | ||
let t: S<u32, _> = s; | ||
//~^ ERROR mismatched types | ||
//~| NOTE expected `S<u32, _>`, found `S<i32, _>` | ||
//~| NOTE expected due to this | ||
//~| NOTE expected struct `S<u32, _>` | ||
} |
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,31 @@ | ||
error[E0061]: this method takes 2 arguments but 1 argument was supplied | ||
--> $DIR/point-at-inference-4.rs:12:7 | ||
| | ||
LL | s.infer(0i32); | ||
| ^^^^^------ an argument is missing | ||
| | ||
note: associated function defined here | ||
--> $DIR/point-at-inference-4.rs:4:8 | ||
| | ||
LL | fn infer(&self, a: A, b: B) {} | ||
| ^^^^^ ---- ---- | ||
help: provide the argument | ||
| | ||
LL | s.infer(0i32, /* b */); | ||
| ~~~~~~~~~~~~~~~ | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/point-at-inference-4.rs:16:24 | ||
| | ||
LL | let t: S<u32, _> = s; | ||
| --------- ^ expected `S<u32, _>`, found `S<i32, _>` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected struct `S<u32, _>` | ||
found struct `S<i32, _>` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0061, E0308. | ||
For more information about an error, try `rustc --explain E0061`. |