Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Fix issue #120 and bump minor patch version #121

Closed
wants to merge 2 commits into from
Closed

Fix issue #120 and bump minor patch version #121

wants to merge 2 commits into from

Conversation

keringar
Copy link

No description provided.

@dtolnay
Copy link
Contributor

dtolnay commented Apr 26, 2017

Please use the same fix that rustc used. I don't see this change in librustc_errors/emitter.rs.

@keringar
Copy link
Author

keringar commented Apr 27, 2017

I don't know how to test if rustc is fixed. Is there a way to use the internal library for testing? But just looking through the rustc code, it follows the same error path as syntex, ending with a call to panic.

@Dushistov
Copy link

@keringar @dtolnay

Strange part that, if run such code in emacs eshell:


    let session = parse::ParseSess::new();
    let mut parser = parse::new_parser_from_source_str(&session,
                                                       "test code".into(),
                                                       "Boo Boo".into());
    if let Err(mut diagnostic) = parser.parse_crate_mod() {
        diagnostic.emit();
    }

it panics

panicked at 'failed to emit error: operation not supported by the terminal'

But if run rustc in the same eshell:

/tmp $ cat boo.rs 
Boo Boo
/tmp $ rustc boo.rs 
error: expected one of `!` or `::`, found `Boo`
 --> boo.rs:1:5
  |
1 | Boo Boo
  |    -^^^ unexpected token
  |    |
  |    expected one of `!` or `::` here

error: aborting due to previous error

so no panics and all works as expected

@keringar
Copy link
Author

keringar commented May 5, 2017

I found out that rustc catches panics. So I'm going to mark this closed.

@keringar keringar closed this May 5, 2017
@Dushistov
Copy link

@keringar

Are you sure that problem in catch of panic? I replaced term crate used by syntex_errors
with libterm from rustc/src/libterm, and panic disappear.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants