forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#118141 - matthiaskrgr:rollup-djkmfwt, r=matth…
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#117972 (Add VarDebugInfo to Stable MIR) - rust-lang#118110 (Document `DefiningAnchor` a bit more) - rust-lang#118112 (Don't ICE when ambiguity is found when selecting `Index` implementation in typeck) - rust-lang#118135 (Remove quotation from filename in stable_mir) Failed merges: - rust-lang#118012 (Add support for global allocation in smir) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
8 changed files
with
209 additions
and
23 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
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
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
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,29 @@ | ||
// Test against ICE in #118111 | ||
|
||
use std::ops::Index; | ||
|
||
struct Map<T, F> { | ||
f: F, | ||
inner: T, | ||
} | ||
|
||
impl<T, F, Idx> Index<Idx> for Map<T, F> | ||
where | ||
T: Index<Idx>, | ||
F: FnOnce(&T, Idx) -> Idx, | ||
{ | ||
type Output = T::Output; | ||
|
||
fn index(&self, index: Idx) -> &Self::Output { | ||
todo!() | ||
} | ||
} | ||
|
||
fn main() { | ||
Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0]; | ||
//~^ ERROR cannot index into a value of type | ||
// Problem here is that | ||
// `f: |_, i: usize| ...` | ||
// should be | ||
// `f: |_: &_, i: usize| ...` | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/ui/typeck/bad-index-modulo-higher-ranked-regions.stderr
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,9 @@ | ||
error[E0608]: cannot index into a value of type `Map<[usize; 1], {closure@$DIR/bad-index-modulo-higher-ranked-regions.rs:23:32: 23:45}>` | ||
--> $DIR/bad-index-modulo-higher-ranked-regions.rs:23:55 | ||
| | ||
LL | Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0]; | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0608`. |