Rust: Stability checker prevents return-position impl trait in the standard library

Created on 17 Sep 2018  路  8Comments  路  Source: rust-lang/rust

Previously hit here: https://github.com/rust-lang/rust/pull/52896#issuecomment-409149134 (thanks, eddyb)

The way I hit this in a change I was trying:

   Compiling core v0.0.0 (file:///C:/src/rust/src/libcore)
鈫怺0m鈫怺1m鈫怺38;5;9merror鈫怺0m鈫怺0m鈫怺1m鈫怺38;5;15m: This node does not have a stability attribute鈫怺0m
鈫怺0m   鈫怺0m鈫怺0m鈫怺1m鈫怺38;5;14m--> 鈫怺0m鈫怺0mlibcore\num\f32.rs:604:35鈫怺0m
鈫怺0m    鈫怺0m鈫怺0m鈫怺1m鈫怺38;5;14m|鈫怺0m
鈫怺0m鈫怺1m鈫怺38;5;14m604鈫怺0m鈫怺0m 鈫怺0m鈫怺0m鈫怺1m鈫怺38;5;14m| 鈫怺0m鈫怺0m    pub fn total_ordered(self) -> impl Ord {鈫怺0m
鈫怺0m    鈫怺0m鈫怺0m鈫怺1m鈫怺38;5;14m| 鈫怺0m鈫怺0m                                  鈫怺0m鈫怺0m鈫怺1m鈫怺38;5;9m^^^^^^^^鈫怺0m

Instructions from oli-obk in https://github.com/rust-lang/rust/pull/52896#issuecomment-409560629 :

Should be enough to add an arm to

https://github.com/rust-lang/rust/blob/a2af8667b1a5166137510aeb2aaad9945f81db6d/src/librustc/middle/stability.rs#L356

for ItemExistential(ExistTy { parent_fn_id: Some(_) }) which also skips the check_missing_stability call

A-impl-trait A-stability E-easy T-compiler

All 8 comments

Your bash seems to use some fancy-dancy colors. Sadly github does not support control-sequences. Can you please edit your post and remove them? :)

@hellow554 Sadly that's what I literally get on windows these days, from x.py:

image

This looks like it is resolved - ran the exact same command @scottmcm used. Should this be closed?

@ZerothLaw Had you added an impl Trait to core when testing? I hit it with this extra change: https://github.com/scottmcm/rust/commit/af0afa928468597034101e02a6be620e0bb24f03#diff-14f327fd5e3b91eb2e9af0690596d156R604

Okay, made the change to f32, and the suggested fix in stability.rs (with some changes) ran the command, getting this error:

error[E0460]: found possibly newer version of crate std which rand depends on
--> libcore../libcore/tests/lib.rs:46:1
|
46 | extern crate rand;
| ^^^^^^^^^^^^^^^^^^
|
= note: perhaps that crate needs to be recompiled?
= note: the following crate versions were found:
crate std: \?\C:\Users\z\source\repos\rustbuild\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\release\deps\libstd-d0b1266efb775c6b.rlib
crate std: \?\C:\Users\z\source\repos\rustbuild\x86_64-pc-windows-msvc\stage1\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-d0b1266efb775c6b.rlib
crate std: \?\C:\Users\z\source\repos\rustbuild\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\release\depsstd-d0b1266efb775c6b.dll
crate std: \?\C:\Users\z\source\repos\rustbuild\x86_64-pc-windows-msvc\stage1\lib\rustlib\x86_64-pc-windows-msvc\libstd-d0b1266efb775c6b.dll
crate rand: \?\C:\Users\z\source\repos\rustbuild\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\release\deps\librand-7403067dcfff573d.rlib

error: aborting due to previous error

For more information about this error, try rustc --explain E0460.
error: Could not compile core.

To learn more, run the command again with --verbose.

command did not execute successfully: "C:\Users\z\source\repos\rust\build\x86_64-pc-windows-msvc\stage0\bin\cargo.exe" "test" "--target" "x86_64-pc-windows-msvc" "-j" "4" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "C:\Users\z\source\repos\rust\src/libstd/Cargo.toml" "-p" "core" "--" "total" "--quiet"
expected success, got: exit code: 101

failed to run: C:\Users\z\source\repos\rustbuild\bootstrap\debug\bootstrap test --incremental --keep-stage 0 --stage 1 src\libcore --test-args total
Build completed unsuccessfully in 0:00:41

This seems to now be resolved on latest master branch.

Should this issue be closed @scottmcm ?

There appear to be many instances of -> impl FnMut and others in core, this issue should be closed.

Was this page helpful?
0 / 5 - 0 ratings