On Sat, Oct 19, 2013 at 5:43 PM, Jerry Morrison <jhm...@gmail.com> wrote:

>
> On Sat, Oct 19, 2013 at 2:36 PM, Tim Chevalier <catamorph...@gmail.com>wrote:
>
>> On Sat, Oct 19, 2013 at 2:33 PM, Jerry Morrison <jhm...@gmail.com> wrote:
>> >
>> > So with a suitable library, real-time threads can avoid garbage
>> collection
>> > pauses. Can it enforce linking to this library for all the code it
>> calls, or
>> > else arrange for the standard GC memory allocator to  fail!()  if it
>> > accidentally called?
>>
>> There's no dynamic checking needed; you just need to include the
>> #[deny(managed_heap_memory)] attribute in the crate file. (There's
>> also a way to do the same thing with a command-line flag.) This will
>> result in a compile-time failure if any code might use garbage
>> collection (including code in external libraries that's called by your
>> code).
>>
>> Cheers,
>> Tim
>>
>
> Fantastic. Thanks, Tim!
>
> For a program with some real-time threads plus other code like UI, I
> assume the other code can be in a crate that allows managed_heap_memory.
>
> --
>    Jerry
>

The `managed_heap_memory` lint will prevent using any types containing
managed pointers, but won't strictly prevent calling code using garbage
collection.

In a `#[no_std]` codebase, the compiler will prevent using managed pointers
unless the hooks for them are defined.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to