Hi. I'm having a problem with the gstreamer crate. Adding it to my dependencies causes the RLS to emit build errors, while the regular cargo build from the command line works fine.
This happens even without any code of mine (simple demo).
The error in the Visual Studio Code console (formatted):
{
"message": "cannot extract an associated type from a higher-ranked trait bound in this context",
"code": {
"code": "E0212",
"explanation": null
},
"level": "error",
"spans": [
{
"file_name": "/home/elomatreb/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-0.13.0/src/tags.rs",
"byte_start": 20318,
"byte_end": 20341,
"line_start": 830,
"line_end": 830,
"column_start": 13,
"column_end": 36,
"is_primary": true,
"text": [
{
"text": " T::TagType::static_type().to_glib(),",
"highlight_start": 13,
"highlight_end": 36
}
],
"label": null,
"suggested_replacement": null,
"suggestion_applicability": null,
"expansion": null
}
],
"children": [],
"rendered": "error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context\n --> /home/elomatreb/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-0.13.0/src/tags.rs:830:13\n |\n830 | T::TagType::static_type().to_glib(),\n | ^^^^^^^^^^^^^^^^^^^^^^^\n\n"
}
{
"message": "aborting due to previous error",
"code": null,
"level": "error",
"spans": [],
"children": [],
"rendered": "error: aborting due to previous error\n\n"
}
{
"message": "For more information about this error, try `rustc --explain E0212`.",
"code": null,
"level": "",
"spans": [],
"children": [],
"rendered": "For more information about this error, try `rustc --explain E0212`.\n"
}
This is the line the error reports, but the level of Rust I feel like is necessary to understand the error is a little beyond me.
I'm sorry if this is a user error, I'm still fairly new to Rust in general.
I can reproduce the same issue from the command-line RUST_LOG=rls=debug rls --cli with both the stable-x86_64-pc-windows-gnu and nightly-x86_64-pc-windows-gnu toolchains. I'm building against gstreamer="0.13.0".
$ rustup show
Default host: x86_64-pc-windows-msvc
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu (default)
nightly-x86_64-pc-windows-gnu
active toolchain
----------------
stable-x86_64-pc-windows-gnu (default)
rustc 1.33.0 (2aa4c46cf 2019-02-28)
Here is a link to the line causing the error https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/blob/e0c0c7d4172ef401c4e2c96405cf4d8d139a7334/gstreamer/src/tags.rs#L830
I can confirm the error with:
$ rustc --version
rustc 1.35.0-nightly (7c19e1eed 2019-03-12)
$ rls --version
rls 1.34.0 (6840dd6 2019-03-10)
Interestingly enough, the RLS rustc shim seems to be at fault here somehow (:man_shrugging: )
RLS_RUSTC_SHIM=1 /home/xanewok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rls --crate-name gstreamer /home/xanewok/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-0.13.0/src/lib.rs --color never --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg 'feature="default"' -C metadata=9bbfe699423328b2 -C extra-filename=-9bbfe699423328b2 --out-dir /home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps -L dependency=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps --extern bitflags=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libbitflags-11d0722d0adf4c3c.rmeta --extern cfg_if=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libcfg_if-e9ff40315488b035.rmeta --extern glib=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libglib-68c2bf5d05cf3859.rmeta --extern glib_sys=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libglib_sys-997ed6c170759744.rmeta --extern gobject_sys=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libgobject_sys-9236f8dfc67a5fb8.rmeta --extern gstreamer_sys=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libgstreamer_sys-67fc9f3d8e2f03e4.rmeta --extern lazy_static=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/liblazy_static-6d811268429bebf1.rmeta --extern libc=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/liblibc-950ceab466e2e16c.rmeta --extern muldiv=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libmuldiv-b4a30e4439349381.rmeta --extern num_rational=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libnum_rational-2a4d6475597a98b0.rmeta --cap-lints allow --error-format=json --sysroot /home/xanewok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
exits with the aforementioned message and exit code 130, meanwhile regular rustc call: (only executable and RLS_RUSTC_SHIM=1 changed)
/home/xanewok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name gstreamer /home/xanewok/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-0.13.0/src/lib.rs --color never --crate-type lib --emit=dep-info,metadata -C debuginfo=2 --cfg 'feature="default"' -C metadata=9bbfe699423328b2 -C extra-filename=-9bbfe699423328b2 --out-dir /home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps -L dependency=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps --extern bitflags=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libbitflags-11d0722d0adf4c3c.rmeta --extern cfg_if=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libcfg_if-e9ff40315488b035.rmeta --extern glib=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libglib-68c2bf5d05cf3859.rmeta --extern glib_sys=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libglib_sys-997ed6c170759744.rmeta --extern gobject_sys=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libgobject_sys-9236f8dfc67a5fb8.rmeta --extern gstreamer_sys=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libgstreamer_sys-67fc9f3d8e2f03e4.rmeta --extern lazy_static=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/liblazy_static-6d811268429bebf1.rmeta --extern libc=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/liblibc-950ceab466e2e16c.rmeta --extern muldiv=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libmuldiv-b4a30e4439349381.rmeta --extern num_rational=/home/xanewok/repos/rls-gstreamer-error-demo/target/rls/debug/deps/libnum_rational-2a4d6475597a98b0.rmeta --cap-lints allow --error-format=json --sysroot /home/xanewok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
succeeds.
I'll poke around and see if I can fix this
Same issue here with
$ rls --version
rls-preview 1.33.0 (9f3c906 2019-01-20)
$ rustc --version
rustc 1.33.0 (2aa4c46cf 2019-02-28)
@Xanewok did you find out anything?
I've created a matching bug report over at the gstreamer-rs repo: https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/194
I'm having the same error with one of my own crates. Reduced the code down to an small test case.
trait Test<'a> {
type Thing: Test2;
}
trait Test2 {
fn print();
}
#[allow(unused)]
fn example<T>(t: T)
where T: for<'a> Test<'a>
{
T::Thing::print();
}
Sorry it took so long, managed to come back to this issue today. Hopefully I found the culprit; the issue seems to be in the save-analysis lib in the Rust compiler. Things seem to work as expected with the fix applied, so - fingers crossed :crossed_fingers:
Is there a chance of this being backported to 1.34, in e.g. 1.34.1?
@Xanewok Any idea when this will hit stable?
Most helpful comment
Sorry it took so long, managed to come back to this issue today. Hopefully I found the culprit; the issue seems to be in the save-analysis lib in the Rust compiler. Things seem to work as expected with the fix applied, so - fingers crossed :crossed_fingers: