Skip to content

ICE: Stray dot. #10283

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

Closed
drhodes opened this issue Nov 5, 2013 · 1 comment · Fixed by #10420
Closed

ICE: Stray dot. #10283

drhodes opened this issue Nov 5, 2013 · 1 comment · Fixed by #10420
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@drhodes
Copy link

drhodes commented Nov 5, 2013

I've got two clues, the first is the ICE

fn main() {
    ::.x;
}
RUST_LOG=rustc=1 rustc main.rs
task 'rustc' failed at 'assertion failed: end <= self.len()', /home/derek/dev/rust/src/libstd/vec.rs:980
error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task '<main>' failed at 'explicit failure', /home/derek/dev/rust/src/librustc/lib.rs:397

The second appears to be a parser error

pub mod m {
    pub fn foo(){}
}

fn main() {
    ::m::.foo()
}
$ RUST_LOG=rustc=1 rustc main.rs
main.rs:6:4: 6:9 error: unresolved name `m`.
main.rs:6     ::m::.foo()
              ^~~~~
error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /home/derek/dev/rust/src/libsyntax/diagnostic.rs:101
task '<main>' failed at 'explicit failure', /home/derek/dev/rust/src/librustc/lib.rs:397

Seems to me the parser should catch that and report something like

main.rs:6:4: 6:9 error: expected identifier, but found `.`

$ rustc -v
rustc 0.9-pre (72e432d 2013-11-04 17:22:03 -0800)
host: x86_64-unknown-linux-gnu
$ uname -a
Linux hostname 3.10-1-amd64 #1 SMP Debian 3.10.1-1 (2013-07-16) x86_64 GNU/Linux

@huonw
Copy link
Member

huonw commented Nov 5, 2013

Nice catch; it looks like just :: fails too:

fn main() { ::; }

crashes with the same backtrace.

@bors bors closed this as completed in b0e1318 Nov 17, 2013
blyxyas pushed a commit to blyxyas/rust that referenced this issue Jan 3, 2024
… r=blyxyas

feature: add new lint `pub_underscore_fields`

fixes: rust-lang#10282

This PR introduces a new lint `pub_underscore_fields` that lints when a user has marked a field of a struct as public, but also prefixed it with an underscore (`_`). This is something users should avoid because the two ideas are contradictory. Prefixing a field with an `_` is inferred as the field being unused, but making a field public infers that it will be used.

- \[x] Followed [lint naming conventions][lint_naming]
  - I believe I followed the naming conventions, more than happy to update the naming if I did not :)
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

---

changelog: new lint: [`pub_underscore_fields`]
[rust-lang#10283](rust-lang/rust-clippy#10283)
<!-- changelog_checked -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants