Skip to content

Instantly share code, notes, and snippets.

@m0rphed
Created March 24, 2022 13:56
Show Gist options
  • Save m0rphed/8891921cfd389c1a4276d6fd9e4b5176 to your computer and use it in GitHub Desktop.
Save m0rphed/8891921cfd389c1a4276d6fd9e4b5176 to your computer and use it in GitHub Desktop.
Test: evcxr (rust in jupyter) assigning array slice to variable with confusing message
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "Error",
"evalue": "failed to resolve: use of undeclared type `Index`",
"output_type": "error",
"traceback": [
"failed to resolve: use of undeclared type `Index`"
]
}
],
"source": [
"let an_array = [0, 1, 2, 3, 4];\n",
"let mid = &an_array[1..4]; // A slice of a: just the elements 1, 2, and 3"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1, 2, 3]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"let an_array = [0, 1, 2, 3, 4];\n",
"&an_array[1..4]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Rust",
"language": "rust",
"name": "rust"
},
"language_info": {
"codemirror_mode": "rust",
"file_extension": ".rs",
"mimetype": "text/rust",
"name": "Rust",
"pygment_lexer": "rust",
"version": ""
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
@m0rphed
Copy link
Author

m0rphed commented Mar 24, 2022

The second cell is fine though
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment