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

Extra umlaut causes error in rustc 1.42.0-nightly #68000

Closed
apexys opened this issue Jan 8, 2020 · 5 comments · Fixed by #68084
Closed

Extra umlaut causes error in rustc 1.42.0-nightly #68000

apexys opened this issue Jan 8, 2020 · 5 comments · Fixed by #68084
Assignees
Labels
A-parser Area: The parsing of Rust source code to an AST A-Unicode Area: Unicode C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@apexys
Copy link

apexys commented Jan 8, 2020

Hi everyone,

I accidentally mistyped on a german keyboard and entered an additional ö-character after a Vec-declaration. This apparently causes an internal compiler error.

I tried this code:

pub struct TestStruct{
    pub test: Vec<int>ö
}

fn main() {
    println!("Hello, world!");
}

and ran cargo build.

I expected to see this happen:

Compiler complains about an extra character at the end of the definition

Instead, this happened:

 > cargo build
   Compiling umlaut v0.1.0 (C:\Users\vbuck\Desktop\umlaut)
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: IllFormedSpan(Span { lo: BytePos(45), hi: BytePos(46), ctxt: #0 })', src\libcore\result.rs:1192:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (859764425 2020-01-07) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: could not compile `umlaut`.

To learn more, run the command again with --verbose.

Meta

rustc --version --verbose:

> rustc --version --verbose
rustc 1.42.0-nightly (859764425 2020-01-07)
binary: rustc
commit-hash: 85976442558bf2d09cec3aa49c9c9ba86fb15c1f
commit-date: 2020-01-07
host: x86_64-pc-windows-msvc
release: 1.42.0-nightly
LLVM version: 9.0

Backtrace:

> $Env:RUST_BACKTRACE=1
PS C:\Users\vbuck\Desktop\umlaut> cargo build --verbose
   Compiling umlaut v0.1.0 (C:\Users\vbuck\Desktop\umlaut)
     Running `rustc --crate-name umlaut --edition=2018 'src\main.rs' --error-format=json --json=diagnostic-rendered-ansi
--crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=d3bb206b8e2e3b83 --out-dir 'C:\Users\vbuck\Desktop\umlaut\target\debug\deps' -C 'incremental=C:\Users\vbuck\Desktop\umlaut\target\debug\incremental' -L 'dependency=C:\Users\vbuck\Desktop\umlaut\target\debug\deps'`
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: IllFormedSpan(Span { lo: BytePos(45), hi: BytePos(46), ctxt: #0 })', src\libcore\result.rs:1192:5
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: <std::io::IoSlice as core::fmt::Debug>::fmt
   3: std::panicking::take_hook
   4: std::panicking::take_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::result::unwrap_failed
  10: rustc_errors::emitter::is_case_difference
  11: rustc_errors::emitter::HumanReadableErrorType::new_emitter
  12: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
  13: <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic
  14: rustc_errors::HandlerInner::emit_diagnostic
  15: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
  16: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_foreign_item
  17: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item
  18: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item
  19: rustc_parse::parser::item::<impl rustc_parse::parser::Parser>::parse_item
  20: rustc_parse::parser::module::<impl rustc_parse::parser::Parser>::parse_crate_mod
  21: rustc_parse::parser::module::<impl rustc_parse::parser::Parser>::parse_crate_mod
  22: rustc_parse::parse_crate_from_file
  23: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::compile
  24: rustc_interface::callbacks::setup_callbacks
  25: rustc_interface::queries::Queries::parse
  26: rustc_driver::pretty::print_after_hir_lowering
  27: <rustc_span::symbol::SymbolStr as core::fmt::Display>::fmt
  28: <rustc_driver::Compilation as core::fmt::Debug>::fmt
  29: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  30: _rust_maybe_catch_panic
  31: rustc_driver::pretty::print_after_hir_lowering
  32: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
  33: std::sys::windows::thread::Thread::new
  34: BaseThreadInitThunk
  35: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.42.0-nightly (859764425 2020-01-07) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `umlaut`.

Caused by:
  process didn't exit successfully: `rustc --crate-name umlaut --edition=2018 'src\main.rs' --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=d3bb206b8e2e3b83 --out-dir 'C:\Users\vbuck\Desktop\umlaut\target\debug\deps' -C 'incremental=C:\Users\vbuck\Desktop\umlaut\target\debug\incremental' -L 'dependency=C:\Users\vbuck\Desktop\umlaut\target\debug\deps'` (exit code: 101)
@apexys
Copy link
Author

apexys commented Jan 8, 2020

@jonas-schievink jonas-schievink added A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 8, 2020
@csmoe

This comment has been minimized.

@KamilaBorowska
Copy link
Contributor

KamilaBorowska commented Jan 8, 2020

This started to happen in Rust 1.28 (this properly errors out in Rust 1.27).

If I write the following:

struct TestStruct{
    test: Vec<i32>zöz
}

It can be noticed the spans are different.

In Rust 1.27.1, I get this:

error: expected `,`, or `}`, found `zöz`
 --> <source>:2:19
  |
2 |     test: Vec<i32>zöz
  |                   ^^^
  |
  = help: struct fields should be separated by commas

Meanwhile in Rust 1.28, I get this:

error: expected `,`, or `}`, found `zöz`
 --> <source>:2:19
  |
2 |     test: Vec<i32>zöz
  |                   ^ help: try adding a comma: `,`

Note that it tries to point out the first character. This may suggest addition of 1 byte instead of 1 character somewhere.

is_case_difference was introduced much later than Rust 1.28, I don't think it's a cause, rather, it encountered an invalid span and exploded, while the actual cause is somewhere else (my guess is

let sp = self.sess.source_map().next_point(self.prev_span);
, but I don't know enough about Rust internals).

@csmoe csmoe added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jan 8, 2020
@estebank estebank added the A-Unicode Area: Unicode label Jan 8, 2020
@estebank
Copy link
Contributor

estebank commented Jan 8, 2020

The bug is in next_point, where we must use find_width_of_character_at_span correctly and somehow we aren't.

@estebank estebank self-assigned this Jan 8, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Jan 9, 2020

triage: P-high, removing I-nominated label.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Jan 9, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jan 10, 2020
Do not ICE on unicode next point

Use `shrink_to_hi` instead of `next_point`.
Fix rust-lang#68000.
Centril added a commit to Centril/rust that referenced this issue Jan 11, 2020
Do not ICE on unicode next point

Use `shrink_to_hi` instead of `next_point` and fix `next_point`.

Fix rust-lang#68000, fix rust-lang#68091, fix rust-lang#68092.
Centril added a commit to Centril/rust that referenced this issue Jan 11, 2020
Do not ICE on unicode next point

Use `shrink_to_hi` instead of `next_point` and fix `next_point`.

Fix rust-lang#68000, fix rust-lang#68091, fix rust-lang#68092.
@bors bors closed this as completed in fcd850f Jan 11, 2020
cuviper pushed a commit to cuviper/rust that referenced this issue Jan 17, 2020
Use `shrink_to_hi` instead of `next_point`
Fix rust-lang#68000.

(cherry picked from commit fcd850f)
Dylan-DPC-zz referenced this issue in Dylan-DPC-zz/rust Mar 21, 2021
…chenkov

Move some tests to more reasonable directories - 5

cc rust-lang#73494

Threshold is 0.95. Next time I promise I will take a look into the special/misclassified directories.

- [issues/issue-23208.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-23208.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/23208)</sup>: associated-types 0.951
- [weird-exprs.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/weird-exprs.rs) <sup>unknown</sup>: destructuring-assignment 0.958
- [issues/issue-1701.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-1701.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/1701)</sup>: structs-enums 0.974
- [issues/issue-48508-aux.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-48508-aux.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/48508)</sup>: numbers-arithmetic 0.991
- [fn_must_use.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/fn_must_use.rs) <sup>unknown</sup>: lint 1.000
- [mir_check_nonconst.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/mir_check_nonconst.rs) <sup>unknown</sup>: consts 1.002
- [issues/issue-52060.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-52060.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/52060)</sup>: consts 1.017
- [issues/issue-45729-unsafe-in-generator.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-45729-unsafe-in-generator.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/45729)</sup>: generator 1.024
- [issues/issue-10392.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10392.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/10392)</sup>: pattern 1.039
- [no-implicit-prelude.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/no-implicit-prelude.rs) <sup>unknown</sup>: resolve 1.071
- [issues/issue-68000-unicode-ident-after-missing-comma.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/68000)</sup>: parser 1.079
- [shadow.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/shadow.rs) <sup>unknown</sup>: binding 1.099
- [issues/issue-65611.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-65611.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/65611)</sup>: consts 1.139
- [concat-rpass.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/concat-rpass.rs) <sup>unknown</sup>: macros 1.194
- [issues/issue-31597.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-31597.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/31597)</sup>: associated-types 1.195
- [issues/issue-78372.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-78372.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/78372)</sup>: resolve 1.426
- [impl-trait-in-bindings-issue-73003.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/impl-trait-in-bindings-issue-73003.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/73003)</sup>: impl-trait 1.471
- [impl-trait-in-bindings.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/impl-trait-in-bindings.rs) <sup>unknown</sup>: impl-trait 2.500

r? `@petrochenkov`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 31, 2021
rustdoc: use smaller number of colors to distinguish items

This reduces visual distractions when reading method signatures.

As discussed in rust-lang#59845 (comment), this categorizes items into one of six colors (down from thirteen):

 - method, function (ochre `#AD7C37`)
 - trait, trait alias (dark slate blue `#6E4FC9`)
 - enum, struct, type alias, union, primitive (maroon `#AD378A`)
 - static, module, keyword, associated type, foreign type (steel blue `#3873AD`)
 - macro (green `rust-lang#68000`)
 - generic params, self, Self (unmarked black `#000000`)

I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed").

The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types.

Demo:

https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html
https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html
https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html
https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST A-Unicode Area: Unicode C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants