Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.org/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2024-10-24 00:00 and 2024-10-25 00:00
Avatar
Hey @heinrich5991 , Broken led me to you that you might have the f33 map. If you have it, can you send it to me please? 🙂
Avatar
ChillerDragon, could you not make the repo public...
05:14
oh. it is not public. wondered why I had access out of the box
05:14
lol
Avatar
hello world
🚀 1
🗯️ 1
Avatar
MilkeeyCat 2024-10-24 06:09
@heinrich5991 yo, can you pls explain why this code works: struct Foo<'a> { u: &'a usize, } impl<'a> Foo<'a> { fn new() -> Self { Self { u: &10 } } fn test(&'a self) {} } fn main() { let foo = Foo::new(); foo.test(); drop(foo); } But if method test is changed to fn test(&'a mut self) it doesn't work, it says it can't move out foo because it's borrowed, isn't it also borrowed without mut? :\
Avatar
time to learn about elf relocatable files
07:05
im writing my own compiler backend
Avatar
ok i know how now
Avatar
"I know Kung Fu"
Avatar
wdym xD
08:27
pub fn build_object() { let mut builder = build::elf::Builder::new(object::Endianness::Little, true); builder.header.e_type = elf::ET_REL; builder.header.e_machine = elf::EM_X86_64; builder.header.e_phoff = 0x40; let section = builder.sections.add(); section.name = b".shstrtab"[..].into(); section.sh_type = elf::SHT_STRTAB; section.data = build::elf::SectionData::SectionString; let section = builder.sections.add(); section.name = b".strtab"[..].into(); section.sh_type = elf::SHT_STRTAB; section.data = build::elf::SectionData::String; let section = builder.sections.add(); section.name = b".text"[..].into(); section.sh_type = elf::SHT_PROGBITS; section.sh_flags = (elf::SHF_ALLOC | elf::SHF_EXECINSTR) as u64; section.sh_addralign = 16; // program data goes here. let my_func_data: Vec<u8> = vec![ 0xf3, 0x0f, 0x1e, 0xfa, // endbr64 0x55, // push %rbp 0x48, 0x89, 0xe5, // mov %rsp,%rbp 0xc7, 0x45, 0xfc, 0x00, 0x00, 0x00, 0x00, // movl $0x0,-0x4(%rbp) 0xb8, 0x02, 0x00, 0x00, 0x00, // mov $0x2,%eax 0x5d, // pop %rbp 0xc3, // ret ]; let my_func_data_size = my_func_data.len(); section.data = build::elf::SectionData::Data(my_func_data.into()); let text_id = section.id(); let section = builder.sections.add(); section.name = b".symtab"[..].into(); section.sh_type = elf::SHT_SYMTAB; section.sh_flags = elf::SHF_ALLOC as u64; section.sh_addralign = 8; section.data = build::elf::SectionData::Symbol; let symbol = builder.symbols.add(); symbol.name = b".text"[..].into(); symbol.set_st_info(elf::STB_LOCAL, elf::STT_SECTION); symbol.section = Some(text_id); // Add symbols let symbol = builder.symbols.add(); symbol.name = b"main"[..].into(); symbol.set_st_info(elf::STB_GLOBAL, elf::STT_FUNC); symbol.st_size = my_func_data_size as u64; symbol.section = Some(text_id); // offset to the function within .text // Note: i think it needs to be 16 byte aligned symbol.st_value = 0; builder.set_section_sizes(); let mut file = StreamingBuffer::new(BufWriter::new(File::create("out.o").unwrap())); builder.write(&mut file).unwrap(); }
08:27
this is how to make a relocatable object file (edited)
08:27
this crate is neat
08:28
i think they use it in rustc
Avatar
oh xD
Avatar
Avatar
Pathos
Hey @heinrich5991 , Broken led me to you that you might have the f33 map. If you have it, can you send it to me please? 🙂
heinrich5991 2024-10-24 09:01
09:02
I can see a single f33 map there, search for f33_
👍 1
Avatar
Avatar
MilkeeyCat
@heinrich5991 yo, can you pls explain why this code works: struct Foo<'a> { u: &'a usize, } impl<'a> Foo<'a> { fn new() -> Self { Self { u: &10 } } fn test(&'a self) {} } fn main() { let foo = Foo::new(); foo.test(); drop(foo); } But if method test is changed to fn test(&'a mut self) it doesn't work, it says it can't move out foo because it's borrowed, isn't it also borrowed without mut? :\
heinrich5991 2024-10-24 09:03
the problem is that the mutable reference makes the inner type invariant wrt. the lifetime. your link is indeed the explanation
09:04
in general, you shouldn't tie the inner lifetime to the lifetime of the self reference
09:04
that would avoid some of your troubles
Avatar
MilkeeyCat 2024-10-24 09:06
I understand that you should reevaluate your life decisions which led you to using same lifetime for self, I tried to read about this invariant stuff and I don't get what changes when type is invariant, covariant or contravariant
Avatar
heinrich5991 2024-10-24 09:08
generally, if you have a function that takes a &'a i32 reference, the rust compiler also allows you to pass a reference that lives longer
09:09
e.g. a &'static i32
09:09
does that make sense?
Avatar
MilkeeyCat 2024-10-24 09:10
ye
Avatar
heinrich5991 2024-10-24 09:13
but if you have a function that takes &'static mut &'a i32, rust mustn't allow you to pass a &'static mut &'static i32. why?
Avatar
MilkeeyCat 2024-10-24 09:17
I would allow that
Avatar
heinrich5991 2024-10-24 09:18
then the function can put in another &'a i32, one that actually only lives for 'a into that outer &'static mut
09:18
once the function returns, the caller thinks it has a &'static mut &'static i32, but the inner reference actually only lives for 'a
Avatar
doick комплекс мероприятий 2024-10-24 09:20
where chlindr dragon(#
Avatar
ws-client1 BOT 2024-10-24 09:20
<ChillerDragon> im here
Avatar
heinrich5991 2024-10-24 09:21
got an alert for "dragon"? ^^
Avatar
ws-client1 BOT 2024-10-24 09:21
<ChillerDragon> no i just read here a lot^^
09:23
<ChillerDragon> @jxsl13 i invited you. Your gitlab name was not hard to guess.
Avatar
heinrich5991 2024-10-24 09:28
@MilkeeyCat does that make sense?
Avatar
Avatar
heinrich5991
@MilkeeyCat does that make sense?
MilkeeyCat 2024-10-24 09:56
nope, but thanks for trying to explain xd. I'll keep reading this and maybe later it will make sense
Avatar
Jupstar ✪ 2024-10-24 10:18
@MilkeeyCat maybe you simply overthink it. Do you understand the implicit lifetime your foo object gets? If you do &'a mut self, then rust wants your self argument to have exactly 'a lifetime nothing else - So in your case it must assume self is static (or whatever &32 gets) bcs that is kinda what invariant is. Just take that and don't think any further (edited)
10:20
@MilkeeyCat What are you even doing every day that you find the edgiest edge cases in Rust all the time 😬
10:21
You want references of local variables in function results
10:21
Now this xD
Avatar
MilkeeyCat 2024-10-24 10:21
I just found a comment in other person's project 😬
Avatar
шишкаподмышкай 2024-10-24 11:49
hi
👋 1
Avatar
spooky oxyzo 2024-10-24 11:50
can we move developer channel so newbies dont type here
👍 1
12:05
This is so cursed
12:05
bieban
Avatar
MilkeeyCat 2024-10-24 12:07
cool website xd
💀 1
Avatar
@deen or @heinrich5991 can u move the category development back to its position?
Avatar
Avatar
Ryozuki
@deen or @heinrich5991 can u move the category development back to its position?
Why so?
Avatar
its not pleasing
12:19
it has always been on top
12:19
fuckyousnail
12:20
@Learath2 the order is being destroyed!
12:21
nice we back
12:21
brownbear
Avatar
Avatar
heinrich5991
but if you have a function that takes &'static mut &'a i32, rust mustn't allow you to pass a &'static mut &'static i32. why?
MilkeeyCat 2024-10-24 12:22
how to create &'static mut T variable? 😬
Avatar
heinrich5991 2024-10-24 12:24
let x: &'static mut i32 = Box::leak(Box::new(0));
Avatar
Avatar
heinrich5991
but if you have a function that takes &'static mut &'a i32, rust mustn't allow you to pass a &'static mut &'static i32. why?
MilkeeyCat 2024-10-24 12:29
Is this example correct? fn foo<'a>(_: &'static mut &'a i32) {} fn main() { let x: &'static mut i32 = Box::leak(Box::new(0)); let y: &'static mut &'static i32 = Box::leak(Box::new(x)); foo(y); }
Avatar
heinrich5991 2024-10-24 12:30
in this case, 'a = 'static, so it works
12:32
fn foo<'a>(_: &'static mut &'a i32, _: &'a i32) {} fn main() { let a = 0; let x: &'static mut i32 = Box::leak(Box::new(0)); let y: &'static mut &'static i32 = Box::leak(Box::new(x)); foo(y, &a); }
12:32
this way, 'a cannot be 'static
Avatar
MilkeeyCat 2024-10-24 12:34
Ok, it makes sense
12:35
But it's not the same type or error that was happening before, is it?
Avatar
heinrich5991 2024-10-24 12:43
I think it's the same error
12:44
you had a function that takes &'a mut Foo<'a>
12:44
ah, not exactly the same
12:46
if you define foo as fn foo<'a>(_: &'a mut &'a i32), then you'll get the same, I think
Avatar
Avatar
Ryozuki
it has always been on top
Classic ddnet moment
Avatar
Avatar
fokkonaut
Classic ddnet moment
frfr
Avatar
GitHub BOT 2024-10-24 17:35
When a storage location does not exist, the server/client should quit instead of continuing without this location. Otherwise, if the user directory could not be added, then the client will create folders and write files to the data folder instead. See also #3758, where this happened seemingly with a default storage.cfg. Also, we could check if the config directory is writeable when launching. We had a report from rrrost on Discord that map download did not work, which was seemingly cau...
Avatar
will https://github.com/ddnet/ddnet/pull/8959 be merged any time soon?
On the client side the per-character tuning as-is works acceptable as long as AntiPing is off (infclass uses per-player tuning for many years). Turning on the AntiPing ruins the UX in some cases. (...
🚀 2
Avatar
#include "pretty.h" int main (int argc, string argv[]) { if (argc above 1) with (f, fclose, fopen(argv[1], "r")) fortimes (line, 10) with (buf, free, vector(200, char, 0)) when (fgets(buf, 200, f)) then print(buf) otherwise 0; else println("Please provide an input file"); return EXIT_SUCCESS; }
18:38
Making C Look ✨Pretty✨and Lua/Lisp/Python-esque. Contribute to aartaka/pretty.c development by creating an account on GitHub.
Avatar
MilkeeyCat 2024-10-24 18:53
@heinrich5991 is that correct anyhow? fn foo_mut<'a>(_: &'a mut &'a String) { // This function signature means take an exclusive reference for the entire rest of it's validity } fn foo<'a>(_: &'a &'a String) {} fn main() { let x = String::new(); let y: &String = &x; foo(&y); foo(&y); // It's passes something like &'smol &'big and &T is covariant so it can downgrade(?) 'big to 'smol, and with that you can call it as many times as you want drop(x); let i = String::new(); let mut j: &String = &i; foo_mut(&mut i); // Reference is eaten and still in use, so it's not possible to use `y` // Something about &mut T being invariant over T but covariant over 'a drop(y); } (edited)
Avatar
today this channel is pretty quiet
Avatar
Avatar
jxsl13
today this channel is pretty quiet
Sry
feelsbadman 1
🍈 1
Avatar
tomorrow is friday
Avatar
GitHub BOT 2024-10-24 20:43

Checklist

  • [X] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test (especially base/) or added coverage to integration test
  • [ ] Considered possible null pointers and out of bounds array indexing
  • [ ] Changed no physics that affect existing maps
  • [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addres...
Avatar
Avatar
heinrich5991
I can see a single f33 map there, search for f33_
Thaaanks 🙂 👍
Avatar
GitHub BOT 2024-10-24 21:21
a93cba1 Use CLayer::IsEntitiesLayer function to avoid duplicate code - Robyt3 f121e1d Merge pull request #9166 from Robyt3/Editor-IsEntitiesLayer-Use - def-
Avatar
GitHub BOT 2024-10-24 22:02
a7a07ad Update Persian language by ArAsH - def- ce8fa3f Merge pull request #9159 from def-/pr-persian - Robyt3
Avatar
Hi! I'm just joining in really quickly to ask a question about a possible new update. It's for the ZIP file asset update, and I don't know if implimenting it will hinder preformance, since it will be dealing with a lot more singular images, instead of one big texture atlas.
Exported 94 message(s)
Timezone: UTC+0