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

Avoid ICE when include! is used by stdin crate #65603

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

mystor
Copy link
Contributor

@mystor mystor commented Oct 19, 2019

This should hopefully also eliminate the ICE when using include_bytes!, include_str! and #[doc(include = "...")] with a stdio input.

I couldn't see a clear way to write a compile-fail test using compiletest with a stdio input, so I haven't written any tests for this change.

Fixes #63900

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 19, 2019
@@ -1072,7 +1072,8 @@ impl<'a> ExtCtxt<'a> {
/// This unifies the logic used for resolving `include_X!`, and `#[doc(include)]` file paths.
///
/// Returns an absolute path to the file that `path` refers to.
pub fn resolve_path(&self, path: impl Into<PathBuf>, span: Span) -> PathBuf {
pub fn resolve_path(&self, path: impl Into<PathBuf>, span: Span)
-> Result<PathBuf, DiagnosticBuilder<'a>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same formatting as the method below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Centril
Copy link
Contributor

Centril commented Oct 19, 2019

r? @petrochenkov

@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-10-19T17:28:19.4295857Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-19T17:28:19.4482915Z ##[command]git config gc.auto 0
2019-10-19T17:28:19.4558003Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-19T17:28:19.4637829Z ##[command]git config --get-all http.proxy
2019-10-19T17:28:19.4779538Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65603/merge:refs/remotes/pull/65603/merge
---
2019-10-19T17:36:01.5471795Z     Checking syntax_expand v0.0.0 (/checkout/src/libsyntax_expand)
2019-10-19T17:36:01.7972598Z error[E0425]: cannot find value `cx` in this scope
2019-10-19T17:36:01.7973921Z     --> src/libsyntax_expand/expand.rs:1421:42
2019-10-19T17:36:01.7974316Z      |
2019-10-19T17:36:01.7975061Z 1421 |                     let filename = match cx.resolve_path(file, sp) {
2019-10-19T17:36:01.7975670Z      |                                          ^^ help: you might have meant to use the available field: `self.cx`
2019-10-19T17:36:01.7984107Z error[E0425]: cannot find value `sp` in this scope
2019-10-19T17:36:01.7985247Z     --> src/libsyntax_expand/expand.rs:1421:64
2019-10-19T17:36:01.7985867Z      |
2019-10-19T17:36:01.7985867Z      |
2019-10-19T17:36:01.7986480Z 1421 |                     let filename = match cx.resolve_path(file, sp) {
2019-10-19T17:36:01.7990566Z 
2019-10-19T17:36:02.6762754Z error: aborting due to 2 previous errors
2019-10-19T17:36:02.6762859Z 
2019-10-19T17:36:02.6763200Z For more information about this error, try `rustc --explain E0425`.
---
2019-10-19T17:36:02.7110771Z   local time: Sat Oct 19 17:36:02 UTC 2019
2019-10-19T17:36:02.8608549Z   network time: Sat, 19 Oct 2019 17:36:02 GMT
2019-10-19T17:36:02.8608890Z == end clock drift check ==
2019-10-19T17:36:04.1394511Z 
2019-10-19T17:36:04.1499185Z ##[error]Bash exited with code '1'.
2019-10-19T17:36:04.1531087Z ##[section]Starting: Checkout
2019-10-19T17:36:04.1532702Z ==============================================================================
2019-10-19T17:36:04.1532750Z Task         : Get sources
2019-10-19T17:36:04.1532810Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

This should also eliminate the ICE when using `include_bytes!`, `include_str!`
and `#[doc(include = "...")]`.

Fixes rust-lang#63900
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 20, 2019

📌 Commit 9be0bd8 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 20, 2019
Centril added a commit to Centril/rust that referenced this pull request Oct 20, 2019
…nkov

Avoid ICE when include! is used by stdin crate

This should hopefully also eliminate the ICE when using `include_bytes!`, `include_str!` and `#[doc(include = "...")]` with a stdio input.

I couldn't see a clear way to write a compile-fail test using compiletest with a stdio input, so I haven't written any tests for this change.

Fixes rust-lang#63900
bors added a commit that referenced this pull request Oct 20, 2019
Rollup of 8 pull requests

Successful merges:

 - #65314 (rustdoc: forward -Z options to rustc)
 - #65592 (clarify const_prop ICE protection comment)
 - #65603 (Avoid ICE when include! is used by stdin crate)
 - #65614 (Improve error message for APIT with explicit generic arguments)
 - #65629 (Remove `borrowck_graphviz_postflow` from test)
 - #65633 (Remove leading :: from paths in doc examples)
 - #65638 (Rename the default argument 'def' to 'default')
 - #65639 (Fix parameter name in documentation)

Failed merges:

r? @ghost
@bors bors merged commit 9be0bd8 into rust-lang:master Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE having include! in code from stdin when calling rustc
6 participants