Git Product home page Git Product logo

Comments (6)

workingjubilee avatar workingjubilee commented on July 19, 2024 1

doesn't seem to be anything to fix here, currently?

from rust.

joboet avatar joboet commented on July 19, 2024

The message describes the problem: the global allocator must not use thread_local!, as the implementation of the macro needs to allocate on most platforms.

We may in the future decide to allow this by using the system allocator here, but this is fundamentally just the tip of the iceberg: nearly every API in std may allocate – I'd argue that you should not use std at all when implementing your own global allocator.

from rust.

workingjubilee avatar workingjubilee commented on July 19, 2024

Grepping the rust repo returns nothing for that error either,

@MarinPostma You are searching overly specifically. The first part, "fatal runtime error", is an error from rtabort!:

macro_rules! rtabort {
($($t:tt)*) => {
{
rtprintpanic!("fatal runtime error: {}\n", format_args!($($t)*));

The second part is inside the TLS dtor registration, currently:

#[thread_local]
static DTORS: RefCell<Vec<(*mut u8, unsafe extern "C" fn(*mut u8))>> = RefCell::new(Vec::new());
pub unsafe fn register(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
let Ok(mut dtors) = DTORS.try_borrow_mut() else {
// This point can only be reached if the global allocator calls this
// function again.
// FIXME: maybe use the system allocator instead?
rtabort!("the global allocator may not use TLS with destructors");
};

from rust.

MarinPostma avatar MarinPostma commented on July 19, 2024

@workingjubilee that's not the one, notice the absence of "in destructor"

from rust.

ChrisDenton avatar ChrisDenton commented on July 19, 2024

Yes, the error message has been tweaked since then but it's still the same error condition. Here's where it is on the 1.79 branch

match DTORS.try_borrow_mut() {
Ok(mut dtors) => dtors.push((t, dtor)),
Err(_) => rtabort!("global allocator may not use TLS"),
}

from rust.

workingjubilee avatar workingjubilee commented on July 19, 2024

there are actually 5 copies of it on the 1.79 branch.

which is why the refactoring that made there be only one.

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.