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

ICE with lifetimes in generic default methods #13204

Closed
carllerche opened this issue Mar 30, 2014 · 3 comments · Fixed by #13503
Closed

ICE with lifetimes in generic default methods #13204

carllerche opened this issue Mar 30, 2014 · 3 comments · Fixed by #13503
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@carllerche
Copy link
Member

Not exactly sure what the minimal failing test case is yet.

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'OwnedSlice: index out of bounds', /Users/carllerche/Code/oss/rust/src/libstd/option.rs:245
stack backtrace:
   1:        0x10c904d44 - rt::backtrace::imp::write::h561905b05278d6a1p8b::v0.10.pre
   2:        0x10c868f96 - rt::unwind::begin_unwind_inner::hda870342e18ba7c6TIb::v0.10.pre
   3:        0x1099f79a8 - rt::unwind::begin_unwind::h2e9e620644e625a9Ufr::v0.10.pre
   4:        0x109ba197c - middle::subst::ty..Region.Subst::subst_spanned::hafbe75f2b264bc4cB1R::v0.10.pre
   5:        0x109ba1cbc - middle::ty_fold::super_fold_sty::hfc1e43770e7f0d16lyR::v0.10.pre
   6:        0x109ba1293 - middle::subst::SubstFolder$LT$$x27a$GT$.TypeFolder::fold_ty::he9aa66e8dd4bec304LR::v0.10.pre
   7:        0x109b6a5c5 - middle::subst::ty..t.Subst::subst_spanned::hfef2031e6fd85109gKR::v0.10.pre
   8:        0x109a63783 - middle::subst::ty..substs.Subst::subst_spanned::hef6840c283de9d3cGWR::v0.10.pre
   9:        0x109b80045 - middle::subst::_$SP$T.Subst::subst_spanned::he352143217d87cf9HUR::v0.10.pre
  10:        0x109ba2bac - middle::subst::Vec$LT$T$GT$.Subst::subst_spanned::h7a9857957be41586vSR::v0.10.pre
  11:        0x109ba2e99 - middle::subst::ty..TypeParameterDef.Subst::subst_spanned::h876498d43b710aacEZR::v0.10.pre
  12:        0x109ba36b9 - middle::subst::Rc$LT$T$GT$.Subst::subst_spanned::h4e952c126f698753hTR::v0.10.pre
  13:        0x109ba3097 - middle::subst::ty..Generics.Subst::subst_spanned::h3db8a831718b4dfau0R::v0.10.pre
  14:        0x109d9542c - middle::typeck::coherence::CoherenceChecker$LT$$x27a$GT$::check_implementation::h8cf669eddb04046f4Zr::v0.10.pre
  15:        0x109d94029 - middle::typeck::coherence::CoherenceCheckVisitor$LT$$x27a$GT$.visit..Visitor$LT$$LP$$RP$$GT$::visit_item::h8b083113a4441edecWr::v0.10.pre
  16:        0x109d94901 - middle::typeck::coherence::CoherenceCheckVisitor$LT$$x27a$GT$.visit..Visitor$LT$$LP$$RP$$GT$::visit_item::h8b083113a4441edecWr::v0.10.pre
  17:        0x109da0211 - middle::typeck::coherence::check_coherence::hce2bf3bb6cab6432uKs::v0.10.pre
  18:        0x109db2a8f - util::common::time::hbc09d756ba2aa4cbwIh::v0.10.pre
  19:        0x109db18b1 - middle::typeck::check_crate::hf9819e1c3379e4f5YTu::v0.10.pre
  20:        0x10a1c2135 - driver::driver::phase_3_run_analysis_passes::h7847587d3ac359526xf::v0.10.pre
  21:        0x10a1c8423 - driver::driver::compile_input::hb54a51743aeaaa393Wf::v0.10.pre
  22:        0x10a1ee0e4 - run_compiler::h1e92e1871c644e1dxAn::v0.10.pre
  23:        0x10a201d8d - main_args::closure.92068
  24:        0x10a2005a2 - monitor::closure.91953
  25:        0x10a1fc14b - task::TaskBuilder::try::closure.91728
  26:        0x10c7ed49c - task::spawn_opts::closure.7957
  27:        0x10c900168 - rt::task::Task::run::closure.41637
  28:        0x10c90ab5c - rust_try
  29:        0x10c8fffe7 - rt::task::Task::run::h71f777d9db75993fWB9::v0.10.pre
  30:        0x10c7ed31f - task::spawn_opts::closure.7929
  31:        0x10c903726 - rt::thread::thread_start::h64defda557fd4656Dga::v0.10.pre
  32:     0x7fff8f23b772 - _pthread_start
$rustc --version
rustc 0.10-pre (d79fbba 2014-03-29 18:56:36 -0700)
host: x86_64-apple-darwin
@huonw huonw added the I-ICE label Mar 30, 2014
@carllerche
Copy link
Member Author

I think that I was running an out of date rustc. I don't think that this is a problem on master.

@carllerche
Copy link
Member Author

Actually, I hit this on rustc that I just built from master.

@carllerche carllerche reopened this Mar 30, 2014
@huonw
Copy link
Member

huonw commented Mar 30, 2014

I talked to @carllerche and he gave me access to his codebase, which I used to narrow down:

pub trait Foo {
  fn bar<'a, I: Iterator<&'a ()>>(&mut self, _: I) {}
}

pub struct Baz;

impl Foo for Baz {}

fn main() {}

Converting bar to a normal trait method and implementing it for Baz stops the ICE.

cc @pnkfelix

@huonw huonw changed the title task 'rustc' failed at 'OwnedSlice: index out of bounds', /Users/carllerche/Code/oss/rust/src/libstd/option.rs:245 ICE with lifetimes in generic default methods Mar 30, 2014
edwardw added a commit to edwardw/rust that referenced this issue Apr 16, 2014
When instantiating trait default methods for certain implementation,
`typeck` correctly combined type parameters from trait bound with those
from method bound, but didn't do so for lifetime parameters. Applies
the same logic to lifetime parameters.

Closes rust-lang#13204
bors added a commit that referenced this issue Apr 17, 2014
When instantiating trait default methods for certain implementation,
`typeck` correctly combined type parameters from trait bound with those
from method bound, but didn't do so for lifetime parameters. Applies
the same logic to lifetime parameters.

Closes #13204
flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 18, 2024
Add manual_ignore_cast_cmp lint

```rust
// bad
fn compare(a: &str, b: &str) -> bool {
    a.to_ascii_lowercase() == b.to_ascii_lowercase()
    || a.to_ascii_lowercase() == "abc"
}

// good
fn compare(a: &str, b: &str) -> bool {
   a.eq_ignore_ascii_case(b)
   || a.eq_ignore_ascii_case("abc")
}
```

- [x] Followed [lint naming conventions][lint_naming]
- [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: [`manual_ignore_case_cmp`] `perf`
[rust-lang#13334](rust-lang/rust-clippy#13334)

Closes rust-lang#13204
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