Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
I'll try to write an MCP later (unless someone does it for me). This change was motivated after seeing https://internals.rust-lang.org/t/code-compiles-on-playground-but-fails-when-passed-via-stdin-to-rustc/24393 where the different defaults between cargo, playground and rustc caused people to get confused. |
b923a75 to
2a486d3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4241536 to
d71c2fa
Compare
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
d71c2fa to
a1d6de2
Compare
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn main() { | ||
| rustc().input("foo-prev.rs").run(); | ||
| rustc().edition("2015").input("foo-prev.rs").run(); |
There was a problem hiding this comment.
Remark: we could consider default setting edition but allow overriding, but explicit is fine
This comment has been minimized.
This comment has been minimized.
5c5d580 to
fb94f61
Compare
This comment has been minimized.
This comment has been minimized.
fb94f61 to
b4c367e
Compare
Use same wording as cargo does when `package.edition` is unspecified. Do not suggest `--edition=future` on stable.
b4c367e to
5c0fee6
Compare
| /// We should not be emitting notes during compiles, with the *only* exception of missing | ||
| /// `--edition` when calling `rustc` directly. | ||
| pub fn early_note_for_missing_crate_edition(&self, msg: impl Into<DiagMessage>) { | ||
| self.dcx.handle().note(msg) | ||
| } |
There was a problem hiding this comment.
Heads up @nnethercote, who's been removing weird diagnostics APIs. I'm re-adding this because the complaing about --edition not being set for rustc must be a note. Let me know if there's an alternative to doing this that I should pursue instead. We might want to just use eprintln!() instead 🤔
There was a problem hiding this comment.
Or a warning?
More generally, what exactly is a note? I see it as some additional information about a top-level error or warning, which is why it makes sense as a subdiagnostic but not as a top-level diagnostic.
There was a problem hiding this comment.
I generally agree, it's just that this case in particular we want to provide feedback to users but not make it seem like it is a bug of some kind (which is what both errors and warnings communicate). Regardless, I think that using eprintln for this makes sense. We don't need a header for the message, we don't want colors in it. It just has to be somewhere visible for a naïve use of rustc.
There was a problem hiding this comment.
This is a case where it's not an error, but also probably doesn't do what you expect. That seems to me like a good fit for a warning.
There was a problem hiding this comment.
Won't eprintln! then also mix into --message-format=json output1? I guess cargo / dev tools already parse json lines so this might not be a problem? I'm also fine with either a note or a warning, both seem sensible.
Footnotes
-
In unrelated note, we currently paper over rustc
eprintln!issues re. failing to write out stderr, like broken pipes, with-Zon-broken-pipe=kill↩
There was a problem hiding this comment.
@jieyouxu just tested and cargo swallows the eprintln (as expected) the same way as the note.
@nnethercote I know what you mean, but I'm trying to navigate making this something very lightweight. It's not only a semantic/technical issue, this will be visible to a lot of people and the more annoying we make it (which having bright yellow on every compile would accomplish for some) the more likely it is people will come in my general direction with pitchforks :)
|
@bors r=jieyouxu I'll merge with the |
…ieyouxu When compiling without a specified `--edition`, emit a note Implement rust-lang/compiler-team#1019.
Rollup of 15 pull requests Successful merges: - #161051 (When error from local macro, include macro def span) - #162750 (add case mapping fast paths for Latin-1) - #162831 (Do not continue past `rustc_resolve` when encountering duplicated items) - #162835 (rustdoc: account for nested parens and split text events in bare urls lint) - #163044 (Report runtime range endpoints for runtime values) - #163062 (Use x30 register name with LLVM 23+) - #158102 (When compiling without a specified `--edition`, emit a note) - #162984 (Windows: don't error if `access_mode` is set on `OpenOptions`) - #163005 (Avoid unreachable integer underflow check in `CStr::count_bytes()`) - #163019 (Prepare for the introduction of forced keywords (`k#`)) - #163020 (Dir: fix fallback impl for remove_dir) - #163047 (Use verbose suggestion for `mut binding` instead of `&mut binding`) - #163075 (Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64) - #163079 (enable `f128` from `u64`/`i64` test) - #163082 (Remove `TypeChecker::root_cx`)
…ieyouxu When compiling without a specified `--edition`, emit a note Implement rust-lang/compiler-team#1019.
|
Checking whether this caused a weird failure in rollup: #163086 (comment) @bors try jobs=test-x86_64-gnu-aux |
This comment has been minimized.
This comment has been minimized.
When compiling without a specified `--edition`, emit a note try-job: test-x86_64-gnu-aux
|
💔 Test for a8946ca failed: CI. Failed job:
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Huh? |
…uwer Rollup of 18 pull requests Successful merges: - #161051 (When error from local macro, include macro def span) - #161629 (Streamline `StateDiffCollector`) - #162750 (add case mapping fast paths for Latin-1) - #162831 (Do not continue past `rustc_resolve` when encountering duplicated items) - #162835 (rustdoc: account for nested parens and split text events in bare urls lint) - #162952 (Depend on lockfiles to prevent GC of the current session) - #163044 (Report runtime range endpoints for runtime values) - #163062 (Use x30 register name with LLVM 23+) - #158102 (When compiling without a specified `--edition`, emit a note) - #162939 (Declare multi-kind constants for MacroKinds) - #162984 (Windows: don't error if `access_mode` is set on `OpenOptions`) - #163005 (Avoid unreachable integer underflow check in `CStr::count_bytes()`) - #163019 (Prepare for the introduction of forced keywords (`k#`)) - #163020 (Dir: fix fallback impl for remove_dir) - #163047 (Use verbose suggestion for `mut binding` instead of `&mut binding`) - #163075 (Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64) - #163079 (enable `f128` from `u64`/`i64` test) - #163082 (Remove `TypeChecker::root_cx`)
|
@bors r- |
|
This pull request was unapproved. This PR was contained in the following rollups:
|
Implement rust-lang/compiler-team#1019.
View all comments