Stream: project-error-handling

Topic: Meeting 2020-12-21


view this post on Zulip Jane Lusby (Dec 21 2020 at 18:59):

meeting in 1 minute

view this post on Zulip Jane Lusby (Dec 21 2020 at 18:59):

holiday week so not a big deal if anyone isn't here

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:00):

and here is our current meeting agenda https://hackmd.io/@rust-libs/BJiildC2v

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:00):

let's start by seeing who is here

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:01):

I'm here

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:02):

hey charles :D

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:02):

:tada:

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:02):

Merry Xmas

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:02):

hehe, tyty

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:02):

you too

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:03):

welp, seems like other people might be enjoying their holidays as they should, so lets make this a quick one and I'll hang out incase anyone shows up

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:03):

hows the assert change going @Charles Ellis O'Riley Jr. ?

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:06):

Well, learning alot. The major thing that I learned is I'm going to need to ask more questions. My modus operandi is to try to figure something out on my own. With this, that is not going to work. Where I thought I needed to make a change, it wasn't the place. My direct question to the group will be...where do I need to make the change.

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:07):

Without looking into the issue in more detail I'm unsure, but I can help you figure out what to do next

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:07):

can you remind me what you tried before and where you are right now?

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:07):

like, what are you stuck on

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:07):

One momnent

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:12):

https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs This is where I thought I needed to make a change so I did some research on the AST. I asked a question one day to confirm that was the spot and received an answer that it wasn't. I think I need to know how to figure this out.....because I don't.

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:15):

do you have a link to where you asked for confirmation?

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:15):

Looking for it now

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:16):

Look under Nicer Assert Messages...toward the end

view this post on Zulip oliver (Dec 21 2020 at 19:17):

Hello, I think nothing has progressed from me this week :octopus:

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:18):

Hi oliver. Seasons greetings

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:18):

oliver said:

Hello, I think nothing has progressed from me this week :octopus:

no worries

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:18):

im in the same boat

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:19):

Charles Ellis O'Riley Jr. said:

https://github.com/rust-lang/rust/blob/master/compiler/rustc_builtin_macros/src/assert.rs This is where I thought I needed to make a change so I did some research on the AST. I asked a question one day to confirm that was the spot and received an answer that it wasn't. I think I need to know how to figure this out.....because I don't.

looking at the thread and @Camelid's response I'm guessing that you did find the correct place more or less

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:22):

ok. My question then is exactly how do I trace the code? I've been running x.py but @Camelid suggested something entirely different and I was unsure of how to run it in the system.

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:22):

what did they recommend?

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:22):

the direct rustc call?

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:23):

afaik they still meant for you to use x.py to compile the rustc binary that you use when expanding examples to test the code gen

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:25):

so my understanding of this change is that in that expand_assert fn you need to change how it creates the panic_call variable

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:25):

does that mean that I need to run rustc +nightly -Z unpretty=expanded ?

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:25):

yea

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:25):

but you're going to twant to use whatever version you compiled

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:26):

I don't understand and don't want to pretend I do.

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:26):

https://rust-lang.github.io/rustup/concepts/toolchains.html#custom-toolchains

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:26):

its okay I will help explain

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:26):

this should show how to configure a project to use a custom compiled rustc

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:26):

so you'll go and create a project anywhere you want, just a cargo new, in a temp dir for example

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:27):

and that's where you put your test assert that you want to have expand into something nicer

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:27):

then you configure that project to use your custom toolchain via rustup

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:27):

then you can go to the rustc repo and edit the compiler then recompile, and the project you made should always use your current version of the compiler

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:28):

there are probably nicer ways to do this via rustc test infrastructure but I'm not familiar enough with it to know where to find that info

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:28):

_I should really read the rustc dev guide someday_

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:29):

I should also do more reading but when I do, especially with this, I have more questions.

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:31):

sounds good

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:31):

please dont hesitate to ask questions

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:31):

@Charles Ellis O'Riley Jr. and @oliver

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:31):

one thing I want to mention tho I'll probably bring it up again next meeting when we have more people

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:32):

I'm planning on getting all the people who have been contributing consistently added to the list of members for the project group

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:32):

Trust me. 2021 will bring about many more questions...sometimes redundant. Thanks Jane, I'm going to look again at what you proposed and also read that doc.

view this post on Zulip Jane Lusby (Dec 21 2020 at 19:33):

also I think im going to leave the meeting agenda as is and not commit this agenda to the repo since it was such a short meeting

view this post on Zulip oliver (Dec 21 2020 at 19:34):

sounds great and the next meeting will be Jan 4th

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 19:34):

Agree. Mary Christmas to you Jane and party hardy in a safe way :)

view this post on Zulip Noah Lev (Dec 21 2020 at 21:04):

@Charles Ellis O'Riley Jr. In terms of creating a custom toolchain (so you can do rustc +stage1 ... where stage1 is a local build), all it is is this:

# cd into your clone of the repo
$ cd rust
# Make sure you have built the compiler
$ ./x.py build
# Link the toolchain
$ rustup toolchain link stage1 build/<your-target-triple>/stage1

<your-target-triple> is whatever the 'host' line of rustc -Vv shows:

rustc 1.48.0 (7eac88abb 2020-11-16)
binary: rustc
commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4
commit-date: 2020-11-16
host: x86_64-apple-darwin          <--- this is it
release: 1.48.0
LLVM version: 11.0

The rustc-dev-guide has lots of information about this and more; I recommend reading https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#creating-a-rustup-toolchain.

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:11):

@Camelid Thanks.. Is this something I should be doing in addition to rustic +nightly -Z I pretty=expand arc/main.rs which is what I am doing now?

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:17):

I already have my toolchain. Nightly & stable. I've done all the steps you just outlined. I need to understandhow and where to insert a change. I'm trying to find where assert! is constructed.

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:17):

Charles Ellis O'Riley Jr. said:

I already have my toolchain. Nightly & stable. I've done all the steps you just outlined. I need to understandhow and where to insert a change. I'm trying to find where assert! is constructed.

nightly and stable don't have your changes though

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:17):

the steps Camelid gave were to get a toolchain with your changes

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:18):

if you're just gathering info for now then you don't need to worry about it, but eventually you'll need to test your changes with stage 1

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:19):

I see. Thanks. BTW, is assert constructed somewhere and if so, where?

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:20):

I think assert.rs is the right place

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:23):

That's where I got confused because according to @Camelid, I needed to run rustic +nightly -Z I pretty=expand ? Perhaps I should just read the doc. I'm currently running rustic +nightly -Z I pretty=expand

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:24):

Charles Ellis O'Riley Jr. said:

That's where I got confused because according to @Camelid, I needed to run rustic +nightly -Z I pretty=expand ? Perhaps I should just read the doc. I'm currently running rustic +nightly -Z I pretty=expand

that shows you what the macro expands to

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:24):

not where in the compiler it was expanded

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:26):

so, I'll have to make a change within assert.rc which is written in that AST language?

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:28):

assert.rs is generating that AST language

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:28):

it's mostly the same as a normal proc-macro works

view this post on Zulip Joshua Nelson (Dec 21 2020 at 21:28):

but in the compiler itself

view this post on Zulip Noah Lev (Dec 21 2020 at 21:32):

assert! is expanded in compiler/rustc_builtin_macros/.../assert.rs (I forget the exact path). 'Expanding' just means that an AST node representing an invocation of assert! is turned into a different AST node.

view this post on Zulip Noah Lev (Dec 21 2020 at 21:33):

rustc +nightly -Z unpretty=expand will show you a pretty-printed version of the AST node that assert! was replaced with.

view this post on Zulip Noah Lev (Dec 21 2020 at 21:34):

This chapter in the rustc dev guide may be helpful: https://rustc-dev-guide.rust-lang.org/macro-expansion.html

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:35):

So my change will go into the AST node representing an invocation ofg assert?

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:35):

@Camelid Thanks.

view this post on Zulip Noah Lev (Dec 21 2020 at 21:43):

I don't know what your change is, so I can't help you with that.

view this post on Zulip Charles Ellis O'Riley Jr. (Dec 21 2020 at 21:44):

Add assert_eq functionality to assert


Last updated: Jan 26 2022 at 14:20 UTC