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

Check for missing const-stability attributes in rustc_passes #77203

Merged
merged 4 commits into from
Sep 27, 2020

Conversation

ecstatic-morse
Copy link
Contributor

Currently, this happens as a side effect of is_min_const_fn, which is non-obvious. Also adds a test for this case, since we didn't seem to have one before.

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(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 Sep 25, 2020
@ecstatic-morse ecstatic-morse force-pushed the const-stability-attr-checks branch from 0ca3db8 to 490bcbd Compare September 25, 2020 21:27
This used to happen as a side-effect of `is_min_const_fn`, which was
subtle.
This should be caught by the new check in `rustc_passes`. At some point,
this function will be removed entirely.
@ecstatic-morse ecstatic-morse force-pushed the const-stability-attr-checks branch from 490bcbd to 6ce178f Compare September 25, 2020 21:31
@@ -50,7 +50,7 @@ pub fn is_min_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
None => {
if let Some(stab) = tcx.lookup_stability(def_id) {
if stab.level.is_stable() {
tcx.sess.span_err(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just span_bug! here now, or is it still reachable even if the stability error was reported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is called in check_unsafety, which runs before MissingStabilityAnnotations.

@davidtwco
Copy link
Member

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned davidtwco Sep 26, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Sep 26, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Sep 26, 2020

📌 Commit 6ce178f has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 26, 2020
This was referenced Sep 27, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2020
…as-schievink

Rollup of 7 pull requests

Successful merges:

 - rust-lang#76839 (Add asm! support for MIPS)
 - rust-lang#77203 (Check for missing const-stability attributes in `rustc_passes`)
 - rust-lang#77249 (Separate `private_intra_doc_links` and `broken_intra_doc_links` into separate lints)
 - rust-lang#77252 (reduce overlong line)
 - rust-lang#77256 (Fix typo in ExpnData documentation)
 - rust-lang#77262 (Remove duplicate comment)
 - rust-lang#77263 (Clean up trivial if let)

Failed merges:

r? `@ghost`
@bors bors merged commit 9f086fc into rust-lang:master Sep 27, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 27, 2020
@ecstatic-morse ecstatic-morse deleted the const-stability-attr-checks branch October 6, 2020 01:42
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.

6 participants