Imports can only refer to extern crate names

#1

I git cloned my project that worked on a different computer the same day, but when I compile it on the new computer I get:

error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
  --> src/main.rs:24:5
   |
22 | mod fetch;
   | ---------- not an extern crate passed with `--extern`
23 | 
24 | use fetch::jobs::run_job;
   |     ^^^^^
   |
   = help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the module defined here
  --> src/main.rs:22:1
   |
22 | mod fetch;
   | ^^^^^^^^^^

here is my dir:

src
β”œβ”€β”€ bin
β”‚   β”œβ”€β”€ actix_backend.rs
β”‚   β”œβ”€β”€ actix_fetch.rs
β”‚   └── fetch_job_old.rs
β”œβ”€β”€ db
β”‚   β”œβ”€β”€ data.rs
β”‚   β”œβ”€β”€ fetch_weather.rs
β”‚   β”œβ”€β”€ forecasts.rs
β”‚   β”œβ”€β”€ mod.rs
β”‚   └── models.rs
β”œβ”€β”€ fetch
β”‚   β”œβ”€β”€ config.rs
β”‚   β”œβ”€β”€ jobs.rs
β”‚   β”œβ”€β”€ mod.rs
β”‚   β”œβ”€β”€ process.rs
β”‚   └── sources.rs
└── main.rs

here is how my main looks like:

mod fetch;

use fetch::jobs::run_job;

fn main() {
    //start_fetch_job()
    run_job("http://127.0.0.1:8080".into(), 4);
}

and here is the fetch/mod.rs:

pub mod sources;
pub mod jobs;
pub mod process;
#2

If you’re using version 1.29 <= rust <= 1.31 then what you need to do is use self::module_defined_here instead. I’d recommend updating though as this was sorted out in rust 1.32 so just go to a terminal and rustup update.

3 Likes
#3

rustc 1.32.0-nightly (f4a421ee3 2018-12-13)

#4

This is the one I am using and it is giving me that error

#5

well, I am using cargo:

cargo 1.33.0-nightly (28fb20034 2018-12-09)

#6

yeah it works with the self

1 Like
#7

looks like it was fixed 7 days ago https://github.com/rust-lang/rust/pull/56759
your nightly is from 13 dec. 2018 though.

sweet!

#8

stable rust is 01-16-19 but nightly is still from december. I thought nightly was always ahead?

#9

also I get an error on nightly update:

[ Sat Jan 19 | 08:38 PM | forecast-service ]: rustup update && cargo update
info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2019-01-20, rust version 1.33.0-nightly (0c0c58528 2019-01-19)
error: component 'rls' for target 'x86_64-apple-darwin' is unavailable for download
info: checking for self-updates

       stable-x86_64-apple-darwin unchanged - rustc 1.32.0 (9fda7c223 2019-01-16)
  nightly-x86_64-apple-darwin update failed - rustc 1.32.0-nightly (f4a421ee3 2018-12-13)

#10

Sometimes, due to the way tools are structured in Rust, they lag behind rustc updates. Rustup does its best to avoid automatically updating you to a toolchain missing a component that you’ve added, so you’ll either want to tell it to do so anyway (I’m actually not sure how) or just wait for the toolstate to be unbroken. You did the right thing filing an issue to track it, since I can’t find another. (Adding a link to the rollup which broke the RLS might be helpful as well.)

1 Like