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

Create ResolvePath abstraction in librustc_resolve #50315

Closed
wants to merge 5 commits into from
Closed

Create ResolvePath abstraction in librustc_resolve #50315

wants to merge 5 commits into from

Conversation

IsaacWoods
Copy link
Contributor

Fixes #50258

This creates a struct called ResolvePath to replace the use of &[Ident] in librustc_resolve.

However, this currently doesn't build because we don't use the speculative flag. The only place it could be used atm (as far as I can see), is instead now written like this (librustc_resolve::3370):

if let Some(id) = path.source {
    ...
}

I can make the change to testing speculative and then unwrapping it if that's better?

Overall, I don't know if this is what was intended from the issue, but I thought I'd give it a shot.
r? @Manishearth

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 29, 2018
@petrochenkov
Copy link
Contributor

I don't think one-off abstractions like this bring more improvement than harm and would personally close #50258 as not an issue.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (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.
[00:13:45]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:16:52]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:16:52]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:17:04]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:17:08] error: field is never used: `speculative`
[00:17:08]   --> librustc_resolve/lib.rs:91:5
[00:17:08] 91 |     speculative : bool,
[00:17:08]    |     ^^^^^^^^^^^^^^^^^^
[00:17:08]    |
[00:17:08]    |
[00:17:08]    = note: `-D dead-code` implied by `-D warnings`
[00:17:08] error: aborting due to previous error
[00:17:08] 
[00:17:08] error: Could not compile `rustc_resolve`.
[00:17:08] 
[00:17:08] 
[00:17:08] Caused by:
[00:17:08]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_resolve librustc_resolve/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=8ebf33ee495224fa -C extra-filename=-8ebf33ee495224fa --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-7cdf848b4ea36a34.so --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-f44070055fa5d2f8.so --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-19bf33dd406ed70a.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-6ed50b2d1f28e8a9.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-af41b93aec4c1e93.rlib --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-5a636a569660b030.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-24d121bd290f1f21.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-838d7b7b46636e17/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-c12600360c64db1e/out` (exit code: 101)
[00:17:53] error: build failed
[00:17:53] error: build failed
[00:17:53] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:17:53] expected success, got: exit code: 101
[00:17:53] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:17:53] travis_fold:end:stage0-rustc

[00:17:53] travis_time:end:stage0-rustc:start=1525022500396799757,finish=1525023264340059429,duration=763943259672


[00:17:53] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:17:53] Build completed unsuccessfully in 0:12:57
[00:17:53] make: *** [all] Error 1
[00:17:53] Makefile:28: recipe for target 'all' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:1c69e732
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@petrochenkov
Copy link
Contributor

petrochenkov commented Apr 29, 2018

It could be nice to rename record_used parameters into speculative though, or even change them to enum Speculative::Yes/Speculative::No, that would make it more clear what happens.

@@ -84,6 +84,13 @@ mod check_unused;
mod build_reduced_graph;
mod resolve_imports;

pub struct ResolvePath<'a>
{
Copy link
Member

Choose a reason for hiding this comment

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

nit: standard style is the brace is on the same line

Copy link
Member

Choose a reason for hiding this comment

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

Also no space before the colon

@@ -1654,12 +1661,18 @@ impl<'a> Resolver<'a> {
let path: Vec<Ident> = segments.iter()
.map(|seg| Ident::new(seg.name, span))
.collect();

let resolve_path = ResolvePath {
Copy link
Member

Choose a reason for hiding this comment

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

nit: standard style is

    let resolve_path = ResolvePath {
        ident: &path,
        source: None,
        speculative: true,
    };

(run against rustfmt to see)

Copy link
Member

@Manishearth Manishearth Apr 29, 2018

Choose a reason for hiding this comment

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

also, i think it's fine if we just call this variable path everywhere, the intent is to reduce paths that we pass around as slices

{
ident : &'a [Ident],
source : Option<NodeId>, // None if this path is speculative
speculative : bool,
Copy link
Member

Choose a reason for hiding this comment

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

There currently isn't a case where this is true and source is None, let's remove this field. Instead, document the source as
"NodeId of the path that we are attempting to resolve. When None, this path is being speculatively resolved and we should not emit errors or lints about it."

} else {
Ok(def)
let def = {
let resolve_path = ResolvePath {
Copy link
Member

Choose a reason for hiding this comment

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

this should be constructed immediately after we construct path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem I had with this is, written like this, we need the borrow to end on the Vec so we can do push((path.into_boxed_slice(), span)) later on in the function. I couldn't find a way to turn a &[T] directly into a Box<[T]>, is there a way to do that?

@Manishearth
Copy link
Member

Yes, the intent is to roll record_used into this as well, as we use it more pervasively. Another thing I'd like to pass down here is whether or not the path started with :: when specified. In its current form the abstraction isn't too useful but the intention is to expand it. Also perhaps path_span.

I think this is somewhat useful: We pass around paths a bunch and strip them of most of their info, but we need to persist a couple things and it's getting unweildy.

@eddyb what do you think?

@@ -84,6 +84,13 @@ mod check_unused;
mod build_reduced_graph;
mod resolve_imports;

pub struct ResolvePath<'a> {
ident: &'a [Ident],
Copy link
Member

Choose a reason for hiding this comment

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

I'd call this segments.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (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.
[00:17:53]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:19:18]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:19:19]    Compiling rustc_plugin v0.0.0 (file:///checkout/src/librustc_plugin)
[00:19:19]    Compiling rustc_privacy v0.0.0 (file:///checkout/src/librustc_privacy)
[00:19:19] error[E0425]: cannot find value `path_segments` in this scope
[00:19:19]    --> librustc_resolve/macros.rs:469:24
[00:19:19]     |
[00:19:19] 469 |                 .push((path_segments.into_boxed_slice(), span));
[00:19:19] 
[00:19:21] error: aborting due to previous error
[00:19:21] 
[00:19:21] For more information about this error, try `rustc --explain E0425`.
[00:19:21] For more information about this error, try `rustc --explain E0425`.
[00:19:21] error: Could not compile `rustc_resolve`.
[00:19:21] 
[00:19:21] Caused by:
[00:19:21]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_resolve librustc_resolve/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=8ebf33ee495224fa -C extra-filename=-8ebf33ee495224fa --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-af41b93aec4c1e93.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-f44070055fa5d2f8.so --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-7cdf848b4ea36a34.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-6ed50b2d1f28e8a9.so --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-19bf33dd406ed70a.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-5a636a569660b030.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-24d121bd290f1f21.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-838d7b7b46636e17/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-c12600360c64db1e/out` (exit code: 101)
[00:19:31] error: build failed
[00:19:31] error: build failed
[00:19:31] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:19:31] expected success, got: exit code: 101
[00:19:31] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:19:31] travis_fold:end:stage0-rustc

[00:19:31] travis_time:end:stage0-rustc:start=1525107635623841994,finish=1525108478828423434,duration=843204581440


[00:19:31] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:19:31] Build completed unsuccessfully in 0:14:18
[00:19:31] Makefile:28: recipe for target 'all' failed
[00:19:31] make: *** [all] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:29ccdd3b
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
149120 ./src/llvm-emscripten/test
144660 ./obj/build/bootstrap/debug/incremental
133972 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc
123692 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d
123688 ./obj/build/bootstrap/debug/incremental/bootstrap-1wl4zjaz72e5d/s-f0lsonildk-10zkl3f-6gvofocobazn
89828 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu
89824 ./obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release
89692 ./src/llvm/test/CodeGen
70944 ./obj/build/x86_64-unknown-linux-gnu/native

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)

@IsaacWoods
Copy link
Contributor Author

Thank you for your reviews so far @Manishearth and @eddyb; I think I've fixed everything mentioned apart from one:
In resolve_macro_to_def_inner, a vector is constructed, which I'm then wrapping in the new path struct:

let segments: Vec<_> = segments.iter().map(|seg| seg.ident).collect();
let path = ResolvePath {
    segments: &segments,
    source: None,
};

However, before we were then turning the vector (which is now borrowed in path) into a boxed slice:

self.current_module.nearest_item_scope().macro_resolutions.borrow_mut()
    .push((segments.into_boxed_slice(), span));

Afaik, there's no way to turn the &[_] into the needed Box<[_]>. Is there actually a way to do this, or should I introduce a new scope, make the ResolvePath struct for the call to resolve_path and let it go out of scope before turning the vector into a boxed slice? Also, sorry for the high demand :/

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (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.
[00:13:54]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:16:44]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:17:53]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:17:54]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:17:54] error[E0425]: cannot find value `path_segments` in this scope
[00:17:54]    --> librustc_resolve/macros.rs:469:24
[00:17:54]     |
[00:17:54] 469 |                 .push((path_segments.into_boxed_slice(), span));
[00:17:54] 
[00:17:56] error: aborting due to previous error
[00:17:56] 
[00:17:56] For more information about this error, try `rustc --explain E0425`.
[00:17:56] For more information about this error, try `rustc --explain E0425`.
[00:17:56] error: Could not compile `rustc_resolve`.
[00:17:56] 
[00:17:56] Caused by:
[00:17:56]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_resolve librustc_resolve/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=8ebf33ee495224fa -C extra-filename=-8ebf33ee495224fa --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-7cdf848b4ea36a34.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-6ed50b2d1f28e8a9.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-af41b93aec4c1e93.rlib --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-5a636a569660b030.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-24d121bd290f1f21.so --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-f44070055fa5d2f8.so --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-19bf33dd406ed70a.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-838d7b7b46636e17/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-c12600360c64db1e/out` (exit code: 101)
[00:18:03] error: build failed
[00:18:03] error: build failed
[00:18:03] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:18:03] expected success, got: exit code: 101
[00:18:03] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:18:03] travis_fold:end:stage0-rustc

[00:18:03] travis_time:end:stage0-rustc:start=1525111617921793813,finish=1525112390095419600,duration=772173625787


[00:18:03] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:18:03] Build completed unsuccessfully in 0:13:06
[00:18:03] Makefile:28: recipe for target 'all' failed
[00:18:03] make: *** [all] Error 1
60840 ./src/llvm-emscripten/lib
56092 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/bin
48604 ./obj/build/x86_64-unknown-linux-gnu/stage0/bin
47832 ./obj/build/x86_64-unknown-linux-gnu/stage0-std
---
12160 ./src/llvm-emscripten/include/llvm
11900 ./src/tools/lld
11748 ./src/doc
10080 ./src/test/compile-fail
10012 ./src/llvm/test/MC/AMDGPU
9648 ./src/llvm/test/MC/Disassembler/AMDGPU
travis_time:end:001fe429:start=1525112390375488252,finish=1525112390613839691,duration=238351439
travis_fold:end:after_failure.1
travis_fold:start:after_failure.2
travis_time:start:195abd6e

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)

@shepmaster
Copy link
Member

Ping from triage, @Manishearth ! You have some pending questions.

@Manishearth
Copy link
Member

@IsaacWoods That's fine.

@eddyb do we want to land this?

@eddyb
Copy link
Member

eddyb commented May 6, 2018

@Manishearth I defer any decisions on this PR to @petrochenkov and/or @jseyfried.

@pietroalbini
Copy link
Member

Ping from triage @petrochenkov @jseyfried! This PR needs your decision.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 10, 2018

📌 Commit bfd2a75 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 May 10, 2018
@bors
Copy link
Contributor

bors commented May 11, 2018

⌛ Testing commit bfd2a75 with merge 15d308e83cab8a2fe602e872f220b8f5c472a669...

@bors
Copy link
Contributor

bors commented May 11, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 11, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-debug of your PR failed on Travis (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.
    100% |████████████████████████████████| 61kB 5.5MB/s 
Collecting botocore==1.10.19 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/34/05/1ffe77f2b8fb03a9223f3d0743cd38cded9491b074c65f3bb664ed4b7ac6/botocore-1.10.19-py2.py3-none-any.whl (4.2MB)
    0% |                                | 10kB 27.2MB/s eta 0:00:01
    0% |▏                               | 20kB 8.7MB/s eta 0:00:01
    0% |▎                               | 30kB 12.1MB/s eta 0:00:01
    0% |▎                               | 40kB 10.2MB/s eta 0:00:01
---
[00:06:27]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:06:27]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:06:29]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:06:30]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:06:30] error[E0425]: cannot find value `path_segments` in this scope
[00:06:30]    --> librustc_resolve/macros.rs:469:24
[00:06:30]     |
[00:06:30] 469 |                 .push((path_segments.into_boxed_slice(), span));
[00:06:30] 
[00:06:33] error: aborting due to previous error
[00:06:33] 
[00:06:33] For more information about this error, try `rustc --explain E0425`.
[00:06:33] For more information about this error, try `rustc --explain E0425`.
[00:06:33] error: Could not compile `rustc_resolve`.
[00:06:33] 
[00:06:33] Caused by:
[00:06:33]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_resolve librustc_resolve/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,metadata -C prefer-dynamic -C debug-assertions=off -C overflow-checks=on -C metadata=a0f48aa432a99101 -C extra-filename=-a0f48aa432a99101 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-859e7ef7a6cf25eb.rmeta --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-c47a7799a87f795e.rmeta --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-2560933221fde227.rmeta --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-b70225e395c9707a.rmeta --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-f3f5c7806b6ab2a3.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-f94e6b9bfd8025fa.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-9fd067218c2c9169.rmeta -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-ffd9dcc5ce13143f/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-41d448831c9d08f1/out` (exit code: 101)
[00:07:01] error: build failed
[00:07:01] error: build failed
[00:07:01] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:07:01] travis_fold:end:stage0-rustc


[00:07:01] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:07:01] travis_time:end:stage0-rustc:start=1526004596719599539,finish=1526004762565331279,duration=165845731740

[00:07:01] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
[00:07:01] Build completed unsuccessfully in 0:06:13

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)

1 similar comment
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-debug of your PR failed on Travis (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.
    100% |████████████████████████████████| 61kB 5.5MB/s 
Collecting botocore==1.10.19 (from awscli)
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading https://files.pythonhosted.org/packages/34/05/1ffe77f2b8fb03a9223f3d0743cd38cded9491b074c65f3bb664ed4b7ac6/botocore-1.10.19-py2.py3-none-any.whl (4.2MB)
    0% |                                | 10kB 27.2MB/s eta 0:00:01
    0% |▏                               | 20kB 8.7MB/s eta 0:00:01
    0% |▎                               | 30kB 12.1MB/s eta 0:00:01
    0% |▎                               | 40kB 10.2MB/s eta 0:00:01
---
[00:06:27]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:06:27]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:06:29]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:06:30]    Compiling rustc_resolve v0.0.0 (file:///checkout/src/librustc_resolve)
[00:06:30] error[E0425]: cannot find value `path_segments` in this scope
[00:06:30]    --> librustc_resolve/macros.rs:469:24
[00:06:30]     |
[00:06:30] 469 |                 .push((path_segments.into_boxed_slice(), span));
[00:06:30] 
[00:06:33] error: aborting due to previous error
[00:06:33] 
[00:06:33] For more information about this error, try `rustc --explain E0425`.
[00:06:33] For more information about this error, try `rustc --explain E0425`.
[00:06:33] error: Could not compile `rustc_resolve`.
[00:06:33] 
[00:06:33] Caused by:
[00:06:33]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_resolve librustc_resolve/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,metadata -C prefer-dynamic -C debug-assertions=off -C overflow-checks=on -C metadata=a0f48aa432a99101 -C extra-filename=-a0f48aa432a99101 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-859e7ef7a6cf25eb.rmeta --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-c47a7799a87f795e.rmeta --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-2560933221fde227.rmeta --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-b70225e395c9707a.rmeta --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-f3f5c7806b6ab2a3.rmeta --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-f94e6b9bfd8025fa.rmeta --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-9fd067218c2c9169.rmeta -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-ffd9dcc5ce13143f/out/.libs -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-41d448831c9d08f1/out` (exit code: 101)
[00:07:01] error: build failed
[00:07:01] error: build failed
[00:07:01] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:07:01] travis_fold:end:stage0-rustc


[00:07:01] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:07:01] travis_time:end:stage0-rustc:start=1526004596719599539,finish=1526004762565331279,duration=165845731740

[00:07:01] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
[00:07:01] Build completed unsuccessfully in 0:06:13

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)

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 11, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 of your PR failed on Travis (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.
[00:24:30]    Compiling rustc_msan v0.0.0 (file:///checkout/src/librustc_msan)
[00:24:30]    Compiling rustc_asan v0.0.0 (file:///checkout/src/librustc_asan)
[00:24:32]    Compiling rustc_tsan v0.0.0 (file:///checkout/src/librustc_tsan)
[00:24:32]    Compiling rustc_lsan v0.0.0 (file:///checkout/src/librustc_lsan)
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]   --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]    |
[00:25:23] 47 |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 75 |         int_to_float!(i, i32, f32)
[00:25:23]    |         -------------------------- in this macro invocation
[00:25:23]    |
[00:25:23]    = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]   --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]    |
[00:25:23] 47 |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 80 |         int_to_float!(i, i32, f64)
[00:25:23]    |         -------------------------- in this macro invocation
[00:25:23]    |
[00:25:23]    = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]   --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]    |
[00:25:23] 47 |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 91 |             int_to_float!(i, i64, f64)
[00:25:23]    |             -------------------------- in this macro invocation
[00:25:23]    |
[00:25:23]    = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]   --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]    |
[00:25:23] 47 |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 97 |         int_to_float!(i, i128, f32)
[00:25:23]    |         --------------------------- in this macro invocation
[00:25:23]    |
[00:25:23]    = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]    --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]     |
[00:25:23] 47  |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 102 |         int_to_float!(i, i128, f64)
[00:25:23]     |         --------------------------- in this macro invocation
[00:25:23]     |
[00:25:23]     = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]    --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]     |
[00:25:23] 47  |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 107 |         int_to_float!(i, u32, f32)
[00:25:23]     |         -------------------------- in this macro invocation
[00:25:23]     |
[00:25:23]     = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value`
[00:25:23]    --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:47:23
[00:25:23]     |
[00:25:23] 47  |                 ((a & <$ity as Int>::UnsignedInt::max_value()).wrapping_shl((n + mant_dig_plus_two) - sd) != 0) as <$ity as Int>::UnsignedInt
[00:25:23] ...
[00:25:23] ...
[00:25:23] 112 |         int_to_float!(i, u32, f64)
[00:25:23]     |         -------------------------- in this macro invocation
[00:25:23]     |
[00:25:23]     = note: can't use a type alias as a constructor
[00:25:23] 
[00:25:23] error[E0423]: expected function, found associated type `Int::UnsignedInt::max_value^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[00:25:23] ...
[00:25:23] 130 |         int_to_float!(i, u128, f64)
[00:25:23]     |         --------------------------- in this macro invocation
[00:25:23]     |
[00:25:23]     = note: can't use a type alias as a constructor
[00:25:25] error: aborting due to 9 previous errors
[00:25:25] 
[00:25:25] For more information about this error, try `rustc --explain E0423`.
[00:25:25] error: Could not compile `compiler_builtins`.
[00:25:25] error: Could not compile `compiler_builtins`.
[00:25:25] 
[00:25:25] Caused by:
[00:25:25]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name compiler_builtins rustc/compiler_builtins_shim/../../libcompiler_builtins/src/lib.rs --color always --error-format json --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg feature="c" --cfg feature="compiler-builtins" --cfg feature="default" --cfg feature="rustbuild" -C metadata=b4e196030fb3059f -C extra-filename=-b4e196030fb3059f --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-07c899b6c3d44697.rlib -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-3c62409c53174beb/out --cfg use_c -l static=compiler-rt` (exit code: 101)
[00:25:25] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:25:25] expected success, got: exit code: 101
[00:25:25] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:25:25] travis_fold:end:stage1-std

[00:25:25] travis_time:end:stage1-std:start=1526051846241512344,finish=1526051915849613440,duration=69608101096


[00:25:25] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:25:25] Build completed unsuccessfully in 0:20:05
[00:25:25] make: *** [all] Error 1
[00:25:25] Makefile:28: recipe for target 'all' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:259d81e8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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)

@IsaacWoods
Copy link
Contributor Author

This now compiles locally; Travis looks unrelated? Should I squash the commits?

@Manishearth
Copy link
Member

Yeah, squash. Those errors do look like they could possibly be the result of a broken resolution, though.

let path = ResolvePath {
segments: &path,
source: None,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: could you use one-line formatting for all these ResolvePath { ... } constructors?

@bors
Copy link
Contributor

bors commented May 17, 2018

☔ The latest upstream changes (presumably #50665) made this pull request unmergeable. Please resolve the merge conflicts.

@pietroalbini
Copy link
Member

Ping from triage @IsaacWoods! It's been a while since we heard from you, will you have time to work on this again soon?

@IsaacWoods
Copy link
Contributor Author

Still not sure what I've broken, and very busy with school atm, so I'll try to get some time in but can't promise anything. Sorry :/

@pietroalbini
Copy link
Member

Don't worry if you don't have time right now, just wanted to check in to make sure the PR is still on your radar :). Someone from triage will ping you ~weekly, if you reply we won't close the PR for inactivity.

As far as the broken things, maybe @Manishearth or @petrochenkov can give you some hints on how to debug them?

));
}

let result = match self.resolve_path(&path, Some(ns), true, span, Some(id)) {
let result = match self.resolve_path(&path, Some(ns), true, span) {
Copy link
Member

Choose a reason for hiding this comment

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

the path here is incorrect and probably is the cause of the bug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the source is incorrect? Redefining the path aslet path = ResolvePath { segments: path.segments, source: Some(id) }; before that line has no effect, however.

Copy link
Member

Choose a reason for hiding this comment

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

oh sorry, I didn't notice the scopes here

@shepmaster
Copy link
Member

This is your weekly triage ping to make sure you are still aware of this! Still planning on getting back to this?

@pietroalbini
Copy link
Member

Thank you for this PR @IsaacWoods! Unfortunately we haven't heard from you on this in a while, so I'm closing the PR to keep things tidy. Don't worry though, if you'll have time again in the future please reopen this PR, we'll be happy to review it again!

@pietroalbini pietroalbini added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create abstraction over paths for use in librustc_resolve
9 participants