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

Range experiment #118769

Closed
wants to merge 6 commits into from
Closed

Range experiment #118769

wants to merge 6 commits into from

Conversation

pitaj
Copy link
Contributor

@pitaj pitaj commented Dec 9, 2023

Meant for a crater run to see how much breakage we can expect outside of the Iterator methods themselves

https://internals.rust-lang.org/t/pre-rfc-fixing-range-by-2027/19936

@rustbot
Copy link
Collaborator

rustbot commented Dec 9, 2023

r? @m-ou-se

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

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 9, 2023
@pitaj pitaj marked this pull request as draft December 9, 2023 05:44
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Built container sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Looks like docker image is the same as before, not uploading
https://ci-caches.rust-lang.org/docker/7ebc15c01a233894034d277c8cce4e949f4e7791f66b4727c8fb6e058a0b8171d6152e1441d677cef0653843ceeee469c097b8699b2bb74249e674f6aa1a8813
sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Sat Dec  9 06:22:03 UTC 2023
  network time: Sat, 09 Dec 2023 06:22:03 GMT
  network time: Sat, 09 Dec 2023 06:22:03 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-missing-tools', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: rust.codegen-units-std := 1
---
    Finished dev [unoptimized] target(s) in 0.03s
##[endgroup]
Skipping Set({test::src/tools/tidy}) because it is excluded
##[group]Building stage0 library artifacts (x86_64-unknown-linux-gnu)
    Updating git repository `https://github.com/pitaj/quote`
    Updating git repository `https://github.com/pitaj/rustc-rayon`
---
   Compiling instant v0.1.12
   Compiling thin-vec v0.2.12
   Compiling arrayvec v0.7.4
   Compiling crossbeam-channel v0.5.8
   Compiling quote v1.0.33 (https://github.com/pitaj/quote#44feebf0)
   Compiling bitflags v1.3.2
   Compiling fastrand v2.0.0
   Compiling ena v0.14.2
   Compiling syn v2.0.32
---
   Compiling indexmap v2.0.0
   Compiling cranelift-codegen v0.102.0
   Compiling gimli v0.28.0
   Compiling object v0.32.0
error[E0277]: the trait bound `core::ops::RangeInclusive<u8>: ExactSizeIterator` is not satisfied
   --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.102.0/src/isa/x64/encoding/evex.rs:264:40
    |
264 |         assert!(ExactSizeIterator::len(&range) > 0);
    |                 ---------------------- ^^^^^^ the trait `ExactSizeIterator` is not implemented for `core::ops::RangeInclusive<u8>`
    |                 required by a bound introduced by this call
    |
    = help: the following other types implement trait `ExactSizeIterator`:
              smallvec::Drain<'a, T>
              smallvec::Drain<'a, T>
              cranelift_entity::Iter<'a, K, V>
              cranelift_entity::IterMut<'a, K, V>
              cranelift_entity::iter::IntoIter<K, V>
              cranelift_entity::Keys<K>
              smallvec::IntoIter<A>
              alloc::boxed::Box<I, A>
              hashbrown::raw::RawIter<T>

For more information about this error, try `rustc --explain E0277`.
The following warnings were emitted during compilation:


warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
error: could not compile `cranelift-codegen` (lib) due to previous error
Build completed unsuccessfully in 0:03:05
  local time: Sat Dec  9 06:25:43 UTC 2023
  network time: Sat, 09 Dec 2023 06:25:43 GMT

@Noratrieb
Copy link
Member

Noratrieb commented Dec 9, 2023

Is there any way a crater run outcome could affect your suggested changes? From the patches you had to make all over the place here it's obvious that this cannot be done in a breaking way. And if we're doing it in a non-breaking (edition) way, then I don't think it matters how many people rely on it today.

@pitaj
Copy link
Contributor Author

pitaj commented Dec 9, 2023

@Nilstrieb my intention here is to just get information. This PR is full of breaking changes and is not meant to be merged. I fully intend to follow up with an RFC that specifies how we can make this change on an edition boundary.

In the linked IRLO topic, @tgross35 suggested the crater run:

It would be interesting to do a crater run with the changed impls to have an idea of how widespread the effects are.

I added every iterator method to the range types so that we will only see type errors. And I set this up with deprecation warnings so we can evaluate how many cases use mutating methods.

Essentially the idea is to evaluate how much manual intervention will be necessary to transition from old range to new range. What I've encountered while working on this and what we find with the crater run will inform the RFC.

@Noratrieb
Copy link
Member

I'm still not sure whether this is actually useful, but if you think so:
@bors try

@Noratrieb
Copy link
Member

Oh I forgot that it still doesn't bootstrap fully, gotta fix that first

@bors
Copy link
Contributor

bors commented Dec 11, 2023

⌛ Trying commit f74b74c with merge e557d29...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2023
Range experiment

Meant for a crater run to see how much breakage we can expect outside of the Iterator methods themselves

https://internals.rust-lang.org/t/pre-rfc-fixing-range-by-2027/19936
@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-linux failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING] core::build_steps::compile::Assemble { target_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu } } -- 0.000
[TIMING] core::build_steps::compile::Sysroot { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu }, force_recompile: false } -- 0.000
[TIMING] core::builder::Builder::sysroot_libdir::Libdir { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu } -- 0.000
##[group]Building stage0 tool opt-dist (x86_64-unknown-linux-gnu)
    Updating git repository `https://github.com/pitaj/quote`
    Updating git repository `https://github.com/pitaj/rustc-rayon`
---
[RUSTC-TIMING] build_script_build test:false 0.093
[RUSTC-TIMING] utf8parse test:false 0.040
   Compiling openssl-probe v0.1.5
[RUSTC-TIMING] pkg_config test:false 0.642
   Compiling quote v1.0.33 (https://github.com/pitaj/quote#44feebf0)
   Compiling bitflags v2.4.0
[RUSTC-TIMING] slab test:false 0.132
[RUSTC-TIMING] openssl_probe test:false 0.210
   Compiling try-lock v0.2.4
---
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu, tool: "opt-dist", path: "src/tools/opt-dist", mode: ToolBootstrap, is_optional_tool: false, source_type: InTree, extra_features: [], allow_features: "" } -- 40.093
[TIMING] core::build_steps::tool::OptimizedDist { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu } -- 0.000
Build completed successfully in 0:00:41
+ ./build/x86_64-unknown-linux-gnu/stage0-tools-bin/opt-dist linux-ci -- python3 ../x.py dist --host x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu --include-default-paths build-manifest bootstrap
[2023-12-11T13:53:48.166Z INFO  opt_dist] Skipping building of unimportant components for a try build
---
[RUSTC-TIMING] bitflags test:false 0.031
   Compiling crossbeam-channel v0.5.8
   Compiling fastrand v2.0.0
[RUSTC-TIMING] build_script_main test:false 0.452
   Compiling quote v1.0.33 (https://github.com/pitaj/quote#44feebf0)
   Compiling hashbrown v0.14.3
[RUSTC-TIMING] ahash test:false 0.223
[RUSTC-TIMING] lock_api test:false 0.198
[RUSTC-TIMING] arrayvec test:false 0.191
---
[RUSTC-TIMING] build_script_build test:false 0.161
[RUSTC-TIMING] regalloc2 test:false 1.850
[RUSTC-TIMING] gimli test:false 3.740
[RUSTC-TIMING] object test:false 4.521
error[E0277]: the trait bound `core::ops::RangeInclusive<u8>: ExactSizeIterator` is not satisfied
   --> /rust/deps/cranelift-codegen-0.102.0/src/isa/x64/encoding/evex.rs:264:40
    |
264 |         assert!(ExactSizeIterator::len(&range) > 0);
    |                 ---------------------- ^^^^^^ the trait `ExactSizeIterator` is not implemented for `core::ops::RangeInclusive<u8>`
    |                 required by a bound introduced by this call
    |
    = help: the following other types implement trait `ExactSizeIterator`:
              smallvec::Drain<'a, T>
              smallvec::Drain<'a, T>
              cranelift_entity::Iter<'a, K, V>
              cranelift_entity::IterMut<'a, K, V>
              cranelift_entity::iter::IntoIter<K, V>
              cranelift_entity::Keys<K>
              smallvec::IntoIter<A>
              alloc::boxed::Box<I, A>
              hashbrown::raw::RawIter<T>

For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] cranelift_codegen test:false 6.586
The following warnings were emitted during compilation:
The following warnings were emitted during compilation:

warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: [email protected]: Failed to run `rustfmt` on ISLE-generated code: Os { code: 2, kind: NotFound, message: "No such file or directory" }
error: could not compile `cranelift-codegen` (lib) due to previous error
Build completed unsuccessfully in 0:04:43
[2023-12-11T13:58:55.892Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO) > Build PGO instrumented rustc and LLVM` ended: FAIL (283.95s)`
[2023-12-11T13:58:55.892Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO)` ended: FAIL (283.95s)`
---
Caused by:
    Command RUST_BACKTRACE=full python3 /checkout/x.py build --target x86_64-unknown-linux-gnu --host x86_64-unknown-linux-gnu --stage 2 library/std --rust-profile-generate /tmp/tmp-multistage/opt-artifacts/rustc-pgo --set llvm.thin-lto=false --set llvm.link-shared=true [at /checkout/obj] has failed with exit code Some(1)

Stack backtrace:
   0: <opt_dist::exec::CmdBuilder>::run
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/exec.rs:78:17
   1: <opt_dist::exec::Bootstrap>::run
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/exec.rs:179:9
   2: opt_dist::execute_pipeline::{closure#1}::{closure#0}
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/main.rs:210:13
      <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}::{closure#0}, ()>
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/timer.rs:111:22
      opt_dist::execute_pipeline::{closure#1}
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/main.rs:199:9
      <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/timer.rs:111:22
      opt_dist::execute_pipeline
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/main.rs:196:29
             at /rustc/e557d29a0c842339d68661119d209619020166f7/src/tools/opt-dist/src/main.rs:385:18
   4: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/ops/function.rs:250:5
             at /rustc/782883f609713fe9617ba64d90086742ec62d374/library/core/src/ops/function.rs:250:5
      std::sys_common::backtrace::__rust_begin_short_backtrace::<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
   5: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
             at /rustc/782883f609713fe9617ba64d90086742ec62d374/library/std/src/rt.rs:167:18
             at /rustc/782883f609713fe9617ba64d90086742ec62d374/library/std/src/rt.rs:167:18
   6: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
      std::panicking::try::do_call
             at /rustc/782883f609713fe9617ba64d90086742ec62d374/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/782883f609713fe9617ba64d90086742ec62d374/library/std/src/panicking.rs:516:19

@bors
Copy link
Contributor

bors commented Dec 11, 2023

💔 Test failed - checks-actions

@bors bors 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 Dec 11, 2023
@bors
Copy link
Contributor

bors commented Dec 15, 2023

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

@pitaj pitaj closed this Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants