Comments (2)
FWIW, apparently ch12/noop
was an executable, and it seems to have been added in June 2022:
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ git log noop
commit 6ebd519f5a691a2f4c7d9cfbdb2d3e708e9d9681 (HEAD -> 1st-edition, origin/HEAD, origin/1st-edition)
Author: Tim McNamara <[email protected]>
Date: Thu Jun 30 22:10:49 2022 +1200
ch12: add noop binary for completeness
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$
Possibly that should have resolved this issue?
Ewen
from code.
Possibly that should have resolved this issue?
Actually in the release version of the book, section 12.7 has two examples referred to as:
rustc ch12/fn-ptr-demo-1.rs && ./fn-ptr-demo-1
and
rustc ch12/fn-ptr-demo-2.rs && ./fn-ptr-demo-2
which are Listing 12.9 and Listing 12.10 respectively. The source to those probably should be in this repository (neither is present, just the noop
executable!).
I think the noop
binary which was added corresponds to Listing 12.9 (ie fn-ptr-demo-1.rs) based on the output. But it's unclear why the binary was added, rather than the source. Especialy as the binary will, at best, only work on Linux.
Ewen
Listing 12.9 output compared with noop executable output
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ file noop
noop: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=bd628d94abc0aaaa7da48da7fe1bca30a3d3fe78, for GNU/Linux 3.2.0, with debug_info, not stripped
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ ldd noop
linux-vdso.so.1 (0x00007ffd43fe9000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3fab747000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3fab742000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3fab73d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3fab515000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3fab7b7000)
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ ./noop
noop as usize: 0x5578c49d7780
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ cat fn-ptr-demo-1.rs
fn noop() {}
fn main() {
let fn_ptr = noop as usize;
println!("noop as usize: 0x{:x}", fn_ptr);
}
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ rustc fn-ptr-demo-1.rs
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$ ./fn-ptr-demo-1
noop as usize: 0x55f529136400
ewen@rustdev:~/misc/src/rust/rust-in-action/ch12$
from code.
Related Issues (20)
- ch8/ch8-mget: build fails immediately due to misformed TOML in Cargo.toml HOT 1
- ch10/ch10-render-hex-threadpool: does not match Listing 10.28, or compile
- ch12/asm.rs: asm!() is in stable rust (since 1.59), different use syntax
- add .gitignore with target/ pattern
- ch4: short-lived strategy
- ch5: incorrect value for skip operation
- ch8/ch8-mget freezes on polling state=Request is_active=true may_send=false can_recv=false may_recv=false
- ch6/ch6-particles fails with missing libX11.so.6 HOT 1
- ActionKV function find() not working properly?
- ch2-mandelbrot: could not compile `num-bigint` (lib) due to 4 previous errors HOT 3
- ch2-complex - use of unstable library feature 'dec2flt': internal routines only exposed for testing HOT 2
- ch7: actionkv v2.0 does not resolve the problem in actionkv v1.0 HOT 6
- NTP offset definition in book and source code is incorrect HOT 1
- ch12-sjlj Why the program not execute the line `println!("early return!");`, set_jmp and long_jmp didn`t work. HOT 2
- ch11-fledgeos-0 not building. Fix provided. Error: feature(const_fn) has been removed HOT 2
- Chapter 10, 10.18, ch10-render-hex, Mac OS X
- ch6/ch6-particles does not compile on MacOS with `zsh: illegal hardware instruction cargo run` HOT 7
- Chapter 5 listing 5.4 ch5/ch5-bit-pattern.rs doesn't compile HOT 1
- ch8/ch8-simple: reqwest fails to connect with rust 1.66: Invalid argument
- ch8/ch8-resolve: does not build with Rust 1.66 (transmute size mismatch in socket2) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code.