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

Sidestep link error from rustfix'ed code by using a *defined* static. #55719

Conversation

pnkfelix
Copy link
Member

@pnkfelix pnkfelix commented Nov 6, 2018

As a drive-by, added -g to the compile-flags so that the test more
reliably fails to compile when the extern static in question is not
provided. (I.e. this is making the test more robust in the face of
potential future revisions.)

Fix #54388.

As a drive-by, added `-g` to the compile-flags so that the test more
reliably fails to compile when the extern static in question is *not*
provided. (I.e. this is making the test more robust in the face of
potential future revisions.)

Fix rust-lang#54388.
@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(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 Nov 6, 2018
@alexcrichton
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Nov 6, 2018

📌 Commit e7f8c0d has been approved by alexcrichton

@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 Nov 6, 2018
@kennytm
Copy link
Member

kennytm commented Nov 7, 2018

@bors r-

Failed in the rollup #55746 (comment) for wasm32-unknown. Is libc::c_int defined in wasm32?

Error message
---- [ui] ui/extern/extern-const.rs stdout ----
diff of stderr:

4	LL |     const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
5	   |     ^^^^^ help: try using a static value: `static`
6	
-	error: aborting due to previous error
+	error[E0412]: cannot find type `c_int` in module `libc`
+	  --> $DIR/extern-const.rs:15:38
+	   |
+	LL |     const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`
+	   |                                      ^^^^^ not found in `libc`
+	help: possible candidate is found in another module, you can import it into scope
+	   |
+	LL | use std::os::raw::c_int;
+	   |
8	
+	error: aborting due to 2 previous errors
+	
+	For more information about this error, try `rustc --explain E0412`.
9	


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/extern/extern-const/extern-const.stderr
diff of fixed:

10	#![feature(libc)]
11	extern crate libc;
12	
+	use std::os::raw::c_int;
+	
13	#[link(name = "rust_test_helpers", kind = "static")]
14	extern "C" {
15	    static rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const`


The actual fixed differed from the expected fixed.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 7, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Nov 7, 2018

Is libc::c_int defined in wasm32?

Probably not. But I'm pretty sure extern { static ... } doesn't make any sense there either.

So I think I'll just add a // ignore-wasm32 to the test in question.

@pnkfelix pnkfelix changed the title Sidestep link error from rustfix'ed code by using a *defined* static. [WIP] Sidestep link error from rustfix'ed code by using a *defined* static. Nov 7, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Nov 7, 2018

(marking as Work-In-Progress while dafd2e8 gets tested...)

@pnkfelix pnkfelix force-pushed the issue-54388-sidestep-link-error-from-rustfixed-code branch from dafd2e8 to 34ffbdb Compare November 7, 2018 21:41
@pnkfelix pnkfelix changed the title [WIP] Sidestep link error from rustfix'ed code by using a *defined* static. Sidestep link error from rustfix'ed code by using a *defined* static. Nov 7, 2018
@pnkfelix
Copy link
Member Author

pnkfelix commented Nov 7, 2018

@bors r=alexcrichton rollup

@bors
Copy link
Contributor

bors commented Nov 7, 2018

📌 Commit 34ffbdb has been approved by alexcrichton

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 7, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Nov 8, 2018
…error-from-rustfixed-code, r=alexcrichton

Sidestep link error from rustfix'ed code by using a *defined* static.

As a drive-by, added `-g` to the compile-flags so that the test more
reliably fails to compile when the extern static in question is *not*
provided. (I.e. this is making the test more robust in the face of
potential future revisions.)

Fix rust-lang#54388.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Nov 9, 2018
…error-from-rustfixed-code, r=alexcrichton

Sidestep link error from rustfix'ed code by using a *defined* static.

As a drive-by, added `-g` to the compile-flags so that the test more
reliably fails to compile when the extern static in question is *not*
provided. (I.e. this is making the test more robust in the face of
potential future revisions.)

Fix rust-lang#54388.
bors added a commit that referenced this pull request Nov 9, 2018
Rollup of 17 pull requests

Successful merges:

 - #55576 (Clarify error message for -C opt-level)
 - #55633 (Support memcpy/memmove with differing src/dst alignment)
 - #55638 (Fix ICE in msg_span_from_free_region on ReEmpty)
 - #55659 (rustc: Delete grouping logic from the musl target)
 - #55719 (Sidestep link error from rustfix'ed code by using a *defined* static.)
 - #55736 (Elide anon lifetimes in conflicting impl note)
 - #55739 (Consume optimization fuel from the MIR inliner)
 - #55742 (Avoid panic when matching function call)
 - #55753 (borrow_set: remove a helper function and a clone it uses)
 - #55755 (Improve creation of 3 IndexVecs)
 - #55758 ([regression - rust2018]: unused_mut lint false positives on nightly)
 - #55760 (Remove intermediate font specs)
 - #55761 (mir: remove a hacky recursive helper function)
 - #55774 (wasm32-unknown-emscripten expects the rust_eh_personality symbol)
 - #55777 (Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.)
 - #55783 (Deprecate mpsc channel selection)
 - #55788 (rustc: Request ansi colors if stderr isn't a tty)

Failed merges:

r? @ghost
@bors bors merged commit 34ffbdb into rust-lang:master Nov 9, 2018
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.

5 participants