Skip to content

Conversation

camsteffen
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Sep 6, 2025

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 6, 2025
vec![
(expr.span.until(arg.span), "".to_string()),
(
expr.span.with_lo(expr.span.hi() - BytePos(1)),
Copy link
Member

@fmease fmease Sep 6, 2025

Choose a reason for hiding this comment

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

Does your code crash on this?

fn main() {
    let _: String = Box::new(String::new();
}

I've replaced the final ) (U+0028) with (U+2769). CC #128790.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I didn't want to use the argument span since it could be a parent or child expansion...

Copy link
Member

@fmease fmease Sep 6, 2025

Choose a reason for hiding this comment

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

If you want to keep basing things off of expr.span, consider using one of SourceMap::{start,end,next}_point or similar.

Otherwise, shouldn't you be able to use things like find_ancestor_inside{,_same_ctxt}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I saw your next comment after a refresh. end_point is good!

Otherwise, shouldn't you be able to use things like find_ancestor_inside{,_same_ctxt}?

That would work if the arg is a child expansion, but not if it's a parent. -- Box::new($x)

@camsteffen camsteffen force-pushed the remove-the-box branch 4 times, most recently from dc5423d to be71edc Compare September 6, 2025 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants