Conversation
…inaku/rust-1 into removed_bootstrap_asserts
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ozkanonur (or someone else) soon. Please see the contribution instructions for more information. |
|
r? @jyn514 |
Noratrieb
left a comment
There was a problem hiding this comment.
Maybe it would make sense to create a exit_error! macro that wraps the eprintln and detail_exit?
| if job.is_null() { | ||
| eprintln!("{}", io::Error::last_os_error()); | ||
| } | ||
| assert!(!job.is_null(), "{}", io::Error::last_os_error()); |
onur-ozkan
left a comment
There was a problem hiding this comment.
I agree suggestion of @Nilstrieb, abstracting those eprintln, crate::detail_exit duplications can be better for future changes.
| match self.kind == Kind::Setup || !self.builder.src.join(alias).exists() { | ||
| true => {} | ||
| false => { | ||
| eprintln!("use `builder.path()` for real paths: {:?}", alias) | ||
| } | ||
| }; |
There was a problem hiding this comment.
if statement would better fit here
There was a problem hiding this comment.
this is not a user-facing error message, this only happens if there's a bug in a Step. so I think an assert like before is better.
| match s == "if-available" { | ||
| false => { | ||
| eprintln!("unknown option `{}` for download-ci-llvm", s); | ||
| crate::detail_exit(1); | ||
| } | ||
| true => {} | ||
| }; |
|
r? @ozkanonur |
This comment has been minimized.
This comment has been minimized.
…emoved_bootstrap_asserts
jyn514
left a comment
There was a problem hiding this comment.
I've only glanced over this, but at a first glance it doesn't look right, it's changed every assert to an error message. I want to instead distinguish user errors from internal errors. I'm happy to give guidance on the difference but it may be a while before I can go line by line through the PR.
As a general rule:
- If the panic can only happen because bootstrap's code itself was changed, it's an internal error (e.g. the Step checking in builder.rs)
- If the panic can only happen because of a config.toml option or flags passed to bootstrap, before any commands are run, it's a user error
- If the panic happens because of an external command it's ambiguous, but I would prefer to default to panicking so people report the bug.
- If the panic happens because of an I/O error it's likely an internal error.
- If the panic should never happen (e.g. "path traversal attack") it's an internal error
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Maybe a simpler rule is "would it be helpful to show a backtrace of where the error is emitted?" If so it should be a panic, if not it should use eprintln. |
IMO having backtrace on errors always nicer than not having it. There should be a huge cost(which I can't see any in this PR's case) for avoiding such need. |
|
I don't agree, "option X can't be combined with download-ci-llvm" is clear on its own and doesn't need a backtrace. And using panics for expected errors makes it more likely that people will ignore real bugs that we do want them to report. |
I didn't look from this perspective. Seems reasonable and makes sense. |
|
☔ The latest upstream changes (presumably #108056) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@GentBinaku FYI: when a PR is ready for review, send a message containing |
|
I'm going to close this since it's been a while - feel free to reopen if you have time to work on it again. |
No description provided.