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

Add errors for unknown, stable and duplicate feature attributes #52644

Merged
merged 38 commits into from
Aug 6, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented Jul 23, 2018

  • Adds an error for unknown (lang and lib) features.
  • Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features).
  • Adds an error for duplicate (lang and lib) features.
#![feature(fake_feature)] //~ ERROR unknown feature `fake_feature`

#![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0

#![feature(non_exhaustive)]
#![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute

Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features).

There are a few outstanding problems, that I haven't narrowed down yet:

  • Stability attributes on macros do not seem to be taken into account.
  • Stability attributes behind cfg attributes are not taken into account.
  • There are failing incremental tests.

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 23, 2018
@Mark-Simulacrum
Copy link
Member

44a660688bdf05e999abb2f6c51b681292b3349f looks like it replaces a tidy check, so we could probably also remove that in this PR (or leave it as future work, double checking can't really hurt).

@varkor
Copy link
Member Author

varkor commented Jul 23, 2018

@Mark-Simulacrum: yeah, you're right — it looks like it should be checked here:

fn check_match(&self, other: &Feature)-> Result<(), Vec<&'static str>> {
let mut mismatches = Vec::new();
if self.level != other.level {
mismatches.push("stability level");
}
if self.level == Status::Stable || other.level == Status::Stable {
// As long as a feature is unstable, the since field tracks
// when the given part of the feature has been implemented.
// Mismatches are tolerable as features evolve and functionality
// gets added.
// Once a feature is stable, the since field tracks the first version
// it was part of the stable distribution, and mismatches are disallowed.
if self.since != other.since {
mismatches.push("since");
}
}
if self.tracking_issue != other.tracking_issue {
mismatches.push("tracking issue");
}
if mismatches.is_empty() {
Ok(())
} else {
Err(mismatches)
}
}

However, I suspect the check wasn't functioning correctly, because when I originally checked out master for this branch, there was an inconsistency in the stability attributes in stdsimd, which I imagine should have been caught when the submodule was updated?

Edit: maybe it just doesn't check submodules.

@Mark-Simulacrum
Copy link
Member

Yes, it's quite possible the check was broken before.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@petrochenkov
Copy link
Contributor

Any reasons not to merge this into the single existing unused_features lint? (Except for stable_features maybe, since it already exists too.)

Completely unknown and duplicated lints are typos/mistakes that don't happen naturally due to version migration or something like this (like stable features) and also should be rare.
So there's not much reason to allow them and they don't seem to "deserve" separate named lints and perhaps they can even be hard errors.

@varkor
Copy link
Member Author

varkor commented Jul 23, 2018

Any reasons not to merge this into the single existing unused_features lint?

Duplicated lints seem like they could be merged into unused_features, but unknown_features seems like it's a different problem and it's helpful to the user to distinguish between them (they used to be, and I imagine that changed when the infrastructure was modified so that it wasn't possible to distinguish between them any more?).

So there's not much reason to allow them and they don't seem to "deserve" separate named lints and perhaps they can even be hard errors.

I initially implemented unknown_features as a hard error, but it broke so many tests (that rely on #![allow(unknown_features)]), I thought it would just be simpler to keep it as a lint. I can change it into an error, but it's going to require a lot of test modifications as far as I can tell.

Duplicated lints should be able to be made into a hard error without any repercussions.

@petrochenkov
Copy link
Contributor

Duplicated lints seem like they could be merged into unused_features, but unknown_features seems like it's a different problem and it's helpful to the user to distinguish between them

Ok, sounds good.

I initially implemented unknown_features as a hard error, but it broke so many tests (that rely on #![allow(unknown_features)])

Most of those allow(unknown_features)s look unnecessary though, they accompany #![feature(box_syntax)] which is known.
It's interesting how many of them are actually required.

@varkor varkor force-pushed the lib-feature-gate-2 branch 2 times, most recently from 48aff9b to 5f18e7d Compare July 23, 2018 15:24
@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:start:test_incremental
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[00:50:46] 
[00:50:46] running 90 tests
[00:50:58] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[00:50:58] ..F....F..............................................F.......F...........................
[00:50:58] 
[00:50:58] ---- [incremental] incremental/add_private_fn_at_krate_root_cc/struct_point.rs stdout ----
[00:50:58] 
[00:50:58] 
[00:50:58] error in revision `cfail2`: test compilation failed although it shouldn't!
[00:50:58] status: exit code: 101
[00:50:58] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs" "--target=x86_64-unknown-linux-gnu" "--cfg" "cfail2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/add_private_fn_at_krate_root_cc/struct_point/struct_point.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/add_private_fn_at_krate_root_cc/struct_point/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/add_private_fn_at_krate_root_cc/struct_point/auxiliary"
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] stderr:
[00:50:58] stderr:
[00:50:58] ------------------------------------------
[00:50:58] thread 'main' panicked at 'Found unstable fingerprints for DefinedLibFeatures(point[8787])', librustc/ty/query/plumbing.rs:495:13
[00:50:58] 
[00:50:58] error: internal compiler error: unexpected panic
[00:50:58] 
[00:50:58] 
[00:50:58] note: the compiler unexpectedly panicked. this is a bug.
[00:50:58] 
[00:50:58] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:50:58] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:50:58] 
[00:50:58] 
[00:50:58] note: compiler flags: -Z incremental-verify-ich -Z incremental-queries -Z ui-testing -Z unstable-options -Z query-dep-graph -C incremental -C prefer-dynamic -C rpath
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] thread '[incremental] incremental/add_private_fn_at_krate_root_cc/struct_point.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
[00:50:58] thread '[incremental] incremental/add_private_fn_at_krate_root_cc/struct_point.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
[00:50:58] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:50:58] 
[00:50:58] ---- [incremental] incremental/change_crate_order/main.rs stdout ----
[00:50:58] 
[00:50:58] error in revision `rpass2`: compilation failed!
[00:50:58] status: exit code: 101
[00:50:58] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/change_crate_order/main.rs" "--target=x86_64-unknown-linux-gnu" "--cfg" "rpass2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/change_crate_order/main/main.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/change_crate_order/main/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/change_crate_order/main/auxiliary"
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] stderr:
[00:50:58] stderr:
[00:50:58] ------------------------------------------
[00:50:58] thread 'main' panicked at 'Found unstable fingerprints for DefinedLibFeatures(b[8787])', librustc/ty/query/plumbing.rs:495:13
[00:50:58] 
[00:50:58] error: internal compiler error: unexpected panic
[00:50:58] 
[00:50:58] 
[00:50:58] note: the compiler unexpectedly panicked. this is a bug.
[00:50:58] 
[00:50:58] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:50:58] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:50:58] 
[00:50:58] 
[00:50:58] note: compiler flags: -Z incremental-verify-ich -Z incremental-queries -Z ui-testing -Z unstable-options -C incremental -C prefer-dynamic -C rpath
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] thread '[incremental] incremental/change_crate_order/main.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
[00:50:58] thread '[incremental] incremental/change_crate_order/main.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
[00:50:58] 
[00:50:58] ---- [incremental] incremental/issue-39828/issue-39828.rs stdout ----
[00:50:58] 
[00:50:58] error in revision `rpass2`: compilation failed!
[00:50:58] status: exit code: 101
[00:50:58] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/issue-39828/issue-39828.rs" "--target=x86_64-unknown-linux-gnu" "--cfg" "rpass2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/issue-39828/issue-39828/issue-39828.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/issue-39828/issue-39828/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/issue-39828/issue-39828/auxiliary"
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] stderr:
[00:50:58] stderr:
[00:50:58] ------------------------------------------
[00:50:58] thread 'main' panicked at 'Found unstable fingerprints for DefinedLibFeatures(generic[8787])', librustc/ty/query/plumbing.rs:495:13
[00:50:58] 
[00:50:58] error: internal compiler error: unexpected panic
[00:50:58] 
[00:50:58] 
[00:50:58] note: the compiler unexpectedly panicked. this is a bug.
[00:50:58] 
[00:50:58] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:50:58] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:50:58] 
[00:50:58] 
[00:50:58] note: compiler flags: -Z incremental-verify-ich -Z incremental-queries -Z ui-testing -Z unstable-options -C incremental -C prefer-dynamic -C rpath
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] thread '[incremental] incremental/issue-39828/issue-39828.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
[00:50:58] thread '[incremental] incremental/issue-39828/issue-39828.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
[00:50:58] 
[00:50:58] ---- [incremental] incremental/remapped_paths_cc/main.rs stdout ----
[00:50:58] 
[00:50:58] error in revision `rpass2`: compilation failed!
[00:50:58] status: exit code: 101
[00:50:58] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/remapped_paths_cc/main.rs" "--target=x86_64-unknown-linux-gnu" "--cfg" "rpass2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/remapped_paths_cc/main/main.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/remapped_paths_cc/main/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-g" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/remapped_paths_cc/main/auxiliary"
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] stderr:
[00:50:58] stderr:
[00:50:58] ------------------------------------------
[00:50:58] thread 'main' panicked at 'Found unstable fingerprints for DefinedLibFeatures(extern_crate[8787])', librustc/ty/query/plumbing.rs:495:13
[00:50:58] 
[00:50:58] error: internal compiler error: unexpected panic
[00:50:58] 
[00:50:58] 
[00:50:58] note: the compiler unexpectedly panicked. this is a bug.
[00:50:58] 
[00:50:58] note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
[00:50:58] note: rustc 1.29.0-dev running on x86_64-unknown-linux-gnu
[00:50:58] 
[00:50:58] 
[00:50:58] note: compiler flags: -Z incremental-verify-ich -Z incremental-queries -Z ui-testing -Z unstable-options -Z query-dep-graph -C incremental -C prefer-dynamic -C rpath
[00:50:58] 
[00:50:58] ------------------------------------------
[00:50:58] 
[00:50:58] thread '[incremental] incremental/remapped_paths_cc/main.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3137:9
---
[00:50:58] test result: FAILED. 86 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out
[00:50:58] 
[00:50:58] 
[00:50:58] 
[00:50:58] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/incremental" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "incremental" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:50:58] 
[00:50:58] 
[00:50:58] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:50:58] Build completed unsuccessfully in 0:09:41
[00:50:58] Build completed unsuccessfully in 0:09:41
[00:50:58] make: *** [check] Error 1
[00:50:58] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:03c32994
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:0020f9f4:start=1532367750807167233,finish=1532367750814683040,duration=7515807
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:08468d98
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:08afbb96
travis_time:start:08afbb96
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0555d92b
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@varkor
Copy link
Member Author

varkor commented Jul 23, 2018

It's interesting how many of them are actually required.

Okay, now I've converted unknown_features to a hard error and cleaned up all the tests. The diff is a little noisy now (the latest commit should probably just be viewed in isolation), but it cleans things up functionally.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@varkor varkor changed the title Add lints for unknown, stable and duplicate feature attributes Add errors for unknown, stable and duplicate feature attributes Jul 24, 2018
@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #52644!

Tested on commit b239743.
Direct link to PR: #52644

💔 clippy-driver on windows: test-pass → test-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → test-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 rls on windows: test-fail → build-fail (cc @nrc, @rust-lang/infra).
💔 rls on linux: test-fail → build-fail (cc @nrc, @rust-lang/infra).
💔 rustfmt on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 rustfmt on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 nomicon on windows: test-pass → test-fail (cc @frewsxcv @gankro, @rust-lang/infra).
💔 nomicon on linux: test-pass → test-fail (cc @frewsxcv @gankro, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Aug 6, 2018
Tested on commit rust-lang/rust@b239743.
Direct link to PR: <rust-lang/rust#52644>

💔 clippy-driver on windows: test-pass → test-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → test-fail (cc @Manishearth @llogiq @mcarton @oli-obk, @rust-lang/infra).
💔 rls on windows: test-fail → build-fail (cc @nrc, @rust-lang/infra).
💔 rls on linux: test-fail → build-fail (cc @nrc, @rust-lang/infra).
💔 rustfmt on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 rustfmt on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
💔 nomicon on windows: test-pass → test-fail (cc @frewsxcv @gankro, @rust-lang/infra).
💔 nomicon on linux: test-pass → test-fail (cc @frewsxcv @gankro, @rust-lang/infra).
@michaelwoerister
Copy link
Member

🎉

@varkor varkor deleted the lib-feature-gate-2 branch August 6, 2018 21:00
@eddyb
Copy link
Member

eddyb commented Aug 10, 2018

@varkor I expect neither libc nor test to need special-casing.
Could you open an issue to track figuring this out?

@varkor
Copy link
Member Author

varkor commented Aug 11, 2018

@eddyb: sure, I've opened #53260 for this.

Bobo1239 added a commit to Bobo1239/wana_kana_rust that referenced this pull request Aug 14, 2018
Fixes compilation on newest nightly Rust due to rust-lang/rust#52644.
@nnethercote
Copy link
Contributor

Unfortunately, this regressed compile speed across a lot of benchmarks, by up to 4.4%
https://perf.rust-lang.org/compare.html?start=4b8089daf8046d7999310d44e5c68ccff4ab255a&end=b2397437530eecef72a1524a7e0a4b42034fa360&stat=instructions:u

@varkor: any idea why this might be?

@varkor
Copy link
Member Author

varkor commented Aug 17, 2018

@nnethercote: oh no :(

I suspect it's because it's unconditionally traversing the entire crate looking for attributes. I wonder how #53397 affects that... I can think of one possible improvement, but off the top of my head, I'm not sure how to avoid this traversal... I'll try to give it some thought.

@eddyb
Copy link
Member

eddyb commented Aug 17, 2018

@varkor Couldn't it be integrated in the existing stability pass?

bors added a commit that referenced this pull request Aug 17, 2018
[WIP] Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote
bors added a commit that referenced this pull request Aug 20, 2018
[WIP] Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote
bors added a commit that referenced this pull request Aug 21, 2018
…ister

Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote
@jethrogb
Copy link
Contributor

This breaks the core_io crate, which relies on being able to enable all features any previous rust compiler might've needed to compile the code in src/libstd/io.

@varkor
Copy link
Member Author

varkor commented Apr 30, 2019

@jethrogb: this just produces a warning for activating stable Rust features, which can be ignored completely with #![allow(stable_features)].

@jethrogb
Copy link
Contributor

jethrogb commented Apr 30, 2019

I'm already doing that:

#![allow(stable_features,unused_features)]
#![feature(alloc,collections,str_char,unicode)]

fn main() {}
error[E0635]: unknown feature `str_char`
 --> test.rs:2:30
  |
2 | #![feature(alloc,collections,str_char,unicode)]
  |                              ^^^^^^^^

error[E0635]: unknown feature `collections`
 --> test.rs:2:18
  |
2 | #![feature(alloc,collections,str_char,unicode)]
  |                  ^^^^^^^^^^^

error[E0635]: unknown feature `unicode`
 --> test.rs:2:39
  |
2 | #![feature(alloc,collections,str_char,unicode)]
  |                                       ^^^^^^^

@varkor
Copy link
Member Author

varkor commented Apr 30, 2019

@jethrogb: ah, it seems some past features were simply removed outright rather than being deprecated as they should be. Could you open a new issue for this, so it doesn't get lost? (If you have/could generate a list of all the features that aren't recognised, but should be, that would be really helpful, but don't worry if not.) I think we'll need to retroactively make these features deprecated.

@jethrogb
Copy link
Contributor

Hmm, it's worse than that, because I also rely on not-yet-known features being silently ignored in older compilers.

@varkor
Copy link
Member Author

varkor commented May 1, 2019

@jethrogb: I don't see a strong reason not to make the unknown feature error a deny-by-default lint instead, which would allow you to silence it. If you could make a separate issue for that too, it'll help it not to get lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should warn for enabling the same feature twice Unknown feature flags should trigger a warning or error