Skip to content

ICE on if let inside a macro #3462

New issue

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

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

Already on GitHub? # to your account

Closed
snejugal opened this issue Nov 27, 2018 · 1 comment
Closed

ICE on if let inside a macro #3462

snejugal opened this issue Nov 27, 2018 · 1 comment
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@snejugal
Copy link

This code causes Clippy to panic:

enum Foo {
    Bar,
    Baz,
}

fn bar(foo: Foo) {
    macro_rules! baz {
        () => {
            if let Foo::Bar = foo {}
        };
    }

    baz!();
    baz!();
}

Here is the output of cargo +nightly clippy:

    Checking foo v0.1.0 (C:\foo)
...
thread 'main' panicked at 'begin <= end (33 <= 30) when slicing `            if
`', src\libcore\str\mod.rs:2096:5
note: Run with `RUST_BACKTRACE=1` for 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.32.0-nightly (6bfb46e4a 2018-11-26) running on x86_64-pc-windows-msvc

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

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

error: Could not compile `foo`.

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

I have clippy 0.0.212 (754b4c07 2018-11-23), but the bug is reproducible on clippy 0.0.212 (125907ad 2018-09-17) as well.

@flip1995 flip1995 added the I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 27, 2018
@phansch phansch self-assigned this Dec 2, 2018
@KamilaBorowska
Copy link
Contributor

This doesn't crash anymore, I think it was fixed?

@flip1995 flip1995 closed this as completed Jan 3, 2019
@phansch phansch removed their assignment Jan 3, 2019
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 3, 2019
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 3, 2019
bors added a commit that referenced this issue Jan 3, 2019
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue May 5, 2020
Changes:
````
Revert "tests: used_underscore_binding_macro: disable random_state lint."
Revert "Auto merge of rust-lang#3603 - xfix:random-state-lint, r=phansch"
rustup rust-lang/rust#56837
rustup (don't know the exact PR unfortunately)
Add itertools to integration tests
tests: used_underscore_binding_macro: disable random_state lint.
Trigger `use_self` lint in local macros
Add run-rustfix where it already passes
rustup: rust-lang/rust#55517
Make clippy work with parallel rustc
Add ui/for_kv_map test for false positive in rust-lang#1279
Update to latest compiletest-rs release
add testcase for rust-lang#3462
deps: bump rustc_tools_util version from 0.1.0 to 0.1.1 just in case...
Use compiletest's aux-build header instead of include macro
rustc_tool_utils: fix failure to create proper non-repo version string when used in crates on crates.io, bump version
rustfmt
UI test cleanup: Extract ifs_same_cond tests
Extract IteratorFalsePositives into option_helpers.rs
UI test cleanup: Extract for_kv_map lint tests
UI test cleanup: Extract lint from methods.rs test
Fix test for rust-lang/rust#57250
Limit infinite_iter collect() check to known types
Some improvements to util documentation
Use hashset for name blacklist
Reformat random_state tests
Use node_id_to_type_opt instead of node_it_to_type in random_state
Check pattern equality while checking declaration equality
random_state lint
Move constant write checks to temporary_assignment lint
Use an FxHashSet for valid idents in documentation lint
Fix suggestion for unnecessary_ref lint
Update CONTRIBUTING.md for rustfix tests
Update .fixed files via update-references.sh
Run rustfix on first UI test
Use WIP branch for compiletest_rs
````
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants