Skip to content

The Self type is not monomorphized correctly #6129

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
nikomatsakis opened this issue Apr 30, 2013 · 2 comments
Closed

The Self type is not monomorphized correctly #6129

nikomatsakis opened this issue Apr 30, 2013 · 2 comments
Labels
A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nikomatsakis
Copy link
Contributor

The following variation on default-method-simple dies with an ICE:

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(default_methods)];

fn boop<'a, T>(x: &'a T) -> &'a T { x }

trait Foo {
    fn f(&self) {
        io::println("Hello!");
        boop(self).g();
    }
    fn g(&self);
}

struct A {
    x: int
}

impl Foo for A {
    fn g(&self) {
        io::println("Goodbye!");
    }
}

pub fn main() {
    let a = A { x: 1 };
    a.f();
}

the reason for this is that the call to boop requires an auto-ref, and when we evaluate a def_self we get back ty_self, which never gets substititued. I have some theories on how best to fix this :) but for now I am just tagging it and adding some workarounds to the patch on the borrow checker (search for FIXMEs)

@sanxiyn
Copy link
Member

sanxiyn commented Jul 8, 2013

No ICE any more. Fixed by #7545?

@pnkfelix
Copy link
Member

Seems to be fixed indeed. Closing.

flip1995 pushed a commit to flip1995/rust that referenced this issue May 5, 2022
Previously this lint would only look at the integer part of floating
point literals without an exponent, giving wrong suggestions like:

```
  |
8 |     let _ = 123_32.123;
  |             ^^^^^^^^^^ help: did you mean to write: `123.123_f32`
  |
```

Instead, it now ignores these literals.
Fixes rust-lang#6129
flip1995 pushed a commit to flip1995/rust that referenced this issue May 5, 2022
…=llogiq

mistyped_literal_suffix: improve integer suggestions, avoid wrong float suggestions

This PR fixes 2 things:
- The known problem that integer types are always suggested as signed, by suggesting an unsigned suffix for literals that wouldnt fit in the signed type, and ignores any literals too big for the corresponding unsigned type too.
- The lint would only look at the integer part of any floating point literals without an exponent, this causing rust-lang#6129. This just ignores those literals.

Examples:
```rust
let _ = 2_32; // still 2_i32
let _ = 234_8; // would now suggest 234_u8

// these are now ignored
let _ = 500_8;
let _ = 123_32.123;
```

changelog: suggest correct integer types in [`mistyped_literal_suffix`], ignore float literals without an exponent
fixes rust-lang#6129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants