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

Fix building compiling on OS X 10.9 #10970

Merged
merged 2 commits into from
Dec 15, 2013
Merged

Fix building compiling on OS X 10.9 #10970

merged 2 commits into from
Dec 15, 2013

Conversation

erickt
Copy link
Contributor

@erickt erickt commented Dec 15, 2013

This modifies the configure to set CFG_ENABLE_CLANG=1 if gcc is actually clang. This is needed because OS X's clang enables warning on unused command line arguments. Our build system suppresses this by default, but when CFG_ENABLE_CLANGE=0, we do not. This causes one of the tests to fail. This patch changes rust to directly use clang, which fixes the build failure.

Closes #10811

Apple replaced gcc with clang, but kept around a stub gcc to call
clang. This adds a check in `configure` to detect when gcc is
really clang, and switch to using clang in this situation.

Closes rust-lang#10811.
bors added a commit that referenced this pull request Dec 15, 2013
This modifies the `configure` to set `CFG_ENABLE_CLANG=1` if `gcc` is actually `clang`. This is needed because OS X's clang enables warning on unused command line arguments. Our build system suppresses this by default, but when `CFG_ENABLE_CLANGE=0`, we do not. This causes one of the tests to fail. This patch changes rust to directly use clang, which fixes the build failure.

Closes #10811
@bors bors closed this Dec 15, 2013
@bors bors merged commit 460a966 into rust-lang:master Dec 15, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 14, 2023
new lint: `read_line_without_trim`

This adds a new lint that checks for calls to `Stdin::read_line` with a reference to a string that is then attempted to parse into an integer type without first trimming it, which is always going to fail at runtime.
This is something that I've seen happen a lot to beginners, because it's easy to run into when following the example of chapter 2 in the book where it shows how to program a guessing game.
It would be nice if we could point beginners to clippy and tell them "let's see what clippy has to say" and have clippy explain to them why it fails 👀

I think this lint can later be "generalized" to work not just for `Stdin` but also any `BufRead` (which seems to be where the guarantee about the trailing newline comes from) and also, matching/comparing it to a string slice that doesn't end in a newline character (e.g. `input == "foo"` is always going to fail)

changelog: new lint: [`read_line_without_trim`]
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Feb 11, 2024
…tic, r=Veykril

feat: Add diagnostic with fix to replace trailing `return <val>;` with `<val>`

Works for functions and closures.
Ignores desugared return expressions (e.g. from desugared try operators).

Fixes: rust-lang#10970
Completes: rust-lang#11020
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 27, 2024
…=dswij

[`read_line_without_trim`]: detect string literal comparison and `.ends_with()` calls

This lint now also realizes that a comparison like `s == "foo"` and calls such as `s.ends_with("foo")` will fail if `s` was initialized by a call to `Stdin::read_line` (because of the trailing newline).

changelog: [`read_line_without_trim`]: detect string literal comparison and `.ends_with()` calls

r? `@giraffate` assigning you because you reviewed rust-lang#10970 that added this lint, so this is kinda a followup PR ^^
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.

make check fails on OSX
3 participants