what is the template project you are following? the content of build.rs looks unusual, you typically don't specify the memory.x to the linker, it is indirectly used by the cortex-m-rt crate, and the main linker script is link.x, which is typically specified in .cargo/config.toml, but it's also valid if you use build scripts, just make sure it's -Tlink.x, not -Tmemory.x.
you can check out this template for stm32 based projects: