Stream: project-error-handling

Topic: backtrace stabilization


view this post on Zulip Jane Lusby (Nov 27 2020 at 20:56):

@Ashley Mannix am I correct in assuming that we need to resolve the merge conflicts in https://github.com/rust-lang/rust/pull/72981 before we can actually merge the RFC, regardless of the recent comment by RFC bot?

view this post on Zulip Jane Lusby (Jan 19 2021 at 19:36):

more on this @Ashley Mannix

view this post on Zulip Jane Lusby (Jan 19 2021 at 19:36):

one thing im worried about is that I haven't actually taken the time yet to finish my proof of concept for backtrace in core

view this post on Zulip Jane Lusby (Jan 19 2021 at 19:36):

and i want to make sure backtrace doesn't stabilize before that is finished

view this post on Zulip Jane Lusby (Jan 19 2021 at 19:36):

that should be a blocker probably

view this post on Zulip Jane Lusby (Jan 19 2021 at 19:36):

actually we should probably add that to the list on the tracking issue

view this post on Zulip Ashley Mannix (Jan 19 2021 at 23:47):

@Jane Lusby That’s fair. I think @Amanieu was also hoping for a more complete implementation before merging. I’ll note that as a blocker. Would you like a hand with anything on the PoC?

view this post on Zulip Jane Lusby (Jan 19 2021 at 23:48):

the main issue right now is figuring out how to setup the hooks between core and std

view this post on Zulip Jane Lusby (Jan 19 2021 at 23:48):

so any guidance on that would be the most helpful

view this post on Zulip Jane Lusby (Jan 19 2021 at 23:49):

my impression is that the type of hooks that we want currently don't have any prior art

view this post on Zulip Jane Lusby (Jan 19 2021 at 23:49):

and we'd need to add some new support in the compiler

view this post on Zulip Ashley Mannix (Jan 19 2021 at 23:51):

Ah ok. Have we run our ideas for how the backtrace hooks should work by @T-compiler already? I’m not really familiar with how we do hooks yet but somebody from there might have a good idea?

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:00):

no, that could be the best next step

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:02):

looking at the compiler team calendar rn https://calendar.google.com/calendar/u/0/embed?src=6u5rrtce6lrtv07pfi3damgjus@group.calendar.google.com

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:02):

maybe I should just attend their next triage meeting?

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:03):

oh no

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:03):

looks like steering meeting is what I want

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:03):

which isn't for another week

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:03):

ill just open an thread in their zulip channel

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:10):

I went ahead and created a thread in the compilers stream

view this post on Zulip Jane Lusby (Jan 20 2021 at 00:10):

https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/backtrace.20hooks.20in.20core

view this post on Zulip Jane Lusby (Jan 20 2021 at 01:03):

looks like we can probably move forward with just adding lang_items like eh_personality and prove that that works

view this post on Zulip Jane Lusby (Jan 20 2021 at 01:04):

then we can talk through further design concerns I've had around no_std and see if further prototyping is necessary

view this post on Zulip Jane Lusby (Jan 20 2021 at 01:04):

but I think I've got enough for @oliver and I to move forward

view this post on Zulip Ashley Mannix (Jan 20 2021 at 04:56):

Sounds good!

view this post on Zulip Jane Lusby (Feb 02 2021 at 19:33):

@Ashley Mannix do you know off of the top of your head any examples of methods on core types in std?

view this post on Zulip Jane Lusby (Feb 02 2021 at 19:33):

working on the core backtrace impl again and I don't know how to break the rules

view this post on Zulip simulacrum (Feb 02 2021 at 19:35):

not in std, but we probably have things like impl ToOwned for str in liballoc I'd guess

view this post on Zulip simulacrum (Feb 02 2021 at 19:35):

my guess is you're going to need to define a lang item

view this post on Zulip Jane Lusby (Feb 02 2021 at 19:36):

#[lang = "str_alloc"]
#[cfg(not(test))]
impl str {

view this post on Zulip Jane Lusby (Feb 02 2021 at 19:36):

that tracks

view this post on Zulip Jane Lusby (Feb 02 2021 at 19:43):

@nikomatsakis can you confirm for me that its okay for us to use a lang item for backtrace?

view this post on Zulip Jane Lusby (Feb 02 2021 at 19:43):

eddyb is a bit worried about using it on something other than a builtin type

view this post on Zulip scottmcm (Feb 02 2021 at 19:54):

Jane Lusby said:

do you know off of the top of your head any examples of methods on core types in std?

sort on slices has historically been a weird one.

view this post on Zulip nikomatsakis (Feb 04 2021 at 15:38):

@Jane Lusby can you say a bit more about what you'd be using the lang item for?

view this post on Zulip nikomatsakis (Feb 04 2021 at 15:39):

should I just read this topic?

view this post on Zulip Jane Lusby (Feb 04 2021 at 15:40):

Oh I have a quick summary I can link

view this post on Zulip Jane Lusby (Feb 04 2021 at 15:40):

One second

view this post on Zulip Jane Lusby (Feb 04 2021 at 15:41):

https://github.com/rust-lang/rust/pull/77384#issuecomment-772835929

view this post on Zulip Jane Lusby (Feb 04 2021 at 15:41):

So there are two lang items I'm eyeing now

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:17):

digging into this more im not sure I know what I'm talking about again, lol

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:18):

the global alloc stuff isn't done with lang items

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:19):

    pub fn postprocess(&mut self, krate: &ast::Crate) {
        self.inject_profiler_runtime(krate);
        self.inject_allocator_crate(krate);
        self.inject_panic_runtime(krate);

        info!("{:?}", CrateDump(&self.cstore));

        self.report_unused_deps(krate);
    }

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:19):

cool function

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:34):

_really wishing topics could exist in multiple streams_

view this post on Zulip Charles Ellis O'Riley Jr. (Feb 04 2021 at 18:34):

What would you pass to this function and what does it do? If I had to guess your passing a crate to it.

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:36):

not sure exactly because I'm just trying to figure this out myself, but this is a method on CrateLoader

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:36):

which is a piece of the compiler

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:37):

so in this case the crate being passed in is presumably the crate being compiled

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:39):

apparently the global allocator stuff is broken for dylibs

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:39):

eddyb is telling me that if we based the backtrace stuff on global alloc we'd probably end up with backtraces that dont work in rustc

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:39):

which seems bad

view this post on Zulip Jane Lusby (Feb 04 2021 at 18:39):

:grimacing:

view this post on Zulip Charles Ellis O'Riley Jr. (Feb 04 2021 at 18:39):

I see

view this post on Zulip Jane Lusby (Feb 04 2021 at 20:48):

pausing on this for the day soon but made some good progress

view this post on Zulip Jane Lusby (Feb 04 2021 at 20:49):

using the #[linkage] feature rn which I think might not be supported on all platforms

view this post on Zulip Jane Lusby (Feb 04 2021 at 20:49):

so i know that might need to be changed later

view this post on Zulip Jane Lusby (Feb 04 2021 at 20:49):

but hopefully this will let me do the lib side of the backtrace move

view this post on Zulip Jane Lusby (Feb 04 2021 at 20:49):

and then I can do the compiler side of making it all work after

view this post on Zulip Jane Lusby (Feb 04 2021 at 21:53):

my current understanding is I wont be able to use a lang_item for the backtrace impl

view this post on Zulip Jane Lusby (Feb 04 2021 at 21:54):

and will probably have to change the compiler to inject an extra dep if the backtrace hook symbols are never defined

view this post on Zulip Jane Lusby (Feb 04 2021 at 21:54):

but for right now the linkage will hopefully let me work on the stuff I already understand while I figure out the compiler changes necessary

view this post on Zulip Josh Triplett (Mar 06 2021 at 18:09):

@Jane Lusby Is this complex enough that it might be worth considering just finishing build-std support instead?

view this post on Zulip Josh Triplett (Mar 06 2021 at 18:10):

(That isn't meant as a leading question; it's a genuine one.)

view this post on Zulip Jane Lusby (Mar 06 2021 at 18:12):

I don't think so but then I haven't had a ton of time to work on the backtrace move recently so there may be a lot more issues to resolve before I'm done

view this post on Zulip Jane Lusby (Mar 06 2021 at 18:12):

How much work would finishing build std support entail @Josh Triplett ?

view this post on Zulip Josh Triplett (Mar 06 2021 at 18:16):

My understanding is that the primary remaining issue there is "how do we let rustc 1.x.y build std 1.x.y that uses nightly-only features without allowing version skew".

view this post on Zulip Josh Triplett (Mar 06 2021 at 18:16):

We'd need the source-equivalent of the sysroot, as the simplest thing.

view this post on Zulip Josh Triplett (Mar 06 2021 at 18:17):

That plus a little more cargo work to integrate it would address the feature itself. Then we could start using feature flags in std, with care.

view this post on Zulip Josh Triplett (Mar 06 2021 at 18:22):

That may or may not be easier than sorting out the issues you're running into.

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:06):

What do you mean by version skew?

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:14):

build-std shouldn't allow building a a version of std other than the version that precisely matches the version of rustc.

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:15):

If you have a specific nightly rustc, build-std should build that specific nightly's std.

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:15):

So it should come from the Rust distribution (rustup or distro), via something like the sysroot.

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:15):

Aah

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:16):

What would be the follow up once we have build std setup

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:16):

My understanding was that we then merge core and std

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:17):

But that seems like a lot more work

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:17):

That can happen over time; it doesn't have to happen immediately.

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:17):

We can start adding features controlled by feature flags as soon as build-std works reliably.

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:18):

Yea, I'm just wondering what feature flags we'd add here to help

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:18):

Can we even feature flag part of a trait?

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:18):

As in to disable the backtrace fn

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:19):

Disable or stub out.

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:19):

Or is there some simple solution I'm forgetting here

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:19):

I've been assuming that for compatibility the backtrace function should exist and return an empty backtrace.

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:19):

Yea

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:19):

So then we would be future flagging alloc support inside of core?

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:19):

So basically things would start moving from std into core and that's where we add the feature flags

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:20):

Yeah. My assumption has been that we would slowly merge std and alloc into core (not the other way around), under feature flags, and re-export them from std and alloc.

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:20):

And then core would be the new std essentially

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:20):

Gotcha

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:20):

I don't know much about how sysroots work, so I'll have to do some research

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:20):

(naming bikesheds aside, because we might ultimately rename core to std when done)

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:21):

We could open another topic (probably not under project-error-handling) and I could help with what I know about sysroots and the general plan here, if that'd help?

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:21):

But I can start working on that if you think it would be the more fruitful approach

view this post on Zulip Jane Lusby (Mar 06 2021 at 19:21):

Sure

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:21):

So, I do not want to make the perfect the enemy of the good here. If you have a concrete idea for how to fix the backtrace issue without having to do this, and it seems doable, please by all means go for it.

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:22):

If, and only if, the backtrace issue seems stuck or painful (which it sounded above like it might be, given your mention of #[linkage] and platform-specifics), then this might be a fruitful path, and it'd be wildly helpful for many other purposes too.

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:38):

https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/build-std.2C.20sysroots.2C.20and.20backtrace

view this post on Zulip Josh Triplett (Mar 06 2021 at 19:38):

Hope that helps.

view this post on Zulip Edmund Cape (Mar 11 2021 at 18:56):

Hello Jane et al, Is there a google meet link for the meeting at 2PM (5 min from now)?

view this post on Zulip Edmund Cape (Mar 11 2021 at 19:07):

... reading the posts from last week. It looks like we are moving to every other week. Until then, then :))

view this post on Zulip Jane Lusby (Mar 11 2021 at 20:14):

:+1:

view this post on Zulip oliver (Mar 11 2021 at 21:46):

do you have access to the libs calendar @Edmund Cape ?


Last updated: Jan 29 2022 at 11:01 UTC