Skip to content
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

Add error codes for libsyntax_ext #48173

Merged
merged 3 commits into from
Apr 15, 2018

Conversation

GuillaumeGomez
Copy link
Member

I intend to add error codes for libsyntax_ext as well. However, they cannot be used at stage 0 directly so I thought it might be possible to enable them at the stage 1 only so we can have access to the macros. However, the error code registration seems to not work this way. Currently I get the following error:

error: used diagnostic code E0660 not registered
  --> libsyntax_ext/asm.rs:93:25
   |
93 |                         span_err!(cx, sp, E0660, "malformed inline assembly");
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: used diagnostic code E0661 not registered
   --> libsyntax_ext/asm.rs:151:33
    |
151 | /                                 span_err!(cx, sp, E0661,
152 | |                                           "output operand constraint lacks '=' or '+'");
    | |________________________________________________________________________________________^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to 2 previous errors

error: Could not compile `syntax_ext`.

If anyone has an idea, I'd gladly take it. I'm trying to figure this out on my side as well. I also opened this PR to know if it was worth it to continue (maybe we don't want this?).

Anyway, any answer for both questions is very welcome!

cc @rust-lang/compiler

@pietroalbini pietroalbini added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 12, 2018
@pietroalbini
Copy link
Member

@rust-lang/compiler, can we get someone to answer @GuillaumeGomez questions?

@pietroalbini pietroalbini added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 19, 2018
@nikomatsakis
Copy link
Contributor

I have no idea what the problem is :(

@petrochenkov
Copy link
Contributor

I personally have dislike to error codes in general.

@GuillaumeGomez
Copy link
Member Author

That helps. 😆

@nikomatsakis
Copy link
Contributor

@GuillaumeGomez where is your branch? did you opt into the feature gate?

@nikomatsakis
Copy link
Contributor

oh, @eddyb also says that you need to do #[cfg(stage0)] until beta is fixed... so maybe try again when the next beta lands...?

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Feb 22, 2018

see also:

rust/src/librustc/lib.rs

Lines 181 to 183 in b1f8e6f

// Build the diagnostics array at the end so that the metadata includes error use sites.
#[cfg(not(stage0))] // remove after the next snapshot
__build_diagnostic_array! { librustc, DIAGNOSTICS }

@GuillaumeGomez
Copy link
Member Author

I'll wait for next beta then.

@pietroalbini pietroalbini added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Mar 12, 2018
@pietroalbini
Copy link
Member

@GuillaumeGomez I think a new beta was released by now?

@GuillaumeGomez
Copy link
Member Author

Cool, I'll come back to it then.

@pietroalbini pietroalbini added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Mar 20, 2018
@GuillaumeGomez GuillaumeGomez changed the title [WIP] Add error codes for libsyntax_ext Add error codes for libsyntax_ext Mar 26, 2018
@GuillaumeGomez
Copy link
Member Author

Updated.

@pietroalbini pietroalbini added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 26, 2018
@GuillaumeGomez
Copy link
Member Author

Ah, right, the tests I added can only work on stage 2 compiler... Is there a way to make these two tests to be run only on stage 2?

@shepmaster
Copy link
Member

This never got a reviewer...

r? @eddyb

@eddyb
Copy link
Member

eddyb commented Apr 10, 2018

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Apr 10, 2018
@nikomatsakis
Copy link
Contributor

Travis is unhappy, to start:

https://travis-ci.org/rust-lang/rust/builds/358583412#L1748

@GuillaumeGomez
Copy link
Member Author

@nikomatsakis: yes because tests can only be run on stage2. Which is why I asked:

Ah, right, the tests I added can only work on stage 2 compiler... Is there a way to make these two tests to be run only on stage 2?

@eddyb
Copy link
Member

eddyb commented Apr 10, 2018

@GuillaumeGomez I think it's // ignore-stage1 (if you search around, there should be examples).

@GuillaumeGomez
Copy link
Member Author

Thanks @eddyb!

// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
register_long_diagnostics! {
E0660: r##"
An invalid syntax was passed to the `asm` macro.
Copy link
Contributor

Choose a reason for hiding this comment

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

Grammatical nit: I don't think of "syntax" as something you can have "one" of. I would rather say, "The argument to the asm macro is not well-formed" or something like that, perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fine by me!

@nikomatsakis nikomatsakis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2018
@GuillaumeGomez
Copy link
Member Author

Fixed tests.

@rust-lang rust-lang deleted a comment from rust-highfive Apr 14, 2018
@rust-lang rust-lang deleted a comment from rust-highfive Apr 14, 2018
@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 15, 2018

📌 Commit f367567 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 15, 2018
@bors
Copy link
Contributor

bors commented Apr 15, 2018

⌛ Testing commit f367567 with merge d4d43e2...

bors added a commit that referenced this pull request Apr 15, 2018
…tebank

Add error codes for libsyntax_ext

I intend to add error codes for `libsyntax_ext` as well. However, they cannot be used at stage 0 directly so I thought it might be possible to enable them at the stage 1 only so we can have access to the macros. However, the error code registration seems to not work this way. Currently I get the following error:

```
error: used diagnostic code E0660 not registered
  --> libsyntax_ext/asm.rs:93:25
   |
93 |                         span_err!(cx, sp, E0660, "malformed inline assembly");
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: used diagnostic code E0661 not registered
   --> libsyntax_ext/asm.rs:151:33
    |
151 | /                                 span_err!(cx, sp, E0661,
152 | |                                           "output operand constraint lacks '=' or '+'");
    | |________________________________________________________________________________________^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to 2 previous errors

error: Could not compile `syntax_ext`.
```

If anyone has an idea, I'd gladly take it. I'm trying to figure this out on my side as well. I also opened this PR to know if it was worth it to continue (maybe we don't want this?).

Anyway, any answer for both questions is very welcome!

cc @rust-lang/compiler
@bors
Copy link
Contributor

bors commented Apr 15, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: estebank
Pushing d4d43e2 to master...

@bors bors merged commit f367567 into rust-lang:master Apr 15, 2018
@GuillaumeGomez GuillaumeGomez deleted the error-codes-libsyntax_ext branch April 15, 2018 11:05
@RalfJung
Copy link
Member

RalfJung commented Aug 15, 2018

However, they cannot be used at stage 0 directly

Care to explain why? Was this just a problem with the old bootstrap compiler?

This stage-0-conditional is still present in current master, and causing confusion like #53380

@GuillaumeGomez
Copy link
Member Author

We need some macros (which are defined later on) to be defined.

@RalfJung
Copy link
Member

RalfJung commented Aug 15, 2018

But why are those not in the beta bootstrap compiler?

I do not understand how what you said relates to my question. :)

@GuillaumeGomez
Copy link
Member Author

Hard to explain since I don't have the precise context in mind. Just gave you what I had in memory. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

9 participants