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

Use T's discriminant type in mem::Discriminant<T> instead of u64. #70705

Merged
merged 8 commits into from
May 21, 2020

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 2, 2020

fixes #70509

Adds the lang-item discriminant_kind.
Updates the function signature of intrinsics::discriminant_value.
Adds the probably permanently unstable trait DiscriminantKind.
mem::Discriminant should now be smaller in some cases.

r? @ghost

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@Dylan-DPC-zz
Copy link

r? @eddyb

@eddyb
Copy link
Member

eddyb commented Apr 3, 2020

This adds an entire built-in trait impl, complete with associated type, so I'll have to leave this to:
r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Apr 3, 2020
@Centril Centril added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Apr 3, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Apr 3, 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.
2020-04-05T11:52:10.1554387Z ========================== Starting Command Output ===========================
2020-04-05T11:52:10.1556620Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/c8c3be85-c073-428f-837d-ce228b68ea55.sh
2020-04-05T11:52:10.1557305Z 
2020-04-05T11:52:10.1561368Z ##[section]Finishing: Disable git automatic line ending conversion
2020-04-05T11:52:10.1579299Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70705/merge to s
2020-04-05T11:52:10.1582297Z Task         : Get sources
2020-04-05T11:52:10.1582583Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-04-05T11:52:10.1582861Z Version      : 1.0.0
2020-04-05T11:52:10.1583047Z Author       : Microsoft
---
2020-04-05T11:52:11.1553234Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-04-05T11:52:11.1557045Z ##[command]git config gc.auto 0
2020-04-05T11:52:11.1559480Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-04-05T11:52:11.1561725Z ##[command]git config --get-all http.proxy
2020-04-05T11:52:11.1565933Z ##[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/70705/merge:refs/remotes/pull/70705/merge
---
2020-04-05T11:54:16.0257091Z  ---> 3fc1b512c57b
2020-04-05T11:54:16.0257433Z Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
2020-04-05T11:54:16.0257896Z  ---> Using cache
2020-04-05T11:54:16.0287683Z  ---> 5ee4295733f4
2020-04-05T11:54:16.0290254Z Step 7/7 : ENV SCRIPT python2.7 ../x.py test src/tools/expand-yaml-anchors &&            python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python2.7 ../x.py build --stage 0 src/tools/build-manifest &&            python2.7 ../x.py test --stage 0 src/tools/compiletest &&            python2.7 ../x.py test src/tools/tidy &&            /scripts/validate-toolstate.sh
2020-04-05T11:54:16.0291682Z  ---> 3d07a0fa42fe
2020-04-05T11:54:16.0291958Z Successfully built 3d07a0fa42fe
2020-04-05T11:54:16.0293430Z Successfully tagged rust-ci:latest
2020-04-05T11:54:16.0518277Z Built container sha256:3d07a0fa42feb5754fc13bb2f7010ebe13e4b8b8cdbebed0c75d8da320c8c8ad
2020-04-05T11:54:16.0518277Z Built container sha256:3d07a0fa42feb5754fc13bb2f7010ebe13e4b8b8cdbebed0c75d8da320c8c8ad
2020-04-05T11:54:16.0532896Z Looks like docker image is the same as before, not uploading
2020-04-05T11:54:22.7528246Z [CI_JOB_NAME=mingw-check]
2020-04-05T11:54:22.7761669Z [CI_JOB_NAME=mingw-check]
2020-04-05T11:54:22.7785291Z == clock drift check ==
2020-04-05T11:54:22.7792609Z   local time: Sun Apr  5 11:54:22 UTC 2020
2020-04-05T11:54:23.0665953Z   network time: Sun, 05 Apr 2020 11:54:23 GMT
2020-04-05T11:54:23.0682804Z Starting sccache server...
2020-04-05T11:54:23.1425434Z configure: processing command line
2020-04-05T11:54:23.1425657Z configure: 
2020-04-05T11:54:23.1426364Z configure: rust.parallel-compiler := True
---
2020-04-05T11:55:42.4989655Z expected success, got: exit code: 101
2020-04-05T11:55:42.5000302Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2020-04-05T11:55:42.5000584Z Build completed unsuccessfully in 0:01:19
2020-04-05T11:55:42.5043282Z == clock drift check ==
2020-04-05T11:55:42.5058112Z   local time: Sun Apr  5 11:55:42 UTC 2020
2020-04-05T11:55:42.5704349Z   network time: Sun, 05 Apr 2020 11:55:42 GMT
2020-04-05T11:55:43.8086911Z 
2020-04-05T11:55:43.8086911Z 
2020-04-05T11:55:43.8139528Z ##[error]Bash exited with code '1'.
2020-04-05T11:55:43.8149117Z ##[section]Finishing: Run build
2020-04-05T11:55:43.8182363Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70705/merge to s
2020-04-05T11:55:43.8187157Z Task         : Get sources
2020-04-05T11:55:43.8187529Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-04-05T11:55:43.8187862Z Version      : 1.0.0
2020-04-05T11:55:43.8188092Z Author       : Microsoft
2020-04-05T11:55:43.8188092Z Author       : Microsoft
2020-04-05T11:55:43.8188466Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-04-05T11:55:43.8188978Z ==============================================================================
2020-04-05T11:55:44.0719778Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-04-05T11:55:44.0759617Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/70705/merge to s
2020-04-05T11:55:44.0822514Z Cleaning up task key
2020-04-05T11:55:44.0823426Z Start cleaning up orphan processes.
2020-04-05T11:55:44.0966341Z Terminate orphan process: pid (3768) (python)
2020-04-05T11:55:44.1130791Z ##[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 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.
2020-04-05T15:48:00.4253718Z ========================== Starting Command Output ===========================
2020-04-05T15:48:00.4256145Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/968f4f99-0c1d-4105-88c9-b36e7759bbea.sh
2020-04-05T15:48:00.4256416Z 
2020-04-05T15:48:00.4260071Z ##[section]Finishing: Disable git automatic line ending conversion
2020-04-05T15:48:00.4280927Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70705/merge to s
2020-04-05T15:48:00.4284268Z Task         : Get sources
2020-04-05T15:48:00.4284551Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-04-05T15:48:00.4284833Z Version      : 1.0.0
2020-04-05T15:48:00.4285018Z Author       : Microsoft
---
2020-04-05T15:48:01.6606866Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-04-05T15:48:01.6613984Z ##[command]git config gc.auto 0
2020-04-05T15:48:01.6620939Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-04-05T15:48:01.6627424Z ##[command]git config --get-all http.proxy
2020-04-05T15:48:01.6638652Z ##[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/70705/merge:refs/remotes/pull/70705/merge
---
2020-04-05T15:50:05.9595274Z  ---> 3fc1b512c57b
2020-04-05T15:50:05.9596774Z Step 6/7 : ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
2020-04-05T15:50:05.9597322Z  ---> Using cache
2020-04-05T15:50:05.9597725Z  ---> 5ee4295733f4
2020-04-05T15:50:05.9599406Z Step 7/7 : ENV SCRIPT python2.7 ../x.py test src/tools/expand-yaml-anchors &&            python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu &&            python2.7 ../x.py build --stage 0 src/tools/build-manifest &&            python2.7 ../x.py test --stage 0 src/tools/compiletest &&            python2.7 ../x.py test src/tools/tidy &&            /scripts/validate-toolstate.sh
2020-04-05T15:50:05.9603717Z  ---> 3d07a0fa42fe
2020-04-05T15:50:05.9639308Z Successfully built 3d07a0fa42fe
2020-04-05T15:50:05.9677177Z Successfully tagged rust-ci:latest
2020-04-05T15:50:05.9962266Z Built container sha256:3d07a0fa42feb5754fc13bb2f7010ebe13e4b8b8cdbebed0c75d8da320c8c8ad
2020-04-05T15:50:05.9962266Z Built container sha256:3d07a0fa42feb5754fc13bb2f7010ebe13e4b8b8cdbebed0c75d8da320c8c8ad
2020-04-05T15:50:05.9978721Z Looks like docker image is the same as before, not uploading
2020-04-05T15:50:12.7497572Z [CI_JOB_NAME=mingw-check]
2020-04-05T15:50:12.7798932Z [CI_JOB_NAME=mingw-check]
2020-04-05T15:50:12.7827842Z == clock drift check ==
2020-04-05T15:50:12.7839214Z   local time: Sun Apr  5 15:50:12 UTC 2020
2020-04-05T15:50:13.0483316Z   network time: Sun, 05 Apr 2020 15:50:13 GMT
2020-04-05T15:50:13.0510532Z Starting sccache server...
2020-04-05T15:50:13.1365378Z configure: processing command line
2020-04-05T15:50:13.1366002Z configure: 
2020-04-05T15:50:13.1367062Z configure: rust.parallel-compiler := True
---
2020-04-05T15:53:35.0915456Z     Checking rustc_feature v0.0.0 (/checkout/src/librustc_feature)
2020-04-05T15:53:35.2084018Z     Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
2020-04-05T15:53:35.4126750Z     Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
2020-04-05T15:53:35.4836006Z     Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
2020-04-05T15:53:35.9948918Z     Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
2020-04-05T15:53:38.1461660Z     Checking rustc_attr v0.0.0 (/checkout/src/librustc_attr)
2020-04-05T15:53:38.6033749Z     Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
2020-04-05T15:53:40.5056261Z     Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
2020-04-05T15:53:40.9296345Z     Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
2020-04-05T15:55:22.7871563Z configure: build.locked-deps    := True
2020-04-05T15:55:22.7872035Z configure: llvm.ccache          := sccache
2020-04-05T15:55:22.7872704Z configure: build.cargo-native-static := True
2020-04-05T15:55:22.7873368Z configure: dist.missing-tools   := True
2020-04-05T15:55:22.7874179Z configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
2020-04-05T15:55:22.7874967Z configure: writing `config.toml` in current directory
2020-04-05T15:55:22.7875371Z configure: 
2020-04-05T15:55:22.7875918Z configure: run `python /checkout/x.py --help`
2020-04-05T15:55:22.7876199Z configure: 
---
2020-04-05T15:56:39.8265240Z Hugepagesize:       2048 kB
2020-04-05T15:56:39.8265462Z DirectMap4k:      145344 kB
2020-04-05T15:56:39.8265670Z DirectMap2M:     3000320 kB
2020-04-05T15:56:39.8265878Z DirectMap1G:     6291456 kB
2020-04-05T15:56:39.8292638Z + python2.7 ../x.py test src/tools/expand-yaml-anchors
2020-04-05T15:56:41.1342232Z Ensuring the YAML anchors in the GitHub Actions config were expanded
2020-04-05T15:56:41.1342232Z Ensuring the YAML anchors in the GitHub Actions config were expanded
2020-04-05T15:56:41.1350803Z Building stage0 tool expand-yaml-anchors (x86_64-unknown-linux-gnu)
2020-04-05T15:56:41.3666882Z    Compiling unicode-xid v0.2.0
2020-04-05T15:56:41.4945019Z    Compiling syn v1.0.11
2020-04-05T15:56:42.2715244Z    Compiling linked-hash-map v0.5.2
2020-04-05T15:56:42.3406813Z    Compiling lazy_static v1.4.0
2020-04-05T15:56:42.3406813Z    Compiling lazy_static v1.4.0
2020-04-05T15:56:42.4909698Z    Compiling yaml-rust v0.4.3
2020-04-05T15:56:46.6237704Z    Compiling quote v1.0.2
2020-04-05T15:57:00.3294536Z    Compiling thiserror-impl v1.0.5
2020-04-05T15:57:04.9454309Z    Compiling thiserror v1.0.5
2020-04-05T15:57:05.0050447Z    Compiling yaml-merge-keys v0.4.0
2020-04-05T15:57:06.1120809Z    Compiling expand-yaml-anchors v0.1.0 (/checkout/src/tools/expand-yaml-anchors)
2020-04-05T15:57:07.6396951Z Build completed successfully in 0:00:27
2020-04-05T15:57:07.6403769Z + python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu
2020-04-05T15:57:07.8760048Z     Finished dev [unoptimized] target(s) in 0.17s
2020-04-05T15:57:08.9956474Z Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> i686-pc-windows-gnu)
---
2020-04-05T15:59:10.5019771Z     Checking rustc_feature v0.0.0 (/checkout/src/librustc_feature)
2020-04-05T15:59:10.7484648Z     Checking fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
2020-04-05T15:59:10.9308094Z     Checking rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
2020-04-05T15:59:10.9477443Z     Checking rustc_hir v0.0.0 (/checkout/src/librustc_hir)
2020-04-05T15:59:11.5240195Z     Checking rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
2020-04-05T15:59:13.6497971Z     Checking rustc_attr v0.0.0 (/checkout/src/librustc_attr)
2020-04-05T15:59:14.0979528Z     Checking rustc_parse v0.0.0 (/checkout/src/librustc_parse)
2020-04-05T15:59:16.0664062Z     Checking rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
2020-04-05T15:59:16.4858424Z     Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
2020-04-05T16:02:42.1954257Z    Compiling cargo_metadata v0.9.1
2020-04-05T16:02:45.7081460Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2020-04-05T16:02:55.9901604Z     Finished release [optimized] target(s) in 23.21s
2020-04-05T16:02:55.9996679Z tidy check
2020-04-05T16:02:59.9993161Z tidy error: /checkout/src/test/ui/generator/discriminant.rs:68: line longer than 100 chars
2020-04-05T16:03:05.3574333Z some tidy checks failed
2020-04-05T16:03:05.3577980Z Found 491 error codes
2020-04-05T16:03:05.3578648Z Found 0 error codes with no tests
2020-04-05T16:03:05.3579074Z Done!
2020-04-05T16:03:05.3579074Z Done!
2020-04-05T16:03:05.3581350Z 
2020-04-05T16:03:05.3581709Z 
2020-04-05T16:03:05.3583271Z 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"
2020-04-05T16:03:05.3584644Z 
2020-04-05T16:03:05.3584935Z 
2020-04-05T16:03:05.3589724Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2020-04-05T16:03:05.3590438Z Build completed unsuccessfully in 0:00:33
2020-04-05T16:03:05.3590438Z Build completed unsuccessfully in 0:00:33
2020-04-05T16:03:05.3637513Z == clock drift check ==
2020-04-05T16:03:05.3657771Z   local time: Sun Apr  5 16:03:05 UTC 2020
2020-04-05T16:03:05.8854445Z   network time: Sun, 05 Apr 2020 16:03:05 GMT
2020-04-05T16:03:07.4086996Z 
2020-04-05T16:03:07.4086996Z 
2020-04-05T16:03:07.4160755Z ##[error]Bash exited with code '1'.
2020-04-05T16:03:07.4180077Z ##[section]Finishing: Run build
2020-04-05T16:03:07.4227406Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70705/merge to s
2020-04-05T16:03:07.4231868Z Task         : Get sources
2020-04-05T16:03:07.4232195Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-04-05T16:03:07.4232496Z Version      : 1.0.0
2020-04-05T16:03:07.4232723Z Author       : Microsoft
2020-04-05T16:03:07.4232723Z Author       : Microsoft
2020-04-05T16:03:07.4233053Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-04-05T16:03:07.4233442Z ==============================================================================
2020-04-05T16:03:07.7361464Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-04-05T16:03:07.7409054Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/70705/merge to s
2020-04-05T16:03:07.7494032Z Cleaning up task key
2020-04-05T16:03:07.7495249Z Start cleaning up orphan processes.
2020-04-05T16:03:07.7667954Z Terminate orphan process: pid (3616) (python)
2020-04-05T16:03:07.7856279Z ##[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)

@lcnr
Copy link
Contributor Author

lcnr commented Apr 5, 2020

@nikomatsakis This finally works and is now ready for review.

The first commit merely updates the doc of src/librustc_middle/traits/select.rs and is unrelated to the rest of this.

The next three commits actually implement #70509 (comment). I ended up keeping DiscriminantKind public, as the compiler and some tests depend on intrinsics::discriminant_value.

I first update libcore and add the discriminant_kind lang item to the compiler. This also changes the function signature of intrinsics::discriminant_value.

The next commit updates the type system by injecting impls for DiscriminantKind once we
know the exact discriminant type for a given type.
I then update mir/interpret and codegen for discriminant_value.


The rest of this PR first fixes the fallout caused by the changes to discriminant_value and adds additional tests.

@lcnr lcnr changed the title [WIP] update mem::Discriminant update mem::Discriminant Apr 5, 2020
@lcnr lcnr force-pushed the generic_discriminant branch 3 times, most recently from e1bea80 to 8fc1d06 Compare April 5, 2020 19:04
@lcnr
Copy link
Contributor Author

lcnr commented Apr 5, 2020

I just realized that this probably changes the LLVM IR when deriving for enums. It might be a good idea to perf this.

@Centril
Copy link
Contributor

Centril commented Apr 5, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Apr 5, 2020

⌛ Trying commit 7481c0c9f9a35f736613a37294a8f6a9d4018ee9 with merge 1a93cb4a8dba8ab884a66334292c7cd2d11b2694...

@bors
Copy link
Contributor

bors commented Apr 5, 2020

☀️ Try build successful - checks-azure
Build commit: 1a93cb4a8dba8ab884a66334292c7cd2d11b2694 (1a93cb4a8dba8ab884a66334292c7cd2d11b2694)

@rust-timer
Copy link
Collaborator

Queued 1a93cb4a8dba8ab884a66334292c7cd2d11b2694 with parent 6387b09, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 1a93cb4a8dba8ab884a66334292c7cd2d11b2694, comparison URL.

@lcnr
Copy link
Contributor Author

lcnr commented May 19, 2020

I currently have to rebuild LLVM, so I did not test this yet

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 20, 2020

📌 Commit 08b9b97 has been approved by nikomatsakis

@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 20, 2020
@bors
Copy link
Contributor

bors commented May 21, 2020

⌛ Testing commit 08b9b97 with merge 963bf52...

@bors bors mentioned this pull request May 21, 2020
@bors
Copy link
Contributor

bors commented May 21, 2020

☀️ Test successful - checks-azure
Approved by: nikomatsakis
Pushing 963bf52 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 21, 2020
@bors bors merged commit 963bf52 into rust-lang:master May 21, 2020
@lcnr lcnr deleted the generic_discriminant branch May 21, 2020 08:02
@RalfJung
Copy link
Member

This PR causes various Miri tests to ICE. I am still investigating what is happening.

@RalfJung
Copy link
Member

The ICE is

error: internal compiler error: src/librustc_middle/mir/interpret/value.rs:327: Signed value 0xffffffffffffffff does not fit in 64 bits

And indeed this fits into an unsigned 64bit int but not a signed one.

@nikomatsakis
Copy link
Contributor

@RalfJung maybe you can file a follow-up issue and cc @lcnr ?

@RalfJung
Copy link
Member

I opened a PR to fix it instead: #72425

RalfJung added a commit to RalfJung/rust that referenced this pull request May 21, 2020
…akis

fix discriminant_value sign extension

Fixes a regression introduced in rust-lang#70705
r? @nikomatsakis Cc @lcnr @oli-obk
RalfJung added a commit to RalfJung/rust that referenced this pull request May 21, 2020
…akis

fix discriminant_value sign extension

Fixes a regression introduced in rust-lang#70705
r? @nikomatsakis Cc @lcnr @oli-obk
RalfJung added a commit to RalfJung/rust that referenced this pull request May 21, 2020
…akis

fix discriminant_value sign extension

Fixes a regression introduced in rust-lang#70705
r? @nikomatsakis Cc @lcnr @oli-obk
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 6, 2020
While here clean up all pkglint warnings.  Changes since 1.44.1:

Version 1.45.2 (2020-08-03)
==========================

* [Fix bindings in tuple struct patterns][74954]
* [Fix track_caller integration with trait objects][74784]

[74954]: rust-lang/rust#74954
[74784]: rust-lang/rust#74784

Version 1.45.1 (2020-07-30)
==========================

* [Fix const propagation with references.][73613]
* [rustfmt accepts rustfmt_skip in cfg_attr again.][73078]
* [Avoid spurious implicit region bound.][74509]
* [Install clippy on x.py install][74457]

[73613]: rust-lang/rust#73613
[73078]: rust-lang/rust#73078
[74509]: rust-lang/rust#74509
[74457]: rust-lang/rust#74457

Version 1.45.0 (2020-07-16)
==========================

Language
--------
- [Out of range float to int conversions using `as` has been defined as a saturating
  conversion.][71269] This was previously undefined behaviour, but you can use the
   `{f64, f32}::to_int_unchecked` methods to continue using the current behaviour, which
   may be desirable in rare performance sensitive situations.
- [`mem::Discriminant<T>` now uses `T`'s discriminant type instead of always
  using `u64`.][70705]
- [Function like procedural macros can now be used in expression, pattern, and  statement
  positions.][68717] This means you can now use a function-like procedural macro
  anywhere you can use a declarative (`macro_rules!`) macro.

Compiler
--------
- [You can now override individual target features through the `target-feature`
  flag.][72094] E.g. `-C target-feature=+avx2 -C target-feature=+fma` is now
  equivalent to `-C target-feature=+avx2,+fma`.
- [Added the `force-unwind-tables` flag.][69984] This option allows
  rustc to always generate unwind tables regardless of panic strategy.
- [Added the `embed-bitcode` flag.][71716] This codegen flag allows rustc
  to include LLVM bitcode into generated `rlib`s (this is on by default).
- [Added the `tiny` value to the `code-model` codegen flag.][72397]
- [Added tier 3 support\* for the `mipsel-sony-psp` target.][72062]
- [Added tier 3 support for the `thumbv7a-uwp-windows-msvc` target.][72133]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.


Libraries
---------
- [`net::{SocketAddr, SocketAddrV4, SocketAddrV6}` now implements `PartialOrd`
  and `Ord`.][72239]
- [`proc_macro::TokenStream` now implements `Default`.][72234]
- [You can now use `char` with
  `ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo}` to iterate over
  a range of codepoints.][72413] E.g.
  you can now write the following;
  ```rust
  for ch in 'a'..='z' {
      print!("{}", ch);
  }
  println!();
  // Prints "abcdefghijklmnopqrstuvwxyz"
  ```
- [`OsString` now implements `FromStr`.][71662]
- [The `saturating_neg` method as been added to all signed integer primitive
  types, and the `saturating_abs` method has been added for all integer
  primitive types.][71886]
- [`Arc<T>`, `Rc<T>` now implement  `From<Cow<'_, T>>`, and `Box` now
  implements `From<Cow>` when `T` is `[T: Copy]`, `str`, `CStr`, `OsStr`,
  or `Path`.][71447]
- [`Box<[T]>` now implements `From<[T; N]>`.][71095]
- [`BitOr` and `BitOrAssign` are implemented for all `NonZero`
  integer types.][69813]
- [The `fetch_min`, and `fetch_max` methods have been added to all atomic
  integer types.][72324]
- [The `fetch_update` method has been added to all atomic integer types.][71843]

Stabilized APIs
---------------
- [`Arc::as_ptr`]
- [`BTreeMap::remove_entry`]
- [`Rc::as_ptr`]
- [`rc::Weak::as_ptr`]
- [`rc::Weak::from_raw`]
- [`rc::Weak::into_raw`]
- [`str::strip_prefix`]
- [`str::strip_suffix`]
- [`sync::Weak::as_ptr`]
- [`sync::Weak::from_raw`]
- [`sync::Weak::into_raw`]
- [`char::UNICODE_VERSION`]
- [`Span::resolved_at`]
- [`Span::located_at`]
- [`Span::mixed_site`]
- [`unix::process::CommandExt::arg0`]

Cargo
-----

Misc
----
- [Rustdoc now supports strikethrough text in Markdown.][71928] E.g.
  `~~outdated information~~` becomes "~~outdated information~~".
- [Added an emoji to Rustdoc's deprecated API message.][72014]

Compatibility Notes
-------------------
- [Trying to self initialize a static value (that is creating a value using
  itself) is unsound and now causes a compile error.][71140]
- [`{f32, f64}::powi` now returns a slightly different value on Windows.][73420]
  This is due to changes in LLVM's intrinsics which `{f32, f64}::powi` uses.
- [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were
  previously undocumented and not intended for public use. Rustdoc still provides
  a non-zero exit code on errors.

Internals Only
--------------
- [Make clippy a git subtree instead of a git submodule][70655]
- [Unify the undo log of all snapshot types][69464]

[73420]: rust-lang/rust#73420
[72324]: rust-lang/rust#72324
[71843]: rust-lang/rust#71843
[71886]: rust-lang/rust#71886
[72234]: rust-lang/rust#72234
[72239]: rust-lang/rust#72239
[72397]: rust-lang/rust#72397
[72413]: rust-lang/rust#72413
[72014]: rust-lang/rust#72014
[72062]: rust-lang/rust#72062
[72094]: rust-lang/rust#72094
[72133]: rust-lang/rust#72133
[71900]: rust-lang/rust#71900
[71928]: rust-lang/rust#71928
[71662]: rust-lang/rust#71662
[71716]: rust-lang/rust#71716
[71447]: rust-lang/rust#71447
[71269]: rust-lang/rust#71269
[71095]: rust-lang/rust#71095
[71140]: rust-lang/rust#71140
[70655]: rust-lang/rust#70655
[70705]: rust-lang/rust#70705
[69984]: rust-lang/rust#69984
[69813]: rust-lang/rust#69813
[69464]: rust-lang/rust#69464
[68717]: rust-lang/rust#68717
[`Arc::as_ptr`]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.as_ptr
[`BTreeMap::remove_entry`]: https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html#method.remove_entry
[`Rc::as_ptr`]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.as_ptr
[`rc::Weak::as_ptr`]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.as_ptr
[`rc::Weak::from_raw`]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.from_raw
[`rc::Weak::into_raw`]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.into_raw
[`sync::Weak::as_ptr`]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.as_ptr
[`sync::Weak::from_raw`]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.from_raw
[`sync::Weak::into_raw`]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.into_raw
[`str::strip_prefix`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_prefix
[`str::strip_suffix`]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_suffix
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/stable/std/char/constant.UNICODE_VERSION.html
[`Span::resolved_at`]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.resolved_at
[`Span::located_at`]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.located_at
[`Span::mixed_site`]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.mixed_site
[`unix::process::CommandExt::arg0`]: https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.arg0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"discriminant_value" intrinsic returns u64, cannot fit all discriminants