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

Confusing error when forgetting #[fixed_stack_segment] #8825

Closed
catamorphism opened this issue Aug 28, 2013 · 3 comments
Closed

Confusing error when forgetting #[fixed_stack_segment] #8825

catamorphism opened this issue Aug 28, 2013 · 3 comments
Labels
A-attributes Area: #[attributes(..)] A-diagnostics Area: Messages for errors, warnings, and lints A-frontend Area: frontend (errors, parsing and HIR)

Comments

@catamorphism
Copy link
Contributor

I think this error message would be slightly confusing for a novice:

/Users/tjc/rust3/src/libstd/os.rs:2091:20: 2091:31 error: invoking non-Rust fn in fn without #[fixed_stack_segment] [-D cstack (default)]
/Users/tjc/rust3/src/libstd/os.rs:2091                     libc::fopen(fromp, modebuf)
                                                           ^~~~~~~~~~~

One way to read the error is that you should literally type #[fixed_stack_segment] [-D cstack (default)] in your code. Maybe there's a way to improve this error message to make it clearer that you have the choice of either using the fixed_stack_segment attribute, or the -D command-line flag. The error doesn't make it totally clear that the second thing-in-brackets is a command-line flag.

@adrientetar
Copy link
Contributor

This warning is issued at src/librustc/middle/stack_check.rs:171:

    cx.tcx.sess.add_lint(lint::cstack,
                         callee.id,
                         callee.span,
                         fmt!("invoking non-Rust fn in fn without \
                              #[fixed_stack_segment]"));

But there's no trace of [-D cstack (default)] there...

@alexcrichton
Copy link
Member

The extra words come from being a lint pass. It's attempting to show you why the lint is being emitted (in case you didn't already know. You'll find that code in librustc/middle/lint.rs

@alexcrichton
Copy link
Member

Closing in favor of #10155

Aaron1011 added a commit to Aaron1011/rust that referenced this issue Mar 7, 2021
Output of `git log --oneline  c68432f1e..970bc67c3`:

970bc67c3 (HEAD, origin/master, origin/auto-cargo, origin/HEAD) Auto merge of rust-lang#9243 - wickerwaka:configurable-env-doc, r=ehuss
4d7a29b75 Document the configurable-env usntable option
f7a7a3f91 Auto merge of rust-lang#9229 - alexcrichton:fix-borrow-mut, r=ehuss
3f2ece7a9 Fix a `BorrowMut` error when stdout is closed
7441e8c23 Auto merge of rust-lang#8825 - Aaron1011:feature/report-future-incompat, r=ehuss
139ed73f5 Add future-incompat tracking issue number.
9ea350368 Fix some minor formatting issues.
f03d47ce4 Address review comments
6177c6584 Implement future incompatibility report support
c69409658 Auto merge of rust-lang#9022 - nagisa:nagisa/manifest_path, r=alexcrichton
548300b20 Add the path to the manifest in json output
99e714c05 Auto merge of rust-lang#9230 - kornelski:nobinaries, r=alexcrichton
61a31bc5f Auto merge of rust-lang#9236 - kornelski:track-assert, r=Eh2406
3f7f0942c track_caller on custom assert functions
6977dee10 Explain `cargo install` is not for libraries
e4aebf0a0 Auto merge of rust-lang#9231 - joshtriplett:clear-to-eol-if-color, r=alexcrichton
b219f0eb7 Auto merge of rust-lang#9181 - jyn514:computer-says-no, r=ehuss
0b1816578 Remove unhelpful link to Cargo book
ea46f5ce3 Use ANSI clear-to-EOL if color is force-enabled
a6394bcc1 Remove unnecessary `config` argument to `Features::add`
3a86ecf2d Fix TODO about nightly features
09677c83c Be less unix-centric in error messages
ecfdced0d Fix test that assumed tests always were run on the stable channel
eba541994 Update comment in build_script_env
a5720117f Make `nightly_features_allowed` a field instead of a function
169b09ce7 Compute `enable_nightly_features` once instead of on each call
8fc86e155 Remove unused thread_locals
4b096beae Fix `masquerade_as_nightly_cargo` in work threads
e56417c8c Suggest RUSTC_BOOTSTRAP=crate instead of RUSTC_BOOTSTRAP=1
418129dae Downgrade error to a warning when `RUSTC_BOOTSTRAP` is set or this is the nightly channel
6c422a2c0 Restrict RUSTC_BOOTSTRAP in build.rs
m-ou-se added a commit to m-ou-se/rust that referenced this issue Mar 9, 2021
Update Cargo

Output of `git log --oneline  c68432f1e..970bc67c3`:

970bc67c3 (HEAD, origin/master, origin/auto-cargo, origin/HEAD) Auto merge of rust-lang#9243 - wickerwaka:configurable-env-doc, r=ehuss
4d7a29b75 Document the configurable-env usntable option
f7a7a3f91 Auto merge of rust-lang#9229 - alexcrichton:fix-borrow-mut, r=ehuss
3f2ece7a9 Fix a `BorrowMut` error when stdout is closed
7441e8c23 Auto merge of rust-lang#8825 - Aaron1011:feature/report-future-incompat, r=ehuss
139ed73f5 Add future-incompat tracking issue number.
9ea350368 Fix some minor formatting issues.
f03d47ce4 Address review comments
6177c6584 Implement future incompatibility report support
c69409658 Auto merge of rust-lang#9022 - nagisa:nagisa/manifest_path, r=alexcrichton
548300b20 Add the path to the manifest in json output
99e714c05 Auto merge of rust-lang#9230 - kornelski:nobinaries, r=alexcrichton
61a31bc5f Auto merge of rust-lang#9236 - kornelski:track-assert, r=Eh2406
3f7f0942c track_caller on custom assert functions
6977dee10 Explain `cargo install` is not for libraries
e4aebf0a0 Auto merge of rust-lang#9231 - joshtriplett:clear-to-eol-if-color, r=alexcrichton
b219f0eb7 Auto merge of rust-lang#9181 - jyn514:computer-says-no, r=ehuss
0b1816578 Remove unhelpful link to Cargo book
ea46f5ce3 Use ANSI clear-to-EOL if color is force-enabled
a6394bcc1 Remove unnecessary `config` argument to `Features::add`
3a86ecf2d Fix TODO about nightly features
09677c83c Be less unix-centric in error messages
ecfdced0d Fix test that assumed tests always were run on the stable channel
eba541994 Update comment in build_script_env
a5720117f Make `nightly_features_allowed` a field instead of a function
169b09ce7 Compute `enable_nightly_features` once instead of on each call
8fc86e155 Remove unused thread_locals
4b096beae Fix `masquerade_as_nightly_cargo` in work threads
e56417c8c Suggest RUSTC_BOOTSTRAP=crate instead of RUSTC_BOOTSTRAP=1
418129dae Downgrade error to a warning when `RUSTC_BOOTSTRAP` is set or this is the nightly channel
6c422a2c0 Restrict RUSTC_BOOTSTRAP in build.rs
xFrednet pushed a commit to xFrednet/rust that referenced this issue May 21, 2022
Tweak some words improved representation

Hello! Thank you for this awesome project!

This PR has implemented improved representation.

- Use "lib" instead of "lifb"
- Use "triggered" instead of "triggere"
- Use "blacklisted_name" instead of "blackisted_name"
- Use "stabilization" instead of "stabilisation"
- Use "behavior" instead of "behaviour"
- Use "target" instead of "tartet"
- Use "checked_add" instead of "chcked_add"
- Use "anti-pattern" instead of "antipattern"
- Use "suggestion" instead of "suggesttion"
- Use "example" instead of "exampel"
- Use "Cheat Sheet" instead of "Cheatsheet"

---

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: #[attributes(..)] A-diagnostics Area: Messages for errors, warnings, and lints A-frontend Area: frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

3 participants