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

Provide force coloring option for rustc #12881

Closed
bollu opened this issue Mar 14, 2014 · 2 comments · Fixed by #14040
Closed

Provide force coloring option for rustc #12881

bollu opened this issue Mar 14, 2014 · 2 comments · Fixed by #14040

Comments

@bollu
Copy link

bollu commented Mar 14, 2014

I often use tup / ninja as build systems which pipe input into an internal buffer and only later send it to stdout,

Rustc disables coloring when it's piped into any other source. Hence, I lose all coloring when using rust with tup.

Clang has the same behaviour by default, but provides a compiler flag -f-color-diagnostics which forces colored output to be emitted. This would be really useful to have in rustc. It makes debugging and in general compiling far more pleasant.

Thanks!

@hannobraun
Copy link

I've started working on this. Here's my progress so far: https://github.com/hannobraun/rust/commit/2f2ac5de204e1abf3f3371b4c772123d018742e2

I haven't tested this yet and haven't even run a full make check so far. Unfortunately I don't seem to have enough RAM in this machine to work while running the Rust build in the background, so I can't finish today.

I'll get back to it and send a pull request as soon as I can! (might be a week or two though, lots to do)

bors added a commit that referenced this issue May 15, 2014
…hton

This pull request fixes #12881.

Two caveats:

1. As explained in the commit message, this doesn't include a regression test. If this is unacceptable, please let me know, I'll see what I can do.
1. I'm getting some test failures on make check, all from debuginfo. I suspect this is due to #13680 and  not related to my changes (I have GDB 7.7). This is the list of failed tests:

> [debuginfo-gdb] debuginfo/basic-types-globals.rs
> [debuginfo-gdb] debuginfo/basic-types-mut-globals.rs
> [debuginfo-gdb] debuginfo/basic-types.rs
> [debuginfo-gdb] debuginfo/borrowed-basic.rs
> [debuginfo-gdb] debuginfo/borrowed-managed-basic.rs
> [debuginfo-gdb] debuginfo/borrowed-struct.rs
> [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs
> [debuginfo-gdb] debuginfo/box.rs
> [debuginfo-gdb] debuginfo/by-value-non-immediate-argument.rs
> [debuginfo-gdb] debuginfo/by-value-self-argument-in-trait-impl.rs
> [debuginfo-gdb] debuginfo/closure-in-generic-function.rs
> [debuginfo-gdb] debuginfo/evec-in-struct.rs
> [debuginfo-gdb] debuginfo/function-arg-initialization.rs
> [debuginfo-gdb] debuginfo/function-prologue-stepping-no-split-stack.rs
> [debuginfo-gdb] debuginfo/generic-function.rs
> [debuginfo-gdb] debuginfo/generic-functions-nested.rs
> [debuginfo-gdb] debuginfo/generic-method-on-generic-struct.rs
> [debuginfo-gdb] debuginfo/generic-static-method-on-struct-and-enum.rs
> [debuginfo-gdb] debuginfo/generic-struct.rs
> [debuginfo-gdb] debuginfo/lexical-scope-in-stack-closure.rs
> [debuginfo-gdb] debuginfo/lexical-scope-in-unique-closure.rs
> [debuginfo-gdb] debuginfo/method-on-generic-struct.rs
> [debuginfo-gdb] debuginfo/method-on-tuple-struct.rs
> [debuginfo-gdb] debuginfo/name-shadowing-and-scope-nesting.rs
> [debuginfo-gdb] debuginfo/recursive-struct.rs
> [debuginfo-gdb] debuginfo/self-in-generic-default-method.rs
> [debuginfo-gdb] debuginfo/shadowed-argument.rs
> [debuginfo-gdb] debuginfo/shadowed-variable.rs
> [debuginfo-gdb] debuginfo/simd.rs
> [debuginfo-gdb] debuginfo/simple-lexical-scope.rs
> [debuginfo-gdb] debuginfo/simple-struct.rs
> [debuginfo-gdb] debuginfo/simple-tuple.rs
> [debuginfo-gdb] debuginfo/static-method-on-struct-and-enum.rs
> [debuginfo-gdb] debuginfo/tuple-struct.rs
> [debuginfo-gdb] debuginfo/var-captured-in-nested-closure.rs
> [debuginfo-gdb] debuginfo/var-captured-in-sendable-closure.rs
> [debuginfo-gdb] debuginfo/var-captured-in-stack-closure.rs

I can provide the full output on request.
@jonhoo
Copy link
Contributor

jonhoo commented Feb 27, 2016

Shouldn't this also pass --color always to rustc? It seems unfortunate for the only way to actually force color to be

$ cargo rustc --color always -- --color always 

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Aug 2, 2022
fix: Fix server panicking on project loading when proc-macros are disabled

Fixes rust-lang/rust-analyzer#12879
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 13, 2024
Only run `suboptimal_flops` on inherent method calls

Fixes rust-lang#12881

`suboptimal_flops` was making the wrong assumption that a `.log()` method call on a float literal must choose the inherent log method that will always have an argument present (in which case `args[0]` indexing would be fine), but that wasn't the case in the linked issue because at the point of the method call, the exact float type hadn't been inferred yet (and method selection can't select inherent methods when the exact float type has not yet been inferred, in which case it falls back to looking for trait impls and chooses the one that didn't have any parameters).

This fixes it by actually making sure it's a call to an inherent method (could also fix the linked ICE by simply using fallibly indexing via `.get()`, but this felt like it'd fix the root cause: even if there were one argument, it would still be wrong to emit a warning there because it's not the `log` method the lint was expecting). I'm not sure if we need that extra function be in `clippy_utils` but it feels like it could be useful.

changelog: Fixes an ICE in [`suboptimal_flops`]
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 a pull request may close this issue.

3 participants