2023-11-01
This commit is contained in:
parent
db840af366
commit
7b07c5cd44
@ -1925,6 +1925,255 @@ If I don't, escalate the issue to the host of this site (this can also be found
|
||||
</HTML>
|
||||
|
||||
|
||||
/blah/2023-11-01.html
|
||||
|
||||
Rabbit rabbit.
|
||||
|
||||
$ doas su -
|
||||
# apk del rust cargo
|
||||
# ^D
|
||||
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf >rustup.sh
|
||||
$ more <rustup.sh # DO NOT PIPE CURL INTO SH!!!
|
||||
$ sh rustup.sh
|
||||
|
||||
I went with a default installation because whatever. I just hope this doesn't
|
||||
fuck up my system because I quite like my system as it's installed.
|
||||
|
||||
$ . .cargo/env
|
||||
$ rustc --version
|
||||
Error loading shared library libgcc_s.so.1: No such file or directory (needed b
|
||||
Error loading shared library libgcc_s.so.1: No such file or directory (needed b
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
Error relocating /home/trinity/.rustup/toolchains/stable-aarch64-unknown-linux-
|
||||
|
||||
Hmmm.
|
||||
|
||||
$ doas su -
|
||||
# apk add libgcc-chimera
|
||||
# ^D
|
||||
$ rustc --version
|
||||
rustc 1.73.0 (cc66ad468 2023-10-03)
|
||||
|
||||
Cool.
|
||||
|
||||
Consultation with hosts: print!("{}", var); uses the display trait of var while
|
||||
print!("{:?}", var); uses the debug trait of var.
|
||||
|
||||
At night I like to look around and feel the air on my skin. The air is still
|
||||
but flowing because this place is well ventilated yet well heated and feels
|
||||
nice, is a nice temperature. I like to look around at the walls and how they
|
||||
blend into the ceiling, distinct only by texture and shade. There are no gaps
|
||||
between them. Nor between the wall and the floor. The walls are clean here. So
|
||||
is the floor. So is the ceiling. There are fire alarms and carbon monoxide
|
||||
detectors and blinds on the windows and the air is nice but most importantly
|
||||
the space is so big. A month ago I was waking up in a car, freezing. I was
|
||||
freezing because the car had nearly no insulation and nearly no ventilation, so
|
||||
my breath would condense onto any object that had some warmth to give it like
|
||||
the windows or my blankets or sleeping bag. The condensation would cool me in
|
||||
the night. I would wake up often in the very early morning hours shivering and
|
||||
unable to get warm, kept awake by Kami insisting we not fall asleep or we could
|
||||
die of hypothermia. I'd read Alias Grace or another book on my tablet, the
|
||||
glass cold to the touch and foggy, wishing I was somewhere else, somewhere far
|
||||
away where I couldn't touch the clean ceiling even if I stretched my arm out to
|
||||
as far away as my fingertips could reach. Now I am here, the place of which I
|
||||
dreamed. The walls are so far away and yet the air here, so much air, is so
|
||||
warm. It's comfortable. I'm laying on a couch which is comfortable and using my
|
||||
laptop comfortably and using wall electricity and laying in warmth and there's
|
||||
a sink in this room or adjacent to get water on demand and there is fucking
|
||||
laundry! I can do my fucking laundry! I can take a shower when I wish to! And
|
||||
every night out of joy I cry myself to sleep. I sob like a little piss baby,
|
||||
muffling my cries with my mouth or my will or when those fail the sleeping bag
|
||||
in which I lay because I'm terrified that I will be back on the street again
|
||||
and without the car and unable to get comfortable on hard surfaces anymore.
|
||||
|
||||
I met Toni in February, a 1999 green Subaru Forester or Forrester or something.
|
||||
She was driven by my sidekick and in fine shape except for some difficulties
|
||||
making it up hills. At the time my sidekick was considerably less so and I was
|
||||
coming off some bad decisions with drugs and we were discussing some stuff and
|
||||
I was in love with that car but never thought I would end up living in it. The
|
||||
best weekend I'd ever lived.
|
||||
|
||||
I met Toni in a different light in September or so. I'd slept near a pile of
|
||||
nearly unidentifiable corpses, the same hill about a hundred paces away, and
|
||||
then went to work and pretended I hadn't. Then I scootered a ways down a hill
|
||||
and up another to a different Burger King than the one at which I had worked
|
||||
and crawled through the rear of the car, fringed with broken glass which did
|
||||
cut me once or twice, and slept in the passenger seat in my sleeping bag. It
|
||||
wasn't comfortable compared to where I am now but it was better than any of the
|
||||
places I'd tried to sleep over that week and I got nine or so hours. I woke up
|
||||
and went to work, the other Burger King, chipper. None of my coworkers knew I
|
||||
was homeless but I didn't hide it. When I was homeless (technically I still am)
|
||||
in Lewiston I wanted to actually let people know I was homeless because I
|
||||
dispelled a lot of classic stereotypes about homeless people - I was educated,
|
||||
sober, and employed. But rent money is not simply money but money in a bulk I
|
||||
didn't have. The purpose of that job was to get the money to get where I am now
|
||||
but I still can't believe I am actually here.
|
||||
|
||||
Sometimes when I close my eyes I see them, the corpses torn apart by something
|
||||
of the forest, and I feel the exhaustion that rooted itself into my bones. And
|
||||
I wake up and I'm hear under a clean ceiling and the walls are so far away. In
|
||||
Toni I couldn't sit up without hitting my head, I had to duck or bend my back
|
||||
somehow. I couldn't extend my legs. Here I can extend my legs however I want in
|
||||
whatever direction I want. And pee as soon as I wake up.
|
||||
|
||||
I feel so fucked. My body is safe but my mind will not stop feeling like there
|
||||
is something from which to run. I can't forget what I saw and what I felt and
|
||||
who I was and what I did and being chased and losing trails and playing with
|
||||
trails and tracers and the falling down hills and sirens and sillhouettes in
|
||||
red and blue and making my way through dark alleys full of knives and shopping
|
||||
knives and losing knives and cutting, others and myself, and biting belts as I
|
||||
repaired my own mechanical faults and shocking myself until I forgot why and
|
||||
waking up to screaming and waking up to screaming and waking up to screaming.
|
||||
This is peace. What is peace?
|
||||
|
||||
Peace is the two library books I've read and returned since getting a library
|
||||
card here. What If (2014) and What If 2 (2022). Neither really books I needed
|
||||
to read or was recommended. Just books I wanted to enjoy. Peace is learning
|
||||
Rust to contribute to friends' projects, using my laptop, drinking clean water
|
||||
straight from the tap. Peace is riding in the car behind a few of the smartest
|
||||
people I know who seem happy I'm here and safe, or at least that my body is
|
||||
safe, but I don't tell them about the memories I can't get out of my head, just
|
||||
the memories that haunt me but that are allowed to escape, to be forgotten
|
||||
momentarily, that alone haunt my hosts. I still feel like I'm in the car
|
||||
sometimes. I feel the old seat felt against the backs of my arms as I come to
|
||||
from my sleeping bag. I see my breath fog in front of me. I don't but I do, I
|
||||
see without seeing. Kami shakes me until I wake up. It's not safe. But it's
|
||||
never safe, it's never safe because I'm still in the car and the lights are
|
||||
pouring through the windows but it's the sun's light and it's through apartment
|
||||
windows and it is safe here but it's not safe because the light is pouring
|
||||
through the windows and I can be seen and someone is about to start yelling
|
||||
that they will kill me because they don't see me as human and this was the only
|
||||
secluded place I could find but it's not secluded because it's a floor behind a
|
||||
locked door but it's not secluded so it's not safe and I'm taking up too much
|
||||
space so my hosts are going to hate me but they tell me I can take up more
|
||||
space certainly but I'm taking up too much space.
|
||||
|
||||
And I just want to go to sleep. I want peace. Peace was taken from me by those
|
||||
who wage war on the proletariat. Whatever. I'm too tired. Could this even be
|
||||
real? What happy existence? Am I really allowed to relax? Isn't it a trick?
|
||||
|
||||
o tenpo pimejo pona
|
||||
|
||||
= note: ld: error: unable to find library -lgcc_s
|
||||
clang-16: error: linker command failed with exit code 1 (use -v to se
|
||||
e invocation)
|
||||
|
||||
error: could not compile `clap_derive` (lib) due to previous error
|
||||
|
||||
# apk add gcc-aarch64-none-elf
|
||||
# ^D
|
||||
$ cargo run
|
||||
Compiling clap_derive v4.4.7
|
||||
error: linking with `cc` failed: exit status: 1
|
||||
|
|
||||
= note: LC_ALL="C" PATH="/home/trinity/.rustup/toolchains/stable-aarch64-unkn
|
||||
[many lines abridged]
|
||||
|
||||
Okay, so Rust is having issues with the lack of gcc here. It kinda sucks that
|
||||
clap is using C stuff. I'm not sure if I should get this C stuff working first
|
||||
or switch to a pure Rust argument parser.
|
||||
|
||||
Looking at this command line, it's LC_ALL=C PATH=[...] VSLANG=1033 cc [and then
|
||||
a whole bunch of bogus] [cflags] -lgcc_s lc [and then more cflags]. What
|
||||
provides gcc_s?
|
||||
|
||||
$ ls /lib | grep gcc
|
||||
drwxr-xr-x root root 4.0 KB Fri Sep 8 05:26:01 2023 gcc
|
||||
.rwxr-xr-x root root 70 KB Wed Oct 25 16:41:53 2023 libgcc_s.so.1
|
||||
|
||||
Presumably libgcc_s.so.1 was put there by libgcc-chimera (I'm not gonna bother
|
||||
checking). I'm just gonna search this error text because I'm not sure why the C
|
||||
compiler wouldn't be checking /lib.
|
||||
|
||||
$ ldconfig -p
|
||||
$ ldconfig
|
||||
$ ldconfig --help
|
||||
$ echo $?
|
||||
0
|
||||
$ ls $(which ldconfig)
|
||||
lrwxrwxrwx root root 4 B Tue Oct 31 17:08:41 2023 🔖 /bin/ldconfig ⇒ true
|
||||
|
||||
Hahahahhahahaha. What. Where's ldconfig?!?!?!?!?!?!! I would assume this is the
|
||||
root of the issue at hand.
|
||||
|
||||
At my most boring I have wished for a life worse than the one I have now. This
|
||||
is the most enjoyable my life has ever been and yet it is unrelentingly
|
||||
chaotic and I don't know how to get the pieces to fit. I feel irredeemable and
|
||||
unable to relate to anyone or anything except perhaps a pebble being kicked
|
||||
across the asphalt of the road or leaves falling off the trees, ripening,
|
||||
wrinkling, from a soothing green to a reminder of the loss of youth.
|
||||
|
||||
One day I expected rain overnight so I slept in the passenger seat so I could
|
||||
see the rain fall down the windshield. It was a view I had romanticized in my
|
||||
head, one I wanted to pause and view for eternity. My sidekick did not. They
|
||||
have places to go and things to do naturally so when it happened that we were
|
||||
caught in rain and got to see rain fall over Toni we watched for a moment or
|
||||
two and then drove onward toward the future, beckoning it without letting it
|
||||
take its time. I was excited to be able to take this moment, though
|
||||
unfortunately in solitude, at the pace by which I wanted to experience it. So I
|
||||
fell asleep against the bitter cold of that parking lot and awoke to the pitter
|
||||
patter of droplets against the glass before me and that was peaceful and I was
|
||||
for a moment happy. But then I heard a colder, shriller tap from behind, and
|
||||
turned around to find the cover for the rear window I'd fashioned out of
|
||||
cardboard and plastic leaking by the seams, forming a puddle that would
|
||||
inevitably fill with mildew and rot. I stared at this and realized my time in
|
||||
Toni was limited. Toni would mildew, rot, and disintegrate, as had all my
|
||||
relationships and all of my chances at housing.
|
||||
|
||||
After work I got back to the car and the puddle in the back was bad but in
|
||||
getting into the car I had left my wet boots on the floor of the passenger seat
|
||||
so the back was the only place in which I could sleep. My head curved away from
|
||||
the active dripping I heard the clack clack behind me of rain making its way
|
||||
through half a dozen layers of duct tape and mockig me before I sat up and just
|
||||
fucking broke down. I couldn't stay in Toni but couldn't stay anywhere else and
|
||||
I was out of options and just so fucking tired and cold and damp. There was no
|
||||
one to comfort me and no solace to be had. My sidekick had left for another
|
||||
style of adventure, everyone in my life had been either implicitly or
|
||||
explicitly transphobic towards me, and I had inconsistent access to electricity
|
||||
and clean water and hadn't showered in a week. It was the lowest point of my
|
||||
life. To be wet and unable to be dry, to be cold and unable to be warm, to be
|
||||
so tired and unable to sleep, to be so alone with nobody left. I sobbed like a
|
||||
baby and didn't care who could hear me, the rain covered the sound and whomever
|
||||
it revealed my cries could kill me for all I cared - I did genuinely want
|
||||
someone to just open the car door and stab me, clutch me in a warm embrace and
|
||||
spill my hot blood over me so I could just be warm for one fatal instant.
|
||||
Nobody came. I fell asleep.
|
||||
|
||||
And from this dream I wake up to a ceiling so high and a floor so dry and air
|
||||
unknowing of the sound of dripping agony but acclimated to my sobs which,
|
||||
though muffled, do still call silently into the night after my hosts have
|
||||
hopefully fallen asleep. And I don't know how to process being thrown from the
|
||||
frigid shackles in which I'd been locked into the shocking freedom of domestic
|
||||
cookie cutter monotony. I don't know how to fathom the stillness. I no longer
|
||||
need to run but my muscles refuse to atrophy, instead slowly cycling in my
|
||||
slumber lest I rise back to the street and to another abandoned car in another
|
||||
parking lot. The gray pavement on which parking lots are drawn knows me better
|
||||
than any four walls. Ceiling is not my usual blanket.
|
||||
|
||||
|
||||
/blah/2023-10-31.html
|
||||
|
||||
: trinity writes a rust hello world
|
||||
@ -2015,7 +2264,7 @@ error: free function without a body
|
||||
1 | fn main();
|
||||
| ^^^^^^^^^-
|
||||
| |
|
||||
| help: provide a definition for the function: `{ <body> }`
|
||||
| help: provide a definition for the function: `{ <body> }`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
@ -2095,7 +2344,7 @@ for me to print out an OsString without conversion or anything. I need to `use
|
||||
std::ffi::{OsStr, OsString};` or something like that I think but I'm gonna try
|
||||
with just `use std::env;` at first.
|
||||
|
||||
The use of echo(1) is defined for argc<2 (print a newline alone; argc can be
|
||||
The use of echo(1) is defined for argc<2 (print a newline alone; argc can be
|
||||
zero without consequence here) and argc>=2, so it won't be necessary to return
|
||||
a value from main(), Rust can just use the default successful value.
|
||||
|
||||
@ -2155,7 +2404,7 @@ fgets([...]);`.
|
||||
|
||||
I see stuff in here about `.unwrap()` and `stdout().lock()` but I hope I don't
|
||||
need that because I don't understand it yet. I'm just gonna use print!. So how
|
||||
do I print! an OsString? And how do I handle argc<2?
|
||||
do I print! an OsString? And how do I handle argc<2?
|
||||
|
||||
The book chapter 12 actually touches on a lot of this and I stumbled upon it
|
||||
looking at std::env stuff. Here's a test I can run from the book:
|
||||
@ -2163,7 +2412,7 @@ looking at std::env stuff. Here's a test I can run from the book:
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let args: Vec<String> = env::args().collect();
|
||||
dbg!(args);
|
||||
}
|
||||
```
|
||||
@ -2173,7 +2422,7 @@ I'll modify that a little:
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<OsString> = env::args().collect();
|
||||
let args: Vec<OsString> = env::args().collect();
|
||||
dbg!(args);
|
||||
}
|
||||
```
|
||||
@ -2181,7 +2430,7 @@ $ rustc echo.rs
|
||||
error[E0412]: cannot find type `OsString` in this scope
|
||||
--> echo.rs:4:19
|
||||
|
|
||||
4 | let args: Vec<OsString> = env::args().collect();
|
||||
4 | let args: Vec<OsString> = env::args().collect();
|
||||
| ^^^^^^^^
|
||||
--> /builddir/rust-1.73.0/library/alloc/src/string.rs:365:1
|
||||
|
|
||||
@ -2189,7 +2438,7 @@ error[E0412]: cannot find type `OsString` in this scope
|
||||
|
|
||||
help: a struct with a similar name exists
|
||||
|
|
||||
4 | let args: Vec<String> = env::args().collect();
|
||||
4 | let args: Vec<String> = env::args().collect();
|
||||
| ~~~~~~
|
||||
help: consider importing this struct
|
||||
|
|
||||
@ -2201,18 +2450,18 @@ error: aborting due to previous error
|
||||
For more information about this error, try `rustc --explain E0412`.
|
||||
|
||||
Okay.
|
||||
$ sed -e '1a use std::ffi::OsString' <echo.rs >echo.2.rs
|
||||
$ sed -e '1a use std::ffi::OsString' <echo.rs >echo.2.rs
|
||||
$ rustc echo.2.rs
|
||||
error[E0277]: a value of type `Vec<OsString>` cannot be built from an iterator
|
||||
error[E0277]: a value of type `Vec<OsString>` cannot be built from an iterator
|
||||
over elements of type `String`
|
||||
--> echo.rs:5:43
|
||||
|
|
||||
5 | let args: Vec<OsString> = env::args().collect();
|
||||
| ^^^^^^^ value of type `Vec<OsStri
|
||||
ng>` cannot be built from `std::iter::Iterator<Item=String>`
|
||||
5 | let args: Vec<OsString> = env::args().collect();
|
||||
| ^^^^^^^ value of type `Vec<OsStri
|
||||
ng>` cannot be built from `std::iter::Iterator<Item=String>`
|
||||
|
|
||||
= help: the trait `FromIterator<String>` is not implemented for `Vec<OsString>`
|
||||
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
||||
= help: the trait `FromIterator<String>` is not implemented for `Vec<OsString>`
|
||||
= help: the trait `FromIterator<T>` is implemented for `Vec<T>`
|
||||
note: required by a bound in `collect`
|
||||
--> /builddir/rust-1.73.0/library/core/src/iter/traits/iterator.rs:2049:5
|
||||
|
||||
@ -2221,12 +2470,12 @@ error: aborting due to previous error
|
||||
For more information about this error, try `rustc --explain E0277`
|
||||
|
||||
Oh shit, I forgot to change env::args to env::os_args.
|
||||
$ sed -e '5s.args.os_args.' <echo.2.rs >echo.rs
|
||||
$ sed -e '5s.args.os_args.' <echo.2.rs >echo.rs
|
||||
$ rustc echo.rs
|
||||
error[E0425]: cannot find function `os_args` in module `env`
|
||||
--> echo.rs:5:36
|
||||
|
|
||||
5 | let args: Vec<OsString> = env::os_args().collect();
|
||||
5 | let args: Vec<OsString> = env::os_args().collect();
|
||||
| ^^^^^^^ help: a function with a similar
|
||||
name exists: `args_os`
|
||||
--> /builddir/rust-1.73.0/library/std/src/env.rs:793:1
|
||||
@ -2238,7 +2487,7 @@ error: aborting due to previous error
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
|
||||
Oops.
|
||||
$ sed -e '5s.os_args.args_os.' <echo.rs >echo.2.rs
|
||||
$ sed -e '5s.os_args.args_os.' <echo.rs >echo.2.rs
|
||||
$ rustc echo.2.rs
|
||||
$
|
||||
|
||||
@ -2284,7 +2533,7 @@ use std::env;
|
||||
use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<OsString> = env::args_os().collect();
|
||||
let args: Vec<OsString> = env::args_os().collect();
|
||||
dbg!(args);
|
||||
dbg!(args.len());
|
||||
}
|
||||
@ -2294,8 +2543,8 @@ $ rustc echo.rs
|
||||
error[E0382]: borrow of moved value: `args`
|
||||
--> echo.rs:7:10
|
||||
|
|
||||
5 | let args: Vec<OsString> = env::args_os().collect();
|
||||
| ---- move occurs because `args` has type `Vec<OsString>`, which doe
|
||||
5 | let args: Vec<OsString> = env::args_os().collect();
|
||||
| ---- move occurs because `args` has type `Vec<OsString>`, which doe
|
||||
s not implement the `Copy` trait
|
||||
6 | dbg!(args);
|
||||
| ---------- value moved here
|
||||
@ -2315,7 +2564,7 @@ use std::env::args_os;
|
||||
use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<OsString> = args_os().collect();
|
||||
let args: Vec<OsString> = args_os().collect();
|
||||
let argc = args.len();
|
||||
dbg!(args);
|
||||
dbg!(argc);
|
||||
@ -2351,10 +2600,10 @@ use std::env::args_os;
|
||||
use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let argv: Vec<OsString> = args_os.collect();
|
||||
let argv: Vec<OsString> = args_os.collect();
|
||||
let argc = argv.len();
|
||||
|
||||
if argc < 2 {
|
||||
if argc < 2 {
|
||||
println!();
|
||||
} else {
|
||||
dbg!(argv);
|
||||
@ -2375,9 +2624,9 @@ $ ./echo piss shit
|
||||
Cool stuff. I don't think Rust has ternaries so I'm not gonna be able to do
|
||||
language tricks to make the code really compact like my C implementation:
|
||||
```c
|
||||
#include <stdio.h> /* NULL, fprintf(3), putc(3) */
|
||||
#include <stdlib.h> /* stdout */
|
||||
#include <sysexits.h> /* EX_OK */
|
||||
#include <stdio.h> /* NULL, fprintf(3), putc(3) */
|
||||
#include <stdlib.h> /* stdout */
|
||||
#include <sysexits.h> /* EX_OK */
|
||||
|
||||
int main(int argc, char **argv){
|
||||
|
||||
@ -2415,7 +2664,7 @@ error[E0282]: type annotations needed
|
||||
|
|
||||
help: consider specifying the generic argument
|
||||
|
|
||||
4 | let argc = args_os().collect::<Vec<_>>().len();
|
||||
4 | let argc = args_os().collect::<Vec<_>>().len();
|
||||
| ++++++++++
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
@ -2428,7 +2677,7 @@ use std::env::args_os;
|
||||
use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let argc = args_os().collect::Vec<OsString>().len();
|
||||
let argc = args_os().collect::Vec<OsString>().len();
|
||||
dbg!(argc);
|
||||
}
|
||||
```
|
||||
@ -2439,12 +2688,12 @@ $ rustc echo.rs
|
||||
error: generic parameters without surrounding angle brackets
|
||||
--> echo.rs:5:35
|
||||
|
|
||||
5 | let argc = args_os().collect::Vec<OsString>().len();
|
||||
5 | let argc = args_os().collect::Vec<OsString>().len();
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
help: surround the type parameters with angle brackets
|
||||
|
|
||||
5 | let argc = args_os().collect::<Vec<OsString>>().len();
|
||||
5 | let argc = args_os().collect::<Vec<OsString>>().len();
|
||||
| + +
|
||||
|
||||
error: aborting due to previous error
|
||||
@ -2462,7 +2711,7 @@ use std::env::args_os;
|
||||
use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
if args_os().collect::<Vec<OsString>>().len() < 2 {
|
||||
if args_os().collect::<Vec<OsString>>().len() < 2 {
|
||||
println!();
|
||||
} else {
|
||||
}
|
||||
@ -2484,7 +2733,7 @@ use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let mut stdout = stdout().lock();
|
||||
if args_os().collect::<Vec<OsString>>().len() < 2 {
|
||||
if args_os().collect::<Vec<OsString>>().len() < 2 {
|
||||
stdout.write(b"\n"); // Rust wants a 'b' prefix
|
||||
} else {
|
||||
}
|
||||
@ -2520,7 +2769,7 @@ use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let mut stdout = stdout().lock();
|
||||
if args_os().collect::<Vec<OsString>>().len() >= 2 {
|
||||
if args_os().collect::<Vec<OsString>>().len() >= 2 {
|
||||
for argument in args_os() {
|
||||
stdout.write(argument);
|
||||
stdout.write(b" ");
|
||||
@ -2553,7 +2802,7 @@ std::io.
|
||||
|
||||
Looking at the primitive u8, it's an 8-bit unsigned integer which should be
|
||||
fine for my uses. The method into_os_str_bytes() should work to convert
|
||||
std::ffi::OsString into a Vec<u8> but the documentation notes that this is
|
||||
std::ffi::OsString into a Vec<u8> but the documentation notes that this is
|
||||
"a nightly-only experimental API". Whatever, probably fine.
|
||||
|
||||
```rs
|
||||
@ -2563,7 +2812,7 @@ use std::ffi::OsString;
|
||||
|
||||
fn main() {
|
||||
let mut stdout = stdout().lock();
|
||||
if args_os().collect::<Vec<OsString>>().len() >= 2 {
|
||||
if args_os().collect::<Vec<OsString>>().len() >= 2 {
|
||||
for argument in args_os() {
|
||||
stdout.write(argument.into_os_str_bytes());
|
||||
stdout.write(b" ");
|
||||
@ -2579,7 +2828,7 @@ error[E0658]: use of unstable library feature 'os_str_bytes'
|
||||
9 | stdout.write(argument.into_os_str_bytes());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #111544 <https://github.com/rust-lang/rust/issues/111544> f
|
||||
= note: see issue #111544 <https://github.com/rust-lang/rust/issues/111544> f
|
||||
or more information
|
||||
|
||||
error[E0308]: mismatched types
|
||||
@ -2587,12 +2836,12 @@ error[E0308]: mismatched types
|
||||
|
|
||||
9 | stdout.write(argument.into_os_str_bytes());
|
||||
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[u8]`, fou
|
||||
nd `Vec<u8>`
|
||||
nd `Vec<u8>`
|
||||
| |
|
||||
| arguments to this method are incorrect
|
||||
|
|
||||
= note: expected reference `&[u8]`
|
||||
found struct `Vec<u8>`
|
||||
found struct `Vec<u8>`
|
||||
note: method defined here
|
||||
--> /builddir/rust-1.73.0/library/std/src/io/mod.rs:1461:8
|
||||
help: consider borrowing here
|
||||
@ -2614,7 +2863,7 @@ error[E0658]: use of unstable library feature 'os_str_bytes'
|
||||
9 | stdout.write(&argument.into_os_str_bytes());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #111544 <https://github.com/rust-lang/rust/issues/111544> f
|
||||
= note: see issue #111544 <https://github.com/rust-lang/rust/issues/111544> f
|
||||
or more information
|
||||
|
||||
error: aborting due to previous error
|
||||
@ -2639,13 +2888,13 @@ implementation that limits input to UTF-8. But first I wanna see how someone
|
||||
else has done this already.
|
||||
|
||||
https://github.com/uutils/coreutils.git src/uu/echo/src/echo.rs L119:
|
||||
>pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
>pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
> let args = args.collect_lossy();
|
||||
> let matches = uu_app().get_matches_from(args);
|
||||
>
|
||||
> let no_newline = matches.get_flag(options::NO_NEWLINE);
|
||||
> let escaped = matches.get_flag(options::ENABLE_BACKSLASH_ESCAPE);
|
||||
> let values: Vec<String> = match matches.get_many::<String>(options::STRING
|
||||
> let values: Vec<String> = match matches.get_many::<String>(options::STRING
|
||||
) {
|
||||
> Some(s) => s.map(|s| s.to_string()).collect(),
|
||||
> None => vec![String::new()],
|
||||
@ -2677,7 +2926,7 @@ use std::io::{Write, stdout};
|
||||
|
||||
fn main() {
|
||||
let mut stdout = stdout().lock();
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
for argument in args() {
|
||||
stdout.write(&argument.as_bytes());
|
||||
stdout.write(b" ");
|
||||
@ -2694,7 +2943,7 @@ that.
|
||||
use std::env::args;
|
||||
|
||||
fn main() {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
for argument in args() {
|
||||
print!(argument);
|
||||
print!(" ");
|
||||
@ -2723,7 +2972,7 @@ Okay.
|
||||
use std::env::args;
|
||||
|
||||
fn main() {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
for argument in args() {
|
||||
print!("{}", argument);
|
||||
print!(" ");
|
||||
@ -2747,7 +2996,7 @@ Oh.
|
||||
use std::env::args;
|
||||
|
||||
fn main() {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
if args().collect::<Vec<String>>().len() >= 2 {
|
||||
for argument in args().skip(1) {
|
||||
print!("{} ", argument);
|
||||
}
|
||||
@ -2829,7 +3078,7 @@ Cycling through articles only delays the inevitable.
|
||||
Looking at me ' up and down
|
||||
thick left thigh, '' pupils blown out
|
||||
I'm leaning onto brick and his pace changes tempo
|
||||
- -- bitch keep walking \<
|
||||
- -- bitch keep walking \<
|
||||
decelerates, ' my voice decrescendoes
|
||||
VV I'll tear your neck open and piss in your windpipe
|
||||
song of the city plays still and I \<
|
||||
|
Loading…
Reference in New Issue
Block a user