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

Erroneous aliases for async-global-executor-1.4.2 #269

Closed
nikclayton-dfinity opened this issue Oct 26, 2020 · 2 comments
Closed

Erroneous aliases for async-global-executor-1.4.2 #269

nikclayton-dfinity opened this issue Oct 26, 2020 · 2 comments

Comments

@nikclayton-dfinity
Copy link

nikclayton-dfinity commented Oct 26, 2020

Repro:

Add a dependency on the crate async-global-executor-1.4.2 (https://github.com/async-rs/async-global-executor/blob/master/Cargo.toml).

That has this section in the Cargo.toml file:

[features]
default = ["async-io"]
tokio02 = ["tokio02-crate"]
tokio03 = ["tokio03-crate"]

# ...

[dependencies.tokio02-crate]
package = "tokio"
version = "^0.2"
optional = true
default-features = false
features = ["rt-core"]

[dependencies.tokio03-crate]
package = "tokio"
version = "^0.3"
optional = true
default-features = false
features = ["rt"]

However, the file generated by cargo raze (v0.6.1, installed a few moments ago) looks like:

# boilerplate omitted

# buildifier: leave-alone
rust_library(
    name = "async_global_executor",
    crate_type = "lib",
    deps = [
        "@raze__async_executor__1_3_0//:async_executor",
        "@raze__async_io__1_1_10//:async_io",
        "@raze__futures_lite__1_11_2//:futures_lite",
        "@raze__num_cpus__1_13_0//:num_cpus",
        "@raze__once_cell__1_4_1//:once_cell",
        "@raze__tokio__0_2_22//:tokio",
    ],
    srcs = glob(["**/*.rs"]),
    crate_root = "src/lib.rs",
    edition = "2018",
    rustc_flags = [
        "--cap-lints=allow",
    ],
    version = "1.4.2",
    tags = [
        "cargo-raze",
        "manual",
    ],
    crate_features = [
        "async-io",
        "default",
        "tokio02",
        "tokio02-crate",
    ],
    aliases = {
        "@raze__tokio__0_2_22//:tokio": "tokio03_crate",
    },
)

Note the aliases section at the bottom, and how tokio_0_2_22 points to tokio03_crate, resulting in the following build error:

INFO: From Compiling Rust lib async_global_executor v1.4.2 (1 files):
error[E0433]: failed to resolve: use of undeclared type or module `tokio02_crate`
  --> external/raze__async_global_executor__1_4_2/src/lib.rs:69:22
   |
69 | static TOKIO02: Lazy<tokio02_crate::runtime::Handle> = Lazy::new(|| {
   |                      ^^^^^^^^^^^^^ use of undeclared type or module `tokio02_crate`

error[E0433]: failed to resolve: use of undeclared type or module `tokio02_crate`
  --> external/raze__async_global_executor__1_4_2/src/lib.rs:70:42
   |
70 |     let mut rt = tokio02_crate::runtime::Builder::new()
   |                                          ^^^^^^^ not found in `tokio02_crate::runtime`

Changing that tokio03_crate to tokio02_crate is enough for the build to succeed.

@GregBowyer
Copy link
Contributor

I think I have honed in on this one and should have a fix shortly, the downside is it relates to #187 and will be a bit of a rework

GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 6, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 6, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 6, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 6, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 7, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 7, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Nov 9, 2020
…kages

There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunatly, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targetting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of sublte aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
@joell
Copy link

joell commented Jan 7, 2021

When using Tokio 1.0, this aliasing bug now also triggers on async-compression 0.3.7, a dependency of reqwest 0.11.0 which itself is a fairly popular library. As more and more libraries migrate to Tokio 1.0, I expect this issue will start cropping up for people with increasing frequency.

No doubt the completion and merging of #282 would bring great rejoicing! 😄

In the meantime, an ugly hack to work around this is to use raze crate settings to skip and immediately re-add the Tokio dependency, e.g.:

[package.metadata.raze.crates.async-compression.'*']
skipped_deps    = ["tokio-1.0.1"]
additional_deps = ["@raze__tokio__1_0_1//:tokio"]

This seems to trigger cargo-raze to elide the aliases on the tokio package, which allows compilation to continue in my particular case.

GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Feb 4, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Feb 4, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Feb 5, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 23, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 23, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 23, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 23, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 23, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 23, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer added a commit to GregBowyer/cargo-raze that referenced this issue Apr 24, 2021
There are a range of subtle and irritating bugs that stem from
attempting to work with renames from the package set provided by cargo
metadata.

Fortunately, recent versions of cargo metadata provide a limited version
of the resolve nodes, both as the original node ids and as a newer set
providing both rename and targeting information.

As such we can (hopefully) simplify crate -> dep node resolution, remove
a bunch of subtle aliasing bugs.

Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
@dfreese dfreese closed this as completed in 78617c1 Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants