Skip to content

rustc: Fix cstack lint for default methods. Closes #8753 #8796

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

Closed
wants to merge 1 commit into from

Conversation

brson
Copy link
Contributor

@brson brson commented Aug 27, 2013

No description provided.

}

trait A {
#[fixed_stack_segment]
Copy link
Member

Choose a reason for hiding this comment

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

Could this actually be changed to a compile-fail test to ensure that it still fails in the situation that fixed_stack_segment is omitted on a default method?

Copy link
Member

Choose a reason for hiding this comment

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

As in have both the positive and negative cases, ensuring that only the negative case has an error

@brson
Copy link
Contributor Author

brson commented Aug 28, 2013

@alexcrichton yes. done

@pnkfelix
Copy link
Member

niko and I discussed the error here. This is probably a check-fast specific problem (which I am not sure I checked on my end before now, though I have a least duplicated the problem locally at this point), and it is not clear whether it is exposing an underlying resolve bug, or if the error is expected behavior and the test needs revision. Will poke a bit more.

@pnkfelix
Copy link
Member

I can replicate the problem via make check-fast on non-Windows hosts

For better or for worse: when I change the file like so, the problem goes away:

Update: (there are two ways to solve this, and this top version follows the pattern set by existing tests more properly):

diff --git a/src/test/run-pass/lint-cstack.rs b/src/test/run-pass/lint-cstack.rs
index 8e5ab54..b9e61b4 100644
--- a/src/test/run-pass/lint-cstack.rs
+++ b/src/test/run-pass/lint-cstack.rs
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.

+use std::libc;
+
 extern {
-    fn rust_get_test_int() -> std::libc::intptr_t;
+    fn rust_get_test_int() -> libc::intptr_t;
 }

 trait A {

(Original but not-as-good patch follows):

diff --git a/src/test/run-pass/lint-cstack.rs b/src/test/run-pass/lint-cstack.rs
index 8e5ab54..c665342 100644
--- a/src/test/run-pass/lint-cstack.rs
+++ b/src/test/run-pass/lint-cstack.rs
@@ -9,7 +9,7 @@
 // except according to those terms.

 extern {
-    fn rust_get_test_int() -> std::libc::intptr_t;
+    fn rust_get_test_int() -> ::std::libc::intptr_t;
 }

 trait A {

This is presumably because lint-cstack assumes that it will only be used as a module from the system top-level, but the check-fast target pulls that file in as a submodule within run_pass_stage2.

Niko had claimed to me earlier that the run_pass_stage2 module would also pull in the std module at the same level (which made me think that the code as written should be fine), but I do not see a sign of such a use of mod std being done in run_pass_stage2

So it seems like the potential fixes here are:

  1. Change lint-cstack to use absolute reference of intptr_t
  2. Change run_pass_stage2 to use std (so that all the modules it uses can also reference std relatively, right?)
  3. Change resolve in some way to handle this special case (but why would we do that if at least one of the above two solutions is acceptable?)

@pnkfelix
Copy link
Member

@brson: can you update your Pull Request with one of the diffs from my previous comment so that we can land it?

@brson
Copy link
Contributor Author

brson commented Sep 12, 2013

@pnkfelix yes done

bors added a commit that referenced this pull request Sep 13, 2013
@bors bors closed this Sep 13, 2013
xFrednet pushed a commit to xFrednet/rust that referenced this pull request May 21, 2022
New lint: [`derive_partial_eq_without_eq`]

Introduces a new lint, [`derive_partial_eq_without_eq`].

See: rust-lang#1781 (doesn't close it though).

changelog: add lint [`derive_partial_eq_without_eq`]
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 this pull request may close these issues.

4 participants