These are chat archives for rust-lang/rust

Feb 2018
Feb 16 2018 01:23
how come I can't mutably borrow servo?
    pub fn new(win: Arc<GlWindow>, screen_dimensions: (f32, f32)) -> Self {
        let mut servo = Rc::new(Servo::new(UiWindow::new(win, screen_dimensions)));
        // FIXME: unwrap
        let url = ServoUrl::parse("").unwrap();

        let (sender, receiver) = ipc::channel().unwrap();
        let id = receiver.recv().unwrap();
   ==>  servo.borrow_mut().handle_events(vec![
            WindowEvent::NewBrowser(url, sender),
        Self { servo }
apparently servo is immutably borrowed content
Diggory Blake
Feb 16 2018 01:24
Rc does not have a method named borrow_mut
Feb 16 2018 01:25
oh shit Im an idiot
Nicolas Almy
Feb 16 2018 13:35

hi i'm following the instructions on blog_os from phil-opp and i'm trying to run make run. I get this error error[E0658]: use of unstable library feature 'ptr_internals' (see issue #0).
Here is the code I am running:

I use the nightly rust compiler.

Denis Lisov
Feb 16 2018 13:54
@almynic (a) update linked_list_allocator to 0.5; (b) add #![feature(ptr_internals)] to
Nicolas Almy
Feb 16 2018 13:56
ok b) I had already done
Nicolas Almy
Feb 16 2018 14:17
now i get this error error[E0460]: found possibly newer version of crate core which spin depends on.
This is the whole error output:
error[E0460]: found possibly newer version of crate `core` which `spin` depends on
  --> /home/almynic/.cargo/registry/src/
13 | extern crate spin;
   | ^^^^^^^^^^^^^^^^^^
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `core`: /home/almynic/.xargo/lib/rustlib/x86_64-blog_os/lib/libcore-f3a40e6d76548f98.rlib
           crate `spin`: /home/almynic/Desktop/minimal_os/V10/target/x86_64-blog_os/debug/deps/libspin-83532ad3de6447d9.rlib

error: aborting due to previous error

error: Could not compile `linked_list_allocator`.
This is my makefile:
arch ?= x86_64
kernel := build/kernel-$(arch).bin
iso := build/os-$(arch).iso
target ?= $(arch)-blog_os
rust_os := target/$(target)/debug/libblog_os.a

linker_script := src/arch/$(arch)/linker.ld
grub_cfg := src/arch/$(arch)/grub.cfg
assembly_source_files := $(wildcard src/arch/$(arch)/*.asm)
assembly_object_files := $(patsubst src/arch/$(arch)/%.asm, \
    build/arch/$(arch)/%.o, $(assembly_source_files))

.PHONY: all clean run iso kernel

all: $(kernel)

    @rm -r build

run: $(iso)
    @qemu-system-x86_64 -cdrom $(iso)

iso: $(iso)

$(iso): $(kernel) $(grub_cfg)
    @mkdir -p build/isofiles/boot/grub
    @cp $(kernel) build/isofiles/boot/kernel.bin
    @cp $(grub_cfg) build/isofiles/boot/grub
    @grub-mkrescue -o $(iso) build/isofiles 2> /dev/null
    @rm -r build/isofiles

$(kernel): kernel $(rust_os) $(assembly_object_files) $(linker_script)
    @ld -n --gc-sections -T $(linker_script) -o $(kernel) \
        $(assembly_object_files) $(rust_os)

    @RUST_TARGET_PATH=$(shell pwd) xargo build --target $(target)
    #@xargo build --target $(target)
# compile assembly files
build/arch/$(arch)/%.o: src/arch/$(arch)/%.asm
    @mkdir -p $(shell dirname $@)
    @nasm -felf64 $< -o $@
Nicolas Almy
Feb 16 2018 15:04
Can anyone help?
Kelly Thomas Kline
Feb 16 2018 15:17
If you have experience writing code with RxJS, most.js (, et al., how would you most closely adapt that style of program architecture for Rust?
Denis Lisov
Feb 16 2018 19:30
@almynic I'd try removing the build dir and retrying. The bin built correctly for me today.
Nicolas Almy
Feb 16 2018 19:43
ok that somehow worked very strange...
Dylan DPC
Feb 16 2018 20:01
could be because of different rust versions?
Feb 16 2018 22:25
Is there some way to have cyclic dependencies?
Denis Lisov
Feb 16 2018 22:27
@spacekookie Do you mean crate dependencies?
Feb 16 2018 22:28
Denis Lisov
Feb 16 2018 22:29
No, that's not possible. Either have them inside one crate, or change the APIs to get rid of this requirement.