Skip to content

Conversation

@Veetaha
Copy link
Contributor

@Veetaha Veetaha commented Apr 25, 2020

No description provided.

@Veetaha
Copy link
Contributor Author

Veetaha commented Apr 25, 2020

Force-pushed due to some rustup connection problem on CI:
https://github.com/rust-analyzer/rust-analyzer/actions/runs/87817092

let label = if enabled { Some(label) } else { None };
Profiler { label, detail: None }
if PROFILING_ENABLED.load(Ordering::Relaxed) {
PROFILE_STACK.with(|stack| stack.borrow_mut().push(label));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes semantics, it’ll return non trivial profiler where the old code would use None label

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by non-trivial profiler, it is just a newtype of Option<Impl>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing from my iPad, so might be wrong, but it still seems to me that the refactoring changes behavior. && was meaningful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I mistakenly thought that the boolean value returned from push is unused, already fixed it.
Regarding the non-trivilaity, the rustc is smart enough not to increase the size of the profiler and use the inner string reference non-nullability to store the discriminant.

@Veetaha
Copy link
Contributor Author

Veetaha commented Apr 28, 2020

@matklad, this one is easy, do we merge it?

@matklad
Copy link
Contributor

matklad commented Apr 28, 2020

bors r+

@lnicola
Copy link
Member

lnicola commented Apr 28, 2020

Might need a rebase.

@bors
Copy link
Contributor

bors bot commented Apr 28, 2020

@bors bors bot merged commit 9230ae5 into rust-lang:master Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants