New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#56411 do not suggest a fix for a import conflict in a macro #56937

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
7 participants
@mockersf
Copy link
Contributor

mockersf commented Dec 18, 2018

as a first fix, remove the suggestion when the conflict happens in a macro as it will be useless

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Dec 18, 2018

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Dec 18, 2018

@estebank
Copy link
Contributor

estebank left a comment

One nitpick, otherwise fine by me.


struct T {}

fn main() {}

This comment has been minimized.

@estebank

estebank Dec 18, 2018

Contributor

These files usually go in an auxiliary directory. I'm ok with this if @petrochenkov is too.

This comment has been minimized.

@mockersf

mockersf Dec 18, 2018

Contributor

yes, but // aux-build: would allow to build it as an extern crate, not to use it as a module. And the auxiliary folder doesn't contain a mod.rs file, so you can't import a module from it...

This comment has been minimized.

@petrochenkov

petrochenkov Dec 19, 2018

Contributor

Could you rename the file into something less subtle than "same file, but with underscore", e.g. issue_56411_aux.rs?

) = (
cm.span_to_snippet(binding.span),
binding.kind.clone(),
binding.span.is_dummy(),
binding.span.ctxt().outer().expn_info().is_some(),

This comment has been minimized.

@petrochenkov

petrochenkov Dec 19, 2018

Contributor

If you rely on source.span.hi().0 - binding.span.lo().0 being a valid index in binding.span, then you should check at least the next conditions - !source.span.is_dummy() && !binding.span.is_dummy() && !from_macro(source.span) && !from_macro(binding.span).

This comment has been minimized.

@petrochenkov

petrochenkov Dec 20, 2018

Contributor

Actually, directly checking that source.span.hi().0 - binding.span.lo().0 doesn't underflow and results in a valid index into cm would be the most reliable alternative.
This way we certainly don't get an ICE, but also keep the diagnostics for "good" macros.

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Jan 7, 2019

ping from triage @mockersf waiting for your reply on the review comments

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Jan 22, 2019

Ping from triage @mockersf: Some changes have been requested on this PR. Do you think you'll be able to take care of those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment