Skip to content

beta ICE: new iron: &mut iron::Request<'_, '_> was a subtype of &mut _ but now is not? #45801

Closed

Description

@FauxFaux

Upgrading iron in my project causes an ICE. This is possibly the same as #36701, but this must be new as I only see the ICE on beta/nightly, not on the current stable channel, which is way newer than the bug report.

Test repo: https://github.com/FauxFaux/quad-image/blob/ice/src/main.rs
git clone -b ice https://github.com/FauxFaux/quad-image.git

Relevant code:

fn handle(req: &mut Request) -> IronResult<Response> {
    req.get_ref::<Params>();
    unimplemented!()
}
error: internal compiler error: /checkout/src/librustc_typeck/check/method/confirm.rs:330: &mut iron::Request<'_, '_> was a subtype of &mut _ but now is not?
 --> src/main.rs:8:9
  |
8 |     req.get_ref::<Params>();
  |         ^^^^^^^

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.23.0-nightly (3b82e4c74 2017-11-05) running on x86_64-unknown-linux-gnu
rustc 1.23.0-nightly (3b82e4c74 2017-11-05)
binary: rustc
commit-hash: 3b82e4c74d43fc1273244532c3a90bf9912061cf
commit-date: 2017-11-05
host: x86_64-unknown-linux-gnu
release: 1.23.0-nightly
LLVM version: 4.0

On stable:

error[E0277]: the trait bound `params::Params: plugin::Plugin<iron::Request<'_, '_>>` is not satisfied
 --> src/main.rs:8:9
  |
8 |     req.get_ref::<Params>();
  |         ^^^^^^^ the trait `plugin::Plugin<iron::Request<'_, '_>>` is not implemented for `params::Params`
  |
  = help: the following implementations were found:
            <params::Params as plugin::Plugin<iron::request::Request<'a, 'b>>>

error: aborting due to previous error

I note that (on all releases), cargo decides to download two different versions of iron? This doesn't seem right.

   Compiling iron v0.5.1
   Compiling iron v0.6.0

Cargo.toml:

[dependencies]
iron = "0.6.0"
params = "0.7.1"
% cargo tree  | fgrep -B2 iron
boom v0.1.0 (file:///home/faux/code/quad-image)
├── iron v0.6.0
--
└── params v0.7.1
    ├── bodyparser v0.6.0
    │   ├── iron v0.5.1
...

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Nov 6, 2017
  2. arielb1 commented on Nov 7, 2017

    @arielb1
    Contributor

    Minified:

    struct Params;
    
    pub trait Plugin<E: ?Sized> {
        type Error;
    }
    
    pub trait Pluggable {
        fn get_ref<P: Plugin<Self>>(&mut self) -> Option<P::Error> {
            None
        }
    }
    
    impl Plugin<()> for Params {
        type Error = ();
    }
    
    impl Pluggable for i32 {}
    
    fn handle(req: &mut i32) {
        req.get_ref::<Params>();
    }
    
    fn main() {}
  3. arielb1 commented on Nov 7, 2017

    @arielb1
    Contributor

    So the main question here is how did this ever work, but given #36701 I suppose the answer is "entirely by accident".

  4. added a commit that references this issue on Nov 13, 2017
    8efbf7a
  5. added a commit that references this issue on Nov 14, 2017
    b23c76e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions