Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Mismatch type error #11

Open
Hperigo opened this issue Aug 13, 2018 · 4 comments
Open

Mismatch type error #11

Hperigo opened this issue Aug 13, 2018 · 4 comments

Comments

@Hperigo
Copy link

Hperigo commented Aug 13, 2018

Hi, total rust newbi here,

I cloned the repo and tried to run cargo run --examples ui but got this error:

error[E0308]: mismatched types=====================================> ] 155/157: gfx-b...  
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/device.rs:1279:49
     |
1279 |                       cpu_buffer.did_modify_range(NSRange {
     |  _________________________________________________^
1280 | |                         location: range.start as _,
1281 | |                         length: (range.end - range.start) as _,
1282 | |                     });
     | |_____________________^ expected struct `cocoa::foundation::NSRange`, found a different struct `cocoa::foundation::NSRange`
     |
     = note: expected type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
                found type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
note: Perhaps two different versions of crate `cocoa` are being used?
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/device.rs:1279:49
     |
1279 |                       cpu_buffer.did_modify_range(NSRange {
     |  _________________________________________________^
1280 | |                         location: range.start as _,
1281 | |                         length: (range.end - range.start) as _,
1282 | |                     });
     | |_____________________^

error[E0308]: mismatched types
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/device.rs:1953:17
     |
1953 | /                 NSRange {
1954 | |                     location: range.levels.start as _,
1955 | |                     length: (range.levels.end - range.levels.start) as _,
1956 | |                 },
     | |_________________^ expected struct `cocoa::foundation::NSRange`, found a different struct `cocoa::foundation::NSRange`
     |
     = note: expected type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
                found type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
note: Perhaps two different versions of crate `cocoa` are being used?
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/device.rs:1953:17
     |
1953 | /                 NSRange {
1954 | |                     location: range.levels.start as _,
1955 | |                     length: (range.levels.end - range.levels.start) as _,
1956 | |                 },
     | |_________________^

error[E0308]: mismatched types
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/device.rs:1957:17
     |
1957 | /                 NSRange {
1958 | |                     location: range.layers.start as _,
1959 | |                     length: (range.layers.end - range.layers.start) as _,
1960 | |                 },
     | |_________________^ expected struct `cocoa::foundation::NSRange`, found a different struct `cocoa::foundation::NSRange`
     |
     = note: expected type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
                found type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
note: Perhaps two different versions of crate `cocoa` are being used?
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/device.rs:1957:17
     |
1957 | /                 NSRange {
1958 | |                     location: range.layers.start as _,
1959 | |                     length: (range.layers.end - range.layers.start) as _,
1960 | |                 },
     | |_________________^

error[E0308]: mismatched types
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/command.rs:1611:21
     |
1611 | /                     NSRange {
1612 | |                         location: 0,
1613 | |                         length: image.raw.mipmap_level_count(),
1614 | |                     },
     | |_____________________^ expected struct `cocoa::foundation::NSRange`, found a different struct `cocoa::foundation::NSRange`
     |
     = note: expected type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
                found type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
note: Perhaps two different versions of crate `cocoa` are being used?
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/command.rs:1611:21
     |
1611 | /                     NSRange {
1612 | |                         location: 0,
1613 | |                         length: image.raw.mipmap_level_count(),
1614 | |                     },
     | |_____________________^

error[E0308]: mismatched types
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/command.rs:1615:21
     |
1615 | /                     NSRange {
1616 | |                         location: sub.layers.start as _,
1617 | |                         length: num_layers,
1618 | |                     },
     | |_____________________^ expected struct `cocoa::foundation::NSRange`, found a different struct `cocoa::foundation::NSRange`
     |
     = note: expected type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
                found type `cocoa::foundation::NSRange` (struct `cocoa::foundation::NSRange`)
note: Perhaps two different versions of crate `cocoa` are being used?
    --> /Users/henrique/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/6cb2a80/src/backend/metal/src/command.rs:1615:21
     |
1615 | /                     NSRange {
1616 | |                         location: sub.layers.start as _,
1617 | |                         length: num_layers,
1618 | |                     },
     | |_____________________^

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `gfx-backend-metal`.   

any ideas? thanks

@zakarumych
Copy link
Owner

It seems that different dependencies uses different versions of cocoa crate. Exactly what compiler says.
To fix this you should check in Cargo.lock what causes different versions to be used. Then you can try to update those to the latest versions. If this won't help - I'll check it later and fix.

@Hperigo
Copy link
Author

Hperigo commented Aug 13, 2018

hi there, thanks for the info.

you are right, my cargo.lock has two versions of cocoa create:

name = "cocoa"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "cocoa"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

I tried the following command:
cargo update -p cocoa:0.15.0 and cargo update

but still got the same error:

error[E0308]: mismatched types====================================>  ]
154/157: gfx-backend-metal, gfx-mesh

@zakarumych
Copy link
Owner

zakarumych commented Aug 27, 2018

Sorry for late response.
This is the problem with metal-rs crate that introduced breaking change (namely updating cocoa dependency version from 0.15 to 0.17) in minor version update 0.10.4 to 0.10.5.
You should instruct cargo to use metal-rs 0.10.4.

@zakarumych
Copy link
Owner

zakarumych commented Aug 27, 2018

Now metal-rs 0.10.5 is yanked and 0.10.6 published with cocoa 0.15. Everything should work fine after cargo update

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants