00:06 < bridge> you need `git add` i think after `git apply`, then `git commit` 00:15 < bridge> ah yes that was the procudure i did take but I was writting off memoery in the above msg. sry if any confusion 00:47 < bridge> Should I delete the .old files or is it still worth keeping them there? 09:41 < _______> 扬州一手高防服务器 有需要的可以加 2885230098 09:42 < _______> 江苏扬州一手高防服务器 有需要的加qq2885230098 09:42 < bridge> number of chinese ppl that read this: 0 xd 09:45 < bridge> wut 09:45 < bridge> we got aliens in the chat rn 09:46 <+ChillerDragon> uhm sos xd 09:46 <+ChillerDragon> i may have run ``chown -R root:admin /`` on my production vps :justatest: and now ssh just hangs what could i have broken? xd i still have a open ssh connection but if i loose that the server has to be nuked 09:48 < bridge> why root:admin 09:48 < bridge> did u create that group? xd 09:48 < _______> 用我家的服务器啊 高速稳定 09:49 < ws-client> yes xd 09:49 < bridge> i guess as a start make it root:root again? xd 09:49 < ws-client> doubt thatll fix it 09:49 < bridge> rip 09:49 < ws-client> i assume i wiped some stuff that was owned by the ssh user or something like that 09:50 < ws-client> in the hindsight it was a reckless move xd 09:55 < bridge> did u try to reinstall all packages 10:00 <+ChillerDragon> i am not sure if i want to reinstall ssh if thats the only thing keeping me alive 10:00 < bridge> no risk no fun 10:03 <+ChillerDragon> oh boi 10:03 <+ChillerDragon> i tried to backup my data but everything went to shit xd 10:03 <+ChillerDragon> dns is dead 10:03 <+ChillerDragon> ping cant even access the socket etc xd 10:03 <+ChillerDragon> feels like rm -rf 10:04 < bridge> rip to your vps 10:04 <+ChillerDragon> and its data as it seems 10:04 < bridge> but hard to do a diagnosis 10:04 <+ChillerDragon> i just need to restore all default debian permissions 10:04 <+ChillerDragon> "just" 10:05 < bridge> chmod 777 -R / 10:05 < bridge> 😂 😂 😂 10:05 <+ChillerDragon> e 10:05 <+ChillerDragon> bro 10:05 < bridge> yeah yeah jk, u r fckd 10:07 <+ChillerDragon> ok seems like i learn a bit more about the linux file system today :) 10:07 <+ChillerDragon> i gotta repair at least until i can ssh again and backup my data 10:07 < bridge> compress everything in your working shell, then type the binary compressed data by hand 10:07 <+ChillerDragon> ez 10:08 <+ChillerDragon> i can also ctrl+c the base64 encoded binary data 10:08 < bridge> do u have no network access at all? 10:08 <+ChillerDragon> yes 10:08 <+ChillerDragon> i mean kinda 10:08 <+ChillerDragon> my ssh is fully functional but onbly the one that is open 10:08 <+ChillerDragon> my tw server is running fine i think 10:08 <+ChillerDragon> idk actually 10:08 < bridge> and that has internet access? 10:08 <+ChillerDragon> i cant ping or do git push 10:09 <+ChillerDragon> fun CTF 10:09 <+ChillerDragon> if it wouldnt be my vps at risk xd 10:09 <+ChillerDragon> i can see my unstable internet dieing any moment and then im out 10:10 <+ChillerDragon> i need a backdoor xd 10:10 < bridge> the question is if internet doesnt work at all 10:10 <+ChillerDragon> idk 10:10 < bridge> wget 10:10 <+ChillerDragon> i dont have dns i think 10:10 < bridge> do by IP directly 10:10 <+ChillerDragon> works 10:11 <+ChillerDragon> maybe i can scp to my other vps 10:11 < bridge> well then u can probably at least upload all data somewhere 10:11 <+ChillerDragon> i wanna git push -,- 10:11 <+ChillerDragon> fakin scp 10:11 <+ChillerDragon> gimme sec i linux pro ima fix all perms 10:18 < bridge> I like it when I see what other project's issues are related to my project's issues. what do you not like about it? 10:19 < bridge> i think it should be one sided only. but we already had this discussion. 10:19 < bridge> Why should an unrelated project be able to annoy my project 10:19 < bridge> see e.g. how chillerdragon abused it 10:21 < bridge> 50% of the issue is not related to the project 10:21 < bridge> https://cdn.discordapp.com/attachments/293493549758939136/1112656976095223858/image.png 10:22 < bridge> if they want it, they could at least make it more decent 10:22 < bridge> it doesn't really seem that way to me, haven't encountered a necessary but not existent feature in quite some time, I think 10:29 < bridge> heinrich wheres ur map archive, i keep forgetting the site 10:29 < bridge> server seller 10:29 <+ChillerDragon> heirncihde maps 10:30 < bridge> https://heinrich5991.de/teeworlds/maps/maps/ 10:30 <+ChillerDragon> https://heinrich5991.de/teeworlds/maps/ 10:30 < bridge> https://heinrich5991.de/teeworlds/maps/maps/maps/maps/maps/maps/maps/maps/maps/maps 10:30 <+ChillerDragon> trol 10:31 < bridge> and did he convince you? xd 10:31 < bridge> It's interesting that the guy didn't spam the irc channel 10:31 < bridge> as the only chinese here 10:31 < bridge> Server resellers usually gets a lot more annoying 10:31 < bridge> He didn't say anything other he has some lmao 10:31 < bridge> He didn't say anything other than he has some lmao 10:32 < bridge> lmao it broke my phone browser 10:32 < bridge> yeah use firefox with that site 10:33 < bridge> its usually a bit faster, tho chrome seems to have fixed it on desktop 10:33 < bridge> They did say they have ddos protection which is exactly what we are trying to avoid 10:33 < bridge> i remember like 2 years ago it was unuseable 😄 10:33 < bridge> So no, he didn't convince me at all 10:38 < bridge> firefox on phone? 10:38 < bridge> yeah 10:39 < bridge> https://f-droid.org/packages/org.mozilla.fennec_fdroid/ 10:40 < bridge> if u got iphone u screwed tho xd 10:40 < bridge> it only allows safari backend 10:50 <+ChillerDragon> pog pog i fixed git 10:56 < bridge> bro an iphone has better performance than my laptop 10:57 < bridge> i absolutely dont have one 10:57 < bridge> that's not my point ^^ 10:57 < bridge> :feelsbadman: 10:57 < bridge> apple disallows browers to have their own backends 10:57 < bridge> they all use safari 10:57 < bridge> apple sux 10:57 < bridge> if u use chrome, u use safari xD 10:58 < ws-client> Can someone leak the :feelsbadman: texture? 10:59 < bridge> oops 10:59 < bridge> well firefox works good 11:00 < bridge> rip my mobile data though lmfao 11:00 < bridge> you probably need to scale it down 11:00 < bridge> https://cdn.discordapp.com/attachments/293493549758939136/1112666769790881812/feelsbadman.png 11:01 < bridge> does anyone remember ctf_epic 11:01 < bridge> I wanted to build Rust dependencies as shared libs and not rebuild them each time. For unit tests wanted a test harness that is implicitly run before each test 11:02 < bridge> https://heinrich5991.de/teeworlds/maps/thumbs/ctf_epic_48982045.map.png 11:02 < bridge> this? 11:02 < bridge> yeah 11:03 < bridge> i'm unsure but maybe i have seen it before 11:03 < bridge> i remember seeing ctf maps like that in those weird ctf with levels mods 11:04 < bridge> the shared lib thing is actually not there, yea :/ 11:04 < bridge> the other thing is possible, you can define your own `#[test]` attribute that does what you want 11:05 < bridge> static linking is master race 11:06 < bridge> useful feature? 11:06 < bridge> https://cdn.discordapp.com/attachments/293493549758939136/1112668233456156752/Demo-UI-Dragging.mp4 11:06 < bridge> no, but still epic 11:06 < bridge> xdd 11:06 < bridge> see https://docs.rs/test-log/latest/test_log/ for an example 11:07 < bridge> if u pr it make sure it has a high move tollerance before moving. i often move while clicking and hate apps that are too sensitive when dragging ^^ 11:08 < bridge> it starts moving after dragging for more than 5 pixels (2d distance) 11:09 < bridge> behaves similar to Windows I'd say 11:12 < ws-client> thanks @Mr.Gh0s7 11:12 < bridge> btw I have yet to upload my dotfiles :/ 11:13 < bridge> I came across a strange error and can't push to the dwm repo >:( 11:17 < bridge> (to my dwm repo xD) 11:29 < bridge> Still requires touching every one of the thousands of files containing a test though, right? 11:33 < bridge> yes, once 11:36 < bridge> true, this made me remember seeing a gentoo staff calling static linking a bug 11:38 < bridge> 🥲 12:21 < bridge> yeah, if something interesting happens bottom left 12:22 < bridge> today im older 12:22 < bridge> :justatest: 12:23 < bridge> https://cdn.discordapp.com/attachments/293493549758939136/1112687555201212416/image.png 12:24 < bridge> happy birthday 🎂 12:24 < bridge> technically, you're getting older every day though 🙂 12:26 < ws-client> e wot i reinstalled my vps and dns is still working am i losing it? 12:32 <+ChillerDragon> !help 12:32 < chillerbot1> https://github.com/ChillerDragon/ddnet-bot-irc eth0=172.17.0.2 commands: !mods, !ping, !p (hex traffixc), !sh (bash) 12:32 <+ChillerDragon> !ip 12:32 <+ChillerDragon> !ipaddr 12:32 <+ChillerDragon> fk 12:32 <+ChillerDragon> a there it is xd 12:33 <+ChillerDragon> omg its wrong xd 13:17 < bridge> happy bday :happy: 14:20 < bridge> guys, why i cant watch demo while im playing on server? 14:20 < bridge> its bad, need to fix 14:22 < bridge> the whole client is simply not build for it 14:22 < bridge> just open a second client 14:22 < bridge> this isnt really an easy fix 14:27 < bridge> sad 14:38 < bridge> are you playing an a server or watching a demo? 14:45 < bridge> im playing on server, and i want to watch demo without disconnect 14:47 < bridge> > just open a second client 14:52 < bridge> it's a crutch 14:52 < bridge> i didnt ask how, i asked for new feature 14:56 < bridge> it is a feature: simply open a second client :troll: 15:07 < bridge> Just when I want my custom button's position to move with the mouse's velocity, you do this afterwards and it makes me both happy and mad :kek: 15:41 < bridge> thanks 15:41 < bridge> :brownbear: 16:01 < bridge> happy ddbirthday 16:08 < bridge> i think it's regular birthday 16:08 < bridge> ddbirthday is on 02/01/2015 16:09 < bridge> yeah 16:10 < bridge> may kids are the best 16:10 < bridge> at least, you never have to worry about your age 16:10 < bridge> born on 2000 16:10 < bridge> but he'll never be able to have lived in 3 centuries 16:10 < bridge> except he gets 200 years old xD 16:11 < bridge> cant wait to be an old sack 16:11 < bridge> ez 16:11 < bridge> i know 16:11 < bridge> 2023 = 23 16:12 < bridge> @Jupeyy_Keks there is big drama in rust rn 16:12 < bridge> i love drama 16:12 < bridge> https://www.reddit.com/r/rust/comments/13tsmht/jt_why_i_left_rust/ 16:12 < bridge> https://www.reddit.com/r/rust/comments/13uidp3/accountability_requires_courage/ 16:12 < bridge> https://www.reddit.com/r/rust/comments/13u8car/rust_the_wrong_people_are_resigning/ 16:12 < bridge> https://www.reddit.com/r/rust/comments/13ug42p/lets_thank_who_have_helped_us_in_the_rust/ 16:12 < bridge> here 16:13 < bridge> technically, he was born on 20th century 🙂 16:13 < bridge> > Unfortunately we have witnessed another example of how the folks involved in the Rust project allow a culture of “back channels” and “out groups”. The people involved in the highest level of leadership do not self-police in a productive fashion. 16:13 < bridge> > 16:13 < bridge> > Why are people associated with The Rust Project’s leadership always so opaque about who is responsible? Why are we always hearing about one “individual” acting without the permission of “leadership”? 16:13 < bridge> > 16:13 < bridge> > In order to have actual accountability of people’s actions, which JT suggests is the root of the sickness we are witnessing in the leadership teams you need to have courage to stand up to others. We need to condemn the actions of those who act outside their station. You need to have the courage to name and shame when required. In this case, the individual who messaged @rabidferret claiming to represent the consensus of the project should be eje 16:15 < bridge> is there a summary somewhere 16:15 < bridge> i dont understand this 😄 16:17 < bridge> no 16:17 < bridge> but its mainly "back channels" on leadership 16:18 < bridge> @Jupeyy_Keks read the links in order i sent them 16:18 < bridge> well what is back channels in this context 😄 16:18 < bridge> i read it, but its confusing af 16:19 < bridge> also the talk itself is interesting 16:20 < bridge> compile time reflection 16:20 < bridge> https://soasis.org/posts/a-mirror-for-rust-a-plan-for-generic-compile-time-introspection-in-rust/ 16:21 < bridge> i wait for a video 😂 16:21 < bridge> someones heart got broken 16:21 < bridge> bcs of some leadership 16:21 < bridge> thats all i understand 16:28 < bridge> wait for the tik toks 16:30 < bridge> 1. council invites P as keynote speaker for RustConf 16:31 < bridge> 2. some council member A ask RustConf admin B to decline P 16:31 < bridge> 3. admin B accepts to decline P 16:31 < bridge> 4. P doesn't understand and feels like he was mistreated (which is the case from what i've read). He makes a blog post about it 16:31 < bridge> 5. A realizes he's been duped and leaves Rust council 16:31 < bridge> 6. Drama ensures 16:36 < bridge> But why in first place decline. do they hate each others xd 16:37 < bridge> where can i programm a bot for ddnet? 16:38 < bridge> feels like, the invited guy was from the C comitee 16:38 < bridge> lmao 16:38 < bridge> where can i programm a bot for ddnet?(not for hacking) 16:41 < bridge> for educational purposes? 16:42 < bridge> for educating the pros :kek: 16:42 < bridge> yes 16:43 < bridge> my friend wanted to know 16:43 < bridge> in ddnet jail 16:43 < bridge> is sth like that not allowed? 16:44 < bridge> obviously not 16:44 < bridge> what do you think of when you imagine a bot and not for hakcing 16:44 < bridge> what do you think of when you imagine a bot and not for hacking 16:44 < bridge> Hey guys, do you know if I can bind vote to a key somehow? 16:44 < bridge> wait maybe we misunderstood. Is it a bot that plays the game or or like a discord bot for ddnet? 16:46 < bridge> like a bot that when someone moves me from a spot then it moves back there alone 16:46 < bridge> bind "" "vote " 16:46 < bridge> `bind callvote option ` 16:46 < bridge> ```2023-05-29 17:45:54 I chatresp: Invalid arguments... Usage: vote r['yes'|'no'] 16:46 < bridge> 2023-05-29 17:46:20 I chatresp: Invalid arguments... Usage: callvote s['kick'|'spectate'|'option'] s[id|option text] ?r[reason]``` 16:46 < bridge> thanks, will see if that works 16:48 < bridge> huh, this must have been added recently (I mean the usage help) 16:48 < bridge> works on my machine. (eg bind f3 vote yes) 16:49 < bridge> the question is, how do I get vote option text if it uses some weird characters 16:49 < bridge> hm, no(?) 16:50 < bridge> call it and copy from f1 16:50 < bridge> `2023-05-29 17:50:33 I chat: *** '<~{Barsik}~>' called vote to change server option 'Scorelimit 100' (No reason given)` 16:50 < bridge> alright, thanks 16:54 < bridge> Well, the vote I want to call with a bind does not print out anything in the console :/ 17:06 < bridge> xd 17:08 < bridge> You're trying to bind a vote so that it calls that vote on a buttonpress? What's the vote that you're trying to call? 17:28 < bridge> LOL, they didn't want the dude to speak because he wrote a blogpost critical of Rust? 😄 17:31 < bridge> Actually it doesn't even say critical, what could one write in a blogpost about reflection that is controversial even? 17:37 < bridge> @Learath2 when is const_cast used? 17:38 < bridge> Preferably never, it's just a patch for a lack of language features 17:38 < bridge> ```cpp 17:38 < bridge> Block *make_Block(const OpBuilder &builder, Region *region) 17:38 < bridge> { 17:38 < bridge> return const_cast(builder).createBlock(region); 17:38 < bridge> } 17:38 < bridge> ``` 17:38 < bridge> i cant call createBlock without it here 17:38 < bridge> Can't you take a non-const reference to it to begin with? 17:38 < bridge> i wonder 17:38 < bridge> i use this with cxx 17:38 < bridge> well i jsut started toying with it 17:39 < bridge> a bridge with rust 17:39 < bridge> Because if you cast away const and it is actually const it's UB 17:39 < bridge> (the c api lacks features) 17:39 < bridge> const_cast is only for non-const correct apis to be able to be called 17:40 < bridge> "and the function you call actually modifies the value" is more correct I guess 17:41 < bridge> (when you know an object isn't const is also fine, but that's not the case I was trying to illustrate) 17:43 < bridge> what if the type is behind a unique ptr 17:43 < bridge> i tried to make it non const but i think it fails 17:44 < bridge> Oh I remember a good example, `strchr()`. It takes and returns a `char *` but you can safely use it on a `const char *` instead 17:44 < bridge> Hm, is this generated code or sth? 17:45 < bridge> e.g. what calls `make_Block`? Why can't it pass a non-const reference? 17:45 < bridge> ``` 17:45 < bridge> running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "/Users/edgar/Documents/mlircpp/target/debug/build/mlircpp-7a862e997e3d30d5/out/cxxbridge/include" "-I" "/Users/edgar/Documents/mlircpp/target/debug/build/mlircpp-7a862e997e3d30d5/out/cxxbridge/crate" "-Wall" "-Wextra" "-std=c++17" "-I/opt/homebrew/opt/llvm@16/include" "-Wno-unused-parameter" "-o" "/Users/edgar/Documents 17:45 < bridge> cargo:warning=/Users/edgar/Documents/mlircpp/target/debug/build/mlircpp-7a862e997e3d30d5/out/cxxbridge/sources/mlircpp/src/bridge.rs.cc:483:36: error: cannot initialize a variable of type '::std::unique_ptr< ::OpBuilder> (*)(const ::MLIRContext &)' (aka 'unique_ptr (*)(const mlir::MLIRContext &)') with an lvalue of type 'std::unique_ptr (mlir::MLIRContext &)': type mismatch at 1st parameter ('const ::MLIRContext &' (ak 17:45 < bridge> cargo:warning= ::std::unique_ptr<::OpBuilder> (*make_OpBuilder$)(::MLIRContext const &) = ::make_OpBuilder; 17:45 < bridge> cargo:warning= ^ ~~~~~~~~~~~~~~~~ 17:45 < bridge> cargo:warning=1 error generated. 17:45 < bridge> exit status: 1 17:45 < bridge> ``` 17:45 < bridge> 17:45 < bridge> source: 17:45 < bridge> ```cpp 17:45 < bridge> std::unique_ptr make_MLIRContext(); 17:45 < bridge> std::unique_ptr make_OpBuilder(MLIRContext &); 17:46 < bridge> 17:46 < bridge> std::unique_ptr make_MLIRContext() 17:46 < bridge> { 17:46 < bridge> mlir::DialectRegistry registry; 17:46 < bridge> mlir::registerAllDialects(registry); 17:46 < bridge> 17:46 < bridge> return std::make_unique(registry); 17:46 < bridge> } 17:46 < bridge> 17:46 < bridge> std::unique_ptr make_OpBuilder(MLIRContext &context) 17:46 < bridge> { 17:46 < bridge> return std::make_unique(&context); 17:46 < bridge> } 17:46 < bridge> ``` 17:46 < bridge> it works if context is const 17:46 < bridge> ```cpp 17:46 < bridge> std::unique_ptr make_OpBuilder(const MLIRContext &context) 17:46 < bridge> { 17:46 < bridge> return std::make_unique(const_cast(&context)); 17:46 < bridge> } 17:46 < bridge> ```` 17:46 < bridge> @Learath2 17:47 < bridge> ```rust 17:47 < bridge> #[test] 17:47 < bridge> fn myfunc() { 17:47 < bridge> let c = make_MLIRContext(); 17:47 < bridge> let op = make_OpBuilder(&c); 17:47 < bridge> } 17:47 < bridge> ``` 17:47 < bridge> xd 17:47 < bridge> Ah so it is generated 17:47 < bridge> nono 17:47 < bridge> i can define how it is generated 17:47 < bridge> i can remove the const 17:47 < bridge> but idk i get a error xd 17:48 < bridge> oh wait 17:48 < bridge> Okay, I think the context needs to be passed non-const too 17:48 < bridge> maybe i did smth bad 17:49 < bridge> idk why it's getting the const, or where it's getting the const 17:50 < bridge> ```cpp 17:50 < bridge> error: cannot initialize a variable of type '::std::unique_ptr< ::OpBuilder> (*)(const ::MLIRContext &)' (aka 'unique_ptr (*)(const mlir::MLIRContext &)') with an lvalue of type 'std::unique_ptr (mlir::MLIRContext &)': type mismatch at 1st parameter ('const ::MLIRContext &' (aka 'const mlir::MLIRContext &') vs 'mlir::MLIRContext &') 17:50 < bridge> ``` 17:50 < bridge> i removed all consts i found lol 17:50 < bridge> maybe llvm constructor of opbuilder requires a const ref to context? 17:50 < bridge> Well let me take a look 17:50 < bridge> ```cpp 17:50 < bridge> /// Create a builder with the given context. 17:50 < bridge> explicit OpBuilder(MLIRContext *ctx, Listener *listener = nullptr) 17:50 < bridge> : Builder(ctx), listener(listener) {} 17:50 < bridge> ```` 17:50 < bridge> doesnt see so 17:51 < bridge> does make_unique require const 17:51 < bridge> xd 17:51 < bridge> idk how the translation layer handle these but why isn't your make_OpBuilder taking a std::unique_ptr? 17:52 < bridge> because i didnt make it so 17:52 < bridge> i can make it so 17:52 < bridge> let me see 17:52 < bridge> Ohh, I see what's going on here 17:53 < bridge> You can't get a non-const ptr out of a unique_ptr 17:53 < bridge> chillerdragon: 17:53 < bridge> Otherwise you could destroy the object, but unique_ptr is supposed to be managing it 17:53 < bridge> @Learath2 17:54 < bridge> oh 17:54 < bridge> https://en.cppreference.com/w/cpp/memory/unique_ptr/release 17:54 < bridge> so the const thing is good? 17:54 < bridge> This is how you get it out 17:54 < bridge> my coworker made this before 17:54 < bridge> xd 17:55 < bridge> I think in this case I would have OpBuilder take the context and release it before passing it to llbm 17:55 < bridge> llvm* 17:55 < bridge> So move out of c I guess? 17:55 < bridge> Idk how rust maps to c++ 17:55 < bridge> we need to keep context 17:55 < bridge> we own it 17:56 < bridge> im using the cxx crate 17:56 < bridge> https://cxx.rs/concepts.html 17:56 < bridge> If you need to access it later I guess a shared_ptr/Arc is called for 17:56 < bridge> what we use in ddnet 17:56 < bridge> but say 17:56 < bridge> i have a unique ptr of context 17:56 < bridge> cant i just pass a ref of context to a function 17:56 < bridge> why do i need to pass the unique ptr itself 17:58 < bridge> Hm, actually now that I re-read this section I think you should be able to get a normal pointer too 18:01 < bridge> Yeah, idk, is it maybe the &c in the rust code generating this? I don't understand why it's trying to generate a `::std::unique_ptr< ::OpBuilder> (*)(const ::MLIRContext &)` 18:01 < bridge> `pub fn make_MLIRContext() -> ::cxx::UniquePtr` 18:02 < bridge> on rust i have to define the function too 18:02 < bridge> i have it like 18:02 < bridge> `fn make_OpBuilder(context: &MLIRContext) -> UniquePtr;` 18:03 < bridge> Can you check the generated code btw? 18:03 < bridge> it'd be interesting to see around this error 18:03 < bridge> ```cpp 18:03 < bridge> ::OpBuilder *cxxbridge1$make_OpBuilder(::MLIRContext const &context) noexcept { 18:03 < bridge> ::std::unique_ptr<::OpBuilder> (*make_OpBuilder$)(::MLIRContext const &) = ::make_OpBuilder; 18:03 < bridge> return make_OpBuilder$(context).release(); 18:03 < bridge> } 18:03 < bridge> 18:03 < bridge> ```` 18:03 < bridge> lol 18:04 < bridge> ```cpp 18:04 < bridge> ::MLIRContext *cxxbridge1$make_MLIRContext() noexcept { 18:04 < bridge> ::std::unique_ptr<::MLIRContext> (*make_MLIRContext$)() = ::make_MLIRContext; 18:04 < bridge> return make_MLIRContext$().release(); 18:04 < bridge> } 18:04 < bridge> ``` 18:04 < bridge> bizarre bizarre bizarre, that const there is obviously the reason for your issue, Opbuilder wants a non-const reference as per LLVM docs 18:05 < bridge> Also this generated code does look a little insane, why is it creating a unique_ptr only to destroy it the next line? 18:06 < bridge> it does it on all 18:06 < bridge> hmm 18:06 < bridge> must be some c++ quirk with rust? 18:06 < bridge> im sure dtolnay knows his shit xd 18:07 < bridge> Yeah, I'd think I'm holding it wrong before I question cxx 18:07 < bridge> let me see what we do i nddnet 18:10 < bridge> Ah I think I get it. It calls your function, then destroys the unique_ptr immediately because now Rust took ownership 18:10 < bridge> i see 18:11 < bridge> Now when you borrow from the context that seems to generate a const. Idk why that is the case 18:11 < bridge> maybe because a rust & ref is const? 18:12 < bridge> its immutable 18:13 < bridge> well maybe const_cast isnt as bad here? 18:13 < bridge> xd 18:14 < bridge> Do you have `type MLIRContext` somewhere? 18:14 < bridge> I mean the const cast is technically safe here, since you know for a fact that the underlying object wasnt declared const. But why is it happening in the first place? Is that not the more curious thing? 18:14 < bridge> ye 18:15 < bridge> type MLIRContext; 18:15 < bridge> i wonder 18:16 < bridge> Now that I think about it. I think this type of relationship just isn't a thing Rust really has 18:16 < bridge> OH maybe try a mutable borrow? 18:17 < bridge> It is technically wrong, since I have a feeling OpBuilder keeps a reference to Context, but there might not be a better way to map this 18:17 < bridge> ```rust 18:17 < bridge> error[cxxbridge]: needs a cxx::ExternType impl in order to be used as a non-pinned mutable reference in signature of `make_OpBuilder` 18:17 < bridge> ┌─ src/bridge.rs:12:9 18:17 < bridge> │ 18:17 < bridge> 12 │ type MLIRContext; 18:17 < bridge> │ ^^^^^^^^^^^^^^^^ needs a cxx::ExternType impl in order to be used as a non-pinned mutable reference in signature of `make_OpBuilder` 18:17 < bridge> 18:17 < bridge> 18:17 < bridge> error[cxxbridge]: mutable reference to C++ type requires a pin -- use Pin<&mut MLIRContext> 18:17 < bridge> ┌─ src/bridge.rs:24:36 18:17 < bridge> │ 18:17 < bridge> 24 │ fn make_OpBuilder(context: &mut MLIRContext) -> UniquePtr; 18:17 < bridge> │ ^^^^^^^^^^^^^^^^ mutable reference to C++ type requires a pin -- use Pin<&mut MLIRContext> 18:17 < bridge> ``` 18:18 < bridge> https://cxx.rs/extern-c++.html 18:19 < bridge> this is more complicated than expected 18:19 < bridge> xd 18:20 < bridge> I guess you just impl ExternType and it should work? Idk I never used the cxx bridge 18:21 < bridge> didnt follow, but why not pass a pointer? 18:22 < bridge> u want a unique ptr out of a reference? 18:22 < bridge> or do u want it to be copied? 18:23 < bridge> it seems like cxx always adds const 18:23 < bridge> it also does for a *const 18:24 < bridge> Issue is constness, the c++ api requires a non-const pointer. The bridge generates const pointers 18:24 < bridge> the externtype manual impl is if u use bindgen iirc 18:24 < bridge> what's so bad about const pointers 18:24 < bridge> pointers are just ints 😂 18:24 < bridge> its not that 18:24 < bridge> it requires to use const_cast 18:24 < bridge> everywhere 18:25 < bridge> It can't possibly add a const if you are passing a mutable borrow 18:25 < bridge> the source: is the source u want to use? 18:25 < bridge> ye 18:25 < bridge> u build a unique ptr out of a reference 18:25 < bridge> no 18:26 < bridge> but u do it 18:26 < bridge> it calls opbuilder constructor 18:26 < bridge> Idk maybe pin it just to see if it generates properly? 18:26 < bridge> so does opbuild have nothing to do with the context directly? 18:26 < bridge> ok ill see the pin 18:26 < bridge> it's only there to be called 18:26 < bridge> opbuilder uses context in the constructor 18:27 < bridge> i mean in the sense of rust, Pin probably makes sense here 18:27 < bridge> references in cpp are not reassignable 18:28 < bridge> works with pin 18:28 < bridge> Technically. I think since OpBuilder probably keeps that pointer, to do it properly you need lifetimes too 18:28 < bridge> I doubt OpBuilder outliving it's context is sane 18:29 < bridge> doesnt cxx require unsafe anyway 18:29 < bridge> UniquePtr even has a pin_mut method 18:29 < bridge> But anyway, so it was indeed the immutable borrow that's the issue. I wonder why the pin is needed 18:29 < bridge> ```rust 18:29 < bridge> #[test] 18:29 < bridge> fn myfunc() { 18:29 < bridge> let mut c = make_MLIRContext(); 18:29 < bridge> let op = make_OpBuilder(c.pin_mut()); 18:29 < bridge> } 18:29 < bridge> ``` 18:29 < bridge> works 18:29 < bridge> no const anymore 18:30 < bridge> Does the generated code look sane? 18:30 < bridge> yeah thats true 18:30 < bridge> its smth i gotta express in rust 18:30 < bridge> opbuilder is "owned" by the context 18:30 < bridge> ```cpp 18:30 < bridge> ::OpBuilder *cxxbridge1$make_OpBuilder(::MLIRContext &context) noexcept { 18:30 < bridge> ::std::unique_ptr<::OpBuilder> (*make_OpBuilder$)(::MLIRContext &) = ::make_OpBuilder; 18:30 < bridge> return make_OpBuilder$(context).release(); 18:31 < bridge> } 18:31 < bridge> ``` 18:31 < bridge> looks like this 18:31 < bridge> so ye 18:32 < bridge> do u need this for work? 18:33 < bridge> That link I sent had an example of lifetimes 18:34 < bridge> I guess the idea is that you give a lifetime to that mut borrow. But there is a potential issue there. There can't exist more than one borrow if there is a hanging mut borrow 18:35 < bridge> So is the context even usable until you destroy the opbuilder than? 18:36 < bridge> Maybe an Arc/SharedPtr is the better abstraction for MLIRContext 18:38 < bridge> Rc, I guess, A part may not be necessary here 18:39 < bridge> every rc and arc means a refcell, mutex etc. 18:39 < bridge> except its read only 18:39 < bridge> @Ryozuki what are the goals of your work? 18:39 < bridge> 18:39 < bridge> do u need a high performance compiler? 18:40 < bridge> or just get things done? xd 18:40 < bridge> They model shared ownership is my point 18:40 < bridge> yeah, but that also means more "randomness" 18:40 < bridge> in a sense that u cannot control it cleanly anymore 18:40 < bridge> Yeah, if you don't care about correctness and just want it done I guess this current model is good enough as long as you make sure you don't ever drop context before the opbuilder 18:41 < bridge> a shared object might suddenly outlife something u didnt expect or wanted 18:41 < bridge> tbh idk 18:41 < bridge> but we need to make the compiler with mlir 18:41 < bridge> and we use the c api which is simple 18:41 < bridge> but it lacks features 18:41 < bridge> for example we cannot get the data layout for a given type 18:41 < bridge> 😂 18:41 < bridge> because the c api doesnt have it 18:41 < bridge> so we are going to cpp now 18:41 < bridge> ryo just does smth random 18:41 < bridge> Btw, didn't anyone else already wrap the C++ api for llvm? 18:42 < bridge> @Jupeyy_Keks i do what i do to get paid lel 18:42 < bridge> @Learath2 no 18:42 < bridge> thats insane 18:42 < bridge> inkwell wraps the c api 18:42 < bridge> of llvm 18:42 < bridge> but the c api of llvm is better 18:42 < bridge> mlir is quite new, so they focus on c++ 18:42 < bridge> @Ryozuki u have freetime.... waste it for wrapping llvm 18:42 < bridge> the c api is behind 18:42 < bridge> :^) 18:42 < bridge> Well good luck. I need to take a shower and do some chores 18:42 < bridge> yeah its fine dw 18:43 < bridge> Look into making MLIRContext a shared_ptr. I think that is the correct model here 18:43 < bridge> i was mostly curious 18:43 < bridge> https://github.com/TheDan64/inkwell 18:49 < bridge> anyway this convo was interesting 18:49 < bridge> mixing 2 langs gives light to interesting things 18:50 < bridge> @Jupeyy_Keks why make a binding, we just need to rewrite llvm in rust 18:50 < bridge> :BASEDDEPT: 18:50 < bridge> :PES2_BasedGe: 18:50 < bridge> tru story 19:02 < bridge> well idk, because this mlircontext will be wrapped in a context struct, that can be the single owner 19:02 < bridge> and then with lifetimes we can model the opbuilder lifetime 19:02 < bridge> opbuilder needn't have the pointer itself 19:02 < bridge> needn't, such pro english 19:09 < bridge> idk how the opbuilder is used, so I can't comment very much on this, but when you create the opbuilder and return from it you have your MLIRContext back, but on the C++ side a non-const reference to it is kept, now when you borrow mut or non-mut from the context, aren't you breaking rust assumptions? 19:10 < bridge> Specifically that there can exist no mut borrows along with immut ones and no more than one mut borrow? 19:10 < bridge> the context has no methods itself 19:10 < bridge> > the underlying principle of the context is that it is used to provide an isolated environment (or “context”, hence the name), in which your entire IR is living. This includes types, attributes, location, dialect, identifiers, and every operation that references these. 19:11 < bridge> ok it has methods 19:11 < bridge> but 19:11 < bridge> honestly i wonder 19:11 < bridge> xd 19:12 < bridge> I don't see how methods are relevant, but the more I think about it the less I think there is a sane way to wrap context in Rust 19:12 < bridge> > Create a builder with the given context. 19:12 < bridge> multiple mut borrows isn't a thing Rust can do 19:13 < bridge> i wonder how other safe wrappers are done 19:14 < bridge> it is possible 19:14 < bridge> in rust u would do that with interior mutability 19:14 < bridge> aka runtime checks 19:14 < bridge> rc refcell 19:15 < bridge> > If you have a reference &T, then normally in Rust the compiler performs optimizations based on the knowledge that &T points to immutable data. Mutating that data, for example through an alias or by transmuting an &T into an &mut T, is considered undefined behavior. UnsafeCell opts-out of the immutability guarantee for &T: a shared reference &UnsafeCell may point to data that is being mutated. This is called “interior mutability”. 19:15 < bridge> https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell.html 19:16 < bridge> Ah, that's cool 19:16 < bridge> but well, u dont rly own the context on the rust side, just a unique ptr 19:16 < bridge> no? 19:16 < bridge> You do own it, I think that's what the wrapper implies. It immediately destroys the unique_ptr 19:17 < bridge> It seems to imply that the ownership moved from the `std::unique_ptr` on the cxx side to the `UniquePtr` on the rust side 19:22 < bridge> 19:22 < bridge> don't explode pls 19:23 < bridge> i think i only need to care about opbuilder outliving the context tbh 19:24 < bridge> idk head exploding 19:25 < bridge> I would love to be of more help but I possess limited knowledge of both the cxx crate and LLVM 😄 19:25 < bridge> yeah 19:26 < bridge> but this is a common pattern in the c/c++ world 19:26 < bridge> holding a context 19:26 < bridge> sdl does this, but it has a single global context 19:26 < bridge> sdl init exit 19:26 < bridge> Yeah maybe check out another wrapper where there is context involved? Curl has lots of mutable contexts passing around 19:27 < bridge> Though curl I think does it in a controlled manner, as in they don't stack them inside eachother 😄 19:28 < bridge> Oh, curl_multi might be a good place to check if anyone wrapped that one 19:28 < bridge> i mean llvm only has 1 context u pass around 19:28 < bridge> A curl_multi handle keeps non-const pointers to curl_easy handles, and you can still use the handles so you also have non-const ones 19:29 < bridge> https://github.com/alexcrichton/curl-rust/blob/main/src/multi.rs 19:29 < bridge> its c tho 19:30 < bridge> Here is the interesting part I guess 19:30 < bridge> https://cdn.discordapp.com/attachments/293493549758939136/1112795232954753214/image.png 19:37 < bridge> Okay, it just cheats to avoid the problem by using a `*mut CURL` 19:38 < bridge> dereferencing that requires an unsafe so if you break anything it's your own fault I presume 😄 19:40 < bridge> xd 19:40 < bridge> ye thats how i guessed 19:48 < bridge> So I guess you should probably wrap the Opbuilder in a struct and shove a `PhantomData` next to it? 19:51 < bridge> ye 19:51 < bridge> thats what we do in the c api binding too 19:51 < bridge> and its how its done generally imo 19:52 < bridge> ```rust 19:52 < bridge> pub struct Operation<'c> { 19:52 < bridge> raw: MlirOperation, 19:52 < bridge> _context: PhantomData<&'c Context>, 19:52 < bridge> } 19:52 < bridge> ``` 19:52 < bridge> the c api 19:56 < bridge> Sounds sane, I guess you just have to make sure you treat the type opaquely on the rust side and there'll be no issues 20:16 < bridge> This sounds quite fun to work with, maybe I should wrap a couple c++ libraries for people 20:18 < bridge> Maybe I can also have stars on my repos 21:15 < bridge> I finally managed to push it :). I runned `git config http.version HTTP/1.1` and now it worked! Could this have any side effects though? 21:27 < bridge> ChillerDragon https://github.com/Inateblig/dotfiles it only took a second :justatest: 21:27 < bridge> Huh, why was that needed? Bizarre 21:28 < bridge> I don't know either I hope it doesn't break anything though. I just tried stuff with care and the start and then starting expirementing with other stuff here's the stackoverflow link btw https://stackoverflow.com/questions/59282476/error-rpc-failed-curl-92-http-2-stream-0-was-not-closed-cleanly-protocol-erro 21:34 < bridge> installed the game over steam and this happend lol 21:34 < bridge> https://cdn.discordapp.com/attachments/293493549758939136/1112826248239001770/VID_20230529_212856.mp4 21:35 < bridge> new dance feature 21:35 < bridge> hehe and whats the fix 21:36 < bridge> update drivers 21:38 < bridge> or click the other start option 21:38 < bridge> if that start option is finally fixed 21:51 < bridge> @heinrich5991 Teeskins website is down and I have no idea if NeXus will come back to re-open it, so I'll already do preparations for Teeworlds Data. So might as well change the forum links for Teeskins to "unavailable currently" or something. 21:52 < bridge> I also have no idea if the API works, if it pulls the repo's Assets or not, so that might also need a check. 21:54 < bridge> what happened to him :/ 21:54 < bridge> I have no idea. I cannot contact him and he is not up since the beginning of this year 21:55 < bridge> rip 21:55 < bridge> Indeed 21:56 < bridge> where 21:58 < bridge> does it show u when u start it from steam? 21:58 < bridge> what OS are u even on 22:59 < bridge> Thanks 22:59 < bridge> (@Reteah) 23:12 < bridge> anyone know clang-tidy well enough to tell me if i can use it to add the parent enum's name as a prefix to the enum constants 23:13 < bridge> ```cpp 23:13 < bridge> enum TEST { 23:13 < bridge> TEST_ONE, 23:13 < bridge> TEST_TWO 23:13 < bridge> } 23:13 < bridge> ``` 23:13 < bridge> etc 23:17 < bridge> ```cpp 23:17 < bridge> enum TEST { 23:17 < bridge> ONE, 23:17 < bridge> TWO 23:17 < bridge> }; 23:17 < bridge> ``` 23:17 < bridge> turns into 23:17 < bridge> ``` 23:17 < bridge> enum TEST { // automatically put test in front of constant names 23:17 < bridge> TEST_ONE, 23:17 < bridge> TEST_TWO 23:17 < bridge> }; 23:18 < bridge> ``` 23:18 < bridge> ```cpp 23:18 < bridge> enum TEST { 23:18 < bridge> ONE, 23:18 < bridge> TWO 23:18 < bridge> }; 23:18 < bridge> ``` 23:18 < bridge> turns into 23:18 < bridge> ```cpp 23:18 < bridge> enum TEST { // automatically put test in front of constant names 23:18 < bridge> TEST_ONE, 23:18 < bridge> TEST_TWO 23:18 < bridge> }; 23:18 < bridge> ``` 23:22 < bridge> i don't know for clang-tidy, but it's easy with a macro 23:23 < bridge> okay, not that easy actually 23:23 < bridge> but still possible 23:57 < bridge> hey when are moving tiles coming to ddnet? is there a reason to not do it? 23:59 < bridge> it would be hard to do right 23:59 < bridge> but it would be accepted? 23:59 < bridge> atm the way kog does it is not on the game layer so it doesn’t work in entities