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

Stability annotations on generic parameters (take 2) #72314

Closed

Conversation

Avi-D-coder
Copy link
Contributor

@Avi-D-coder Avi-D-coder commented May 18, 2020

This is a followup of #65083 as an implementation of rust-lang/wg-allocators#2.
It's the same logic, but in one commit (to avoid rebasing).
It does not contain all of @varkor's clarifying comments and typo fixes.

This is still WIP, I'll summarize what works and followup on #65083 (comment) soon.

@rust-highfive
Copy link
Collaborator

r? @estebank

(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 May 18, 2020
@rust-highfive rust-highfive assigned varkor and unassigned estebank May 18, 2020
@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.
##[section]Starting: Linux mingw-check
##[section]Starting: Initialize job
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az578'
Current agent version: '2.168.2'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200430.2
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200430.2/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/6e7f5e9f-7cb2-40c0-8f30-594397578bb6.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72314/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[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/72314/merge:refs/remotes/pull/72314/merge
---
 ---> 3adb0605cc65
Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
 ---> Using cache
 ---> 28dbc326cb7f
Step 7/7 : ENV SCRIPT python3 ../x.py test src/tools/expand-yaml-anchors &&            python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python3 ../x.py build --stage 0 src/tools/build-manifest &&            python3 ../x.py test --stage 0 src/tools/compiletest &&            python3 ../x.py test src/tools/tidy &&            python3 ../x.py doc --stage 0 src/libstd &&            /scripts/validate-toolstate.sh
 ---> 537a01811900
Successfully built 537a01811900
Successfully tagged rust-ci:latest
Built container sha256:537a018119009dc218456238dec90b5530050db1e2a1e166550c218003f6159d
---
    Checking rustc_feature v0.0.0 (/checkout/src/librustc_feature)
    Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
    Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
    Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
    Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
    Checking chalk-rust-ir v0.10.0
    Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
    Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
    Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
configure: rust.codegen-units-std := 1
configure: rust.verify-llvm-ir  := True
configure: build.cargo-native-static := True
configure: llvm.ccache          := sccache
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
Hugepagesize:       2048 kB
DirectMap4k:      120768 kB
DirectMap2M:     6170624 kB
DirectMap1G:     3145728 kB
+ python3 ../x.py test src/tools/expand-yaml-anchors
Ensuring the YAML anchors in the GitHub Actions config were expanded
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building stage0 tool expand-yaml-anchors (x86_64-unknown-linux-gnu)
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.11
   Compiling linked-hash-map v0.5.2
   Compiling lazy_static v1.4.0
   Compiling lazy_static v1.4.0
   Compiling yaml-rust v0.4.3
   Compiling quote v1.0.2
   Compiling thiserror-impl v1.0.5
   Compiling thiserror v1.0.5
   Compiling yaml-merge-keys v0.4.0
   Compiling expand-yaml-anchors v0.1.0 (/checkout/src/tools/expand-yaml-anchors)
Build completed successfully in 0:00:29
+ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu
    Finished dev [unoptimized] target(s) in 0.18s
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> i686-pc-windows-gnu)
---
    Checking rustc_feature v0.0.0 (/checkout/src/librustc_feature)
    Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
    Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
    Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
    Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
    Checking chalk-rust-ir v0.10.0
    Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
    Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
    Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling cargo_metadata v0.9.1
   Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
    Finished release [optimized] target(s) in 25.12s
tidy check
tidy error: /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:35: line longer than 100 chars
tidy error: /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:36: line longer than 100 chars
some tidy checks failed
Found 493 error codes
Found 0 error codes with no tests
Done!
Done!


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
Build completed unsuccessfully in 0:00:41
Build completed unsuccessfully in 0:00:41
== clock drift check ==
  local time: Mon May 18 03:30:55 UTC 2020
  network time: Mon, 18 May 2020 03:30:56 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72314/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72314/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3948) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

2020-05-18T03:30:47.9766891Z tidy error: /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:35: line longer than 100 chars
2020-05-18T03:30:47.9768337Z tidy error: /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:36: line longer than 100 chars

The code changes look reasonable on my end. Depending on merge order, this will conflict with #71481 and cause one of the two to need a rebase.

CC @petrochenkov who might have extra thoughts on the approach.

src/librustc_metadata/rmeta/encoder.rs Show resolved Hide resolved
src/librustc_passes/stability.rs Show resolved Hide resolved
@Avi-D-coder Avi-D-coder changed the title Stability annotations on generic parameters (take 2) WIP: Stability annotations on generic parameters (take 2) May 20, 2020
@TimDiekmann
Copy link
Member

TimDiekmann commented May 21, 2020

NB: It's now possible to convert a pull request to a draft, so you don't have to mess around with the WIP-prefix:
image

@Avi-D-coder Avi-D-coder marked this pull request as draft May 21, 2020 23:13
Co-authored-by: Tim Diekmann <21277928+TimDiekmann@users.noreply.github.com>
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 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.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 4'
Agent machine name: 'fv-az578'
Current agent version: '2.169.0'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/dc904934-aa13-43f1-a064-44b2ab999810.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72314/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[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/72314/merge:refs/remotes/pull/72314/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
...........................................................................i........................ 1800/10219
.................................................................................................... 1900/10219
..............................................................................................i..i.. 2000/10219
.................................................................................................... 2100/10219
....................................................................................iiiii........... 2200/10219
.................................................................................................... 2400/10219
.................................................................................................... 2500/10219
.................................................................................................... 2600/10219
.................................................................................................... 2700/10219
---
..........i...............i......................................................................... 5200/10219
.................................................................................................... 5300/10219
.........................................................i.......................................... 5400/10219
..................................................i................................................. 5500/10219
............................................................ii.ii........i...i...................... 5600/10219
..i................................................................................................. 5800/10219
..........i......................................................................................... 5900/10219
..............................................................ii.................................... 6000/10219
.i.................................................................................................. 6100/10219
.i.................................................................................................. 6100/10219
.................................................................................................... 6200/10219
.................................................................................................... 6300/10219
.......................ii...i..ii...........i....................................................... 6400/10219
.................................................................................................... 6600/10219
.................................................................................................... 6700/10219
.................................................................................................... 6700/10219
........................................................i..ii....................................... 6800/10219
.................................................................................................... 7000/10219
.................................................................................................... 7100/10219
..........i......................................................................................... 7200/10219
.................................................................................................... 7300/10219
---
.................................................................................................... 8100/10219
.................................................................................................... 8200/10219
.................................................................................................... 8300/10219
...................................i................................................................ 8400/10219
.........................................................................................iii.iiiiiii 8500/10219
ii.i................................................................................................ 8600/10219
.................................................................................................... 8800/10219
...................................F................................................................ 8900/10219
.................................................................................................... 9000/10219
.................................................................................................... 9100/10219
---
21    |             ^^^^^


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stability-attribute/generics-default-stability/generics-default-stability.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args stability-attribute/generics-default-stability.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/stability-attribute/generics-default-stability.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stability-attribute/generics-default-stability" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stability-attribute/generics-default-stability/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:16:13
   |
LL | impl Trait1<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:20:13
   |
LL | impl Trait1<isize> for S { //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:24:13
   |
LL | impl Trait2<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error: aborting due to 3 previous errors
---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 0:59:07
Build completed unsuccessfully in 0:59:07
== clock drift check ==
  local time: Sat May 23 21:24:23 UTC 2020
  network time: Sat, 23 May 2020 21:24:23 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72314/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72314/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3957) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 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.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Azure Pipelines 69'
Agent machine name: 'fv-az578'
Current agent version: '2.169.0'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.2)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/e6219f53-1978-41ad-bf03-3a0546468dad.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72314/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[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/72314/merge:refs/remotes/pull/72314/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
...........................................................................i........................ 1800/10220
.................................................................................................... 1900/10220
..............................................................................................i..i.. 2000/10220
.................................................................................................... 2100/10220
....................................................................................iiiii........... 2200/10220
.................................................................................................... 2400/10220
.................................................................................................... 2500/10220
.................................................................................................... 2600/10220
.................................................................................................... 2700/10220
---
..........i...............i......................................................................... 5200/10220
.................................................................................................... 5300/10220
.........................................................i.......................................... 5400/10220
..................................................i................................................. 5500/10220
.............................................................ii.ii........i...i..................... 5600/10220
...i................................................................................................ 5800/10220
...........i........................................................................................ 5900/10220
...............................................................ii................................... 6000/10220
..i................................................................................................. 6100/10220
..i................................................................................................. 6100/10220
.................................................................................................... 6200/10220
.................................................................................................... 6300/10220
........................ii...i..ii...........i...................................................... 6400/10220
.................................................................................................... 6600/10220
.................................................................................................... 6700/10220
.................................................................................................... 6700/10220
.........................................................i..ii...................................... 6800/10220
.................................................................................................... 7000/10220
.................................................................................................... 7100/10220
...........i........................................................................................ 7200/10220
.................................................................................................... 7300/10220
---
.................................................................................................... 8100/10220
.................................................................................................... 8200/10220
.................................................................................................... 8300/10220
....................................i............................................................... 8400/10220
..........................................................................................iiiiii.iii 8500/10220
iii.i............................................................................................... 8600/10220
.................................................................................................... 8800/10220
....................................F............................................................... 8900/10220
.................................................................................................... 9000/10220
.................................................................................................... 9100/10220
---
- error: aborting due to 3 previous errors
+ error[E0658]: use of unstable library feature 'unstable_default'
+   --> $DIR/generics-default-stability.rs:37:20
+    |
+ LL |     let _: Struct1<isize> = Struct1 { field: 1 };
+    |
+    = help: add `#![feature(unstable_default)]` to the crate attributes to enable
+ 
+ error[E0658]: use of unstable library feature 'unstable_default'
---
28 


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stability-attribute/generics-default-stability/generics-default-stability.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args stability-attribute/generics-default-stability.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/stability-attribute/generics-default-stability.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stability-attribute/generics-default-stability" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stability-attribute/generics-default-stability/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:16:13
   |
LL | impl Trait1<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:20:13
   |
LL | impl Trait1<isize> for S { //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:24:13
   |
LL | impl Trait2<usize> for S { //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:37:20
   |
LL |     let _: Struct1<isize> = Struct1 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:41:20
   |
LL |     let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'unstable_default'
error[E0658]: use of unstable library feature 'unstable_default'
  --> /checkout/src/test/ui/stability-attribute/generics-default-stability.rs:42:20
   |
LL |     let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature 'unstable_default'
   |
   = help: add `#![feature(unstable_default)]` to the crate attributes to enable

error: aborting due to 6 previous errors
---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:05:52
Build completed unsuccessfully in 1:05:52
== clock drift check ==
  local time: Sat May 23 23:25:14 UTC 2020
  network time: Sat, 23 May 2020 23:25:14 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72314/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72314/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (3729) (python)
##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@Avi-D-coder
Copy link
Contributor Author

Avi-D-coder commented May 26, 2020

This is a followup to @varkor's #65083 (comment)

If I remember correctly, we essentially want to force unstabilised defaults to be used when their feature flag is not enabled

This is insufficient, we also must prevent reliance on the default type (see bellow).

These are the tests that should produce a error, but don't yet.
What do you think about returning a dummy unstable type when the default is unstable in the |substs, param, infer_args| closure passed to create_substs_for_generic_args?

    let _ = Struct1 { field: 1 }; // ERROR use of unstable library feature 'unstable_default'
    let _: Struct1 = Struct1 { field: 1 }; // ERROR use of unstable library feature 'unstable_default'
    let _: usize = STRUCT1.field; // ERROR use of unstable library feature 'unstable_default'
    let _ = STRUCT1.field + 1; // ERROR use of unstable library feature 'unstable_default'

@varkor
Copy link
Member

varkor commented May 27, 2020

This is insufficient, we also must prevent reliance on the default type (see bellow).

Why is this? As long as, to the user, it's completely opaque (i.e. as if the default was hard-coded), then it's okay for the user to rely on the explicit type, no?

@Avi-D-coder
Copy link
Contributor Author

STRUCT1.field + 1usize could be written in stable code, so changing the default to isize is a breaking change. It also stabilizes the existence of the type parameter making Box<T, SystemAlloc> to Box<T> a breaking revision.

@varkor
Copy link
Member

varkor commented May 31, 2020

My understanding is that we're never going to change the default type: we want to experiment with allowing users to change the type. We can't prevent people relying on the specific type of a generic parameter. If users should not rely on a concrete type, this should be hidden by the API. It would be a breaking change in general to change the default type, stable or not.

@Avi-D-coder
Copy link
Contributor Author

Avi-D-coder commented May 31, 2020

What if we want to remove the parameter after trying it?
If the user can depend on the type without using the feature then as soon as we try adding it to a type like Box, it's stabilized.

@varkor
Copy link
Member

varkor commented May 31, 2020

I imagine that the situation is like this: we have a type Foo with some internal workings, which we want to make configurable, so we add a default type parameter Foo<X = Bar>. Now Foo<Bar> acts identically to the original Foo, so if it is reverted, it won't break any users. However, unstably users can try Foo<X = Baz>, which gives them more flexibility. If the parameter is later removed, unstable users will break, but stable ones won't, because the defaulted parameter is equivalent to no parameter.

Is there a situation you can think of where this won't be the case?

@TimDiekmann
Copy link
Member

That's exactly the use case why we want this feature.

@Avi-D-coder
Copy link
Contributor Author

@varkor Your right this does seem to be sufficient for the allocators use case.
I'm still concerned that someone will erroneously add a unstable annotation to a generic parameter used in a public field expecting the fields type to be unstable.

@varkor
Copy link
Member

varkor commented Jun 1, 2020

I think the same proviso applies for anything regarding stability: it can be easy to accidentally make something stable. I think we have to rely on reviewers to catch these sorts of issues, though: I'm not sure how we could feasibly prevent it from the compiler's perspective.

@TimDiekmann
Copy link
Member

I'm not sure how we could feasibly prevent it from the compiler's perspective.

Is it possible in an easy way if the unstable type is used as public field?

Anyway, public fields are not very common in the std-library and this also applies to getters, I'd leave out those checks.

@varkor
Copy link
Member

varkor commented Jul 20, 2020

I've commented on rust-lang/wg-allocators#2 (comment). If there are no concerns raised, I'll approve this PR in a couple of days (to give people time to respond). I think all of my concerns have been addressed now, and that this is a workable design.

@TimDiekmann
Copy link
Member

TimDiekmann commented Jul 22, 2020

Many thanks to @Avi-D-coder and @varkor to make this possible. I think this is a big step!

I have no concerns about the implementation. I don't think that it is easily possible to forbid the exposure of a type parameter, no matter if by a constructor or a getter/setter. This is basically like exposing API internals. I think that in most (all?) cases when using unstable type parameters, the API that uses this type parameter is also unstable (for example Vec::<T, AllocRef>::new_in).

@bors
Copy link
Contributor

bors commented Jul 24, 2020

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

@varkor
Copy link
Member

varkor commented Jul 24, 2020

@Avi-D-coder: just noticed that the tests don't cover unstable type defaults on enums or type aliases. Could you add a couple of those, and rebase, and then I'll approve!

@TimDiekmann TimDiekmann mentioned this pull request Aug 5, 2020
18 tasks
@Dylan-DPC-zz
Copy link

@Avi-D-coder any updates on this?

@Avi-D-coder
Copy link
Contributor Author

@Dylan-DPC been exceptionally busy, I'll try to take a look this weekend.

@Dylan-DPC-zz
Copy link

No worries, can understand :) Thanks for the update

@crlf0710
Copy link
Member

Ping from triage, there's merge conflicts now.

@crlf0710 crlf0710 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 28, 2020
@Avi-D-coder
Copy link
Contributor Author

Yeah I started resolving them, but couldn't finish it with limited time.

@crlf0710
Copy link
Member

@Avi-D-coder Ping from triage, any updates on this?

@crlf0710 crlf0710 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2020
@exrook
Copy link
Contributor

exrook commented Sep 23, 2020

Hi @Avi-D-coder, I've rebased your changes on the latest master here https://github.com/exrook/rust/tree/stability-generic-parameters-2

@varkor I've also tried adding some tests for type aliases and enums, see this commit: exrook@98eab09 Let me know if there's any cases I've missed, I basically just duplicated the struct tests for enums and aliases.

@varkor
Copy link
Member

varkor commented Sep 23, 2020

@exrook: thanks, that looks great! If you open up a new pull request with those changes, I can approve that one (as @Avi-D-coder seems busy at the moment): the authors are tracked in the commits, so it doesn't matter so much which PR is merged.

@exrook
Copy link
Contributor

exrook commented Sep 23, 2020

@varkor Sure thing, here's the PR #77118

@varkor
Copy link
Member

varkor commented Sep 23, 2020

Closing in favour of #77118.

@varkor varkor closed this Sep 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2020
…, r=varkor

 Stability annotations on generic parameters (take 2.5)

Rebase of rust-lang#72314 + more tests

Implements rust-lang/wg-allocators#2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet