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

correctly normalize constants #70319

Merged
merged 6 commits into from
Mar 25, 2020
Merged

correctly normalize constants #70319

merged 6 commits into from
Mar 25, 2020

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Mar 23, 2020

closes #70317

implements #70125 (comment)

r? eddyb cc @varkor

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(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 Mar 23, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Mar 23, 2020

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned petrochenkov Mar 23, 2020
src/librustc/query/mod.rs Outdated Show resolved Hide resolved
@lcnr
Copy link
Contributor Author

lcnr commented Mar 23, 2020

currently causes `compiler_builtins to fail at https://github.com/rust-lang/compiler-builtins/blob/3e6327aa59214133fa74b3c51743b5ebde39526f/src/int/mod.rs#L50

error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:603: collection encountered polymorphic constant
  --> /home/programming/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/compiler_builtins-0.1.25/src/int/mod.rs:50:5
   |
50 |     const ONE: Self;
   |     ^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

Which I don't quite understand...

src/librustc/ty/subst.rs Outdated Show resolved Hide resolved
@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-03-23T14:52:17.2433341Z ========================== Starting Command Output ===========================
2020-03-23T14:52:17.2438548Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/62529456-3480-471f-86e8-f4847b27e0e0.sh
2020-03-23T14:52:17.2439082Z 
2020-03-23T14:52:17.2444663Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-23T14:52:17.2464836Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T14:52:17.2468100Z Task         : Get sources
2020-03-23T14:52:17.2468412Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T14:52:17.2468712Z Version      : 1.0.0
2020-03-23T14:52:17.2468932Z Author       : Microsoft
---
2020-03-23T14:52:18.2338220Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-23T14:52:18.2344929Z ##[command]git config gc.auto 0
2020-03-23T14:52:18.2349969Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-23T14:52:18.2355448Z ##[command]git config --get-all http.proxy
2020-03-23T14:52:18.2362995Z ##[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/70319/merge:refs/remotes/pull/70319/merge
---
2020-03-23T15:00:31.1042196Z configure: build.locked-deps    := True
2020-03-23T15:00:31.1042502Z configure: llvm.ccache          := sccache
2020-03-23T15:00:31.1043007Z configure: build.cargo-native-static := True
2020-03-23T15:00:31.1043472Z configure: dist.missing-tools   := True
2020-03-23T15:00:31.1044144Z configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
2020-03-23T15:00:31.1044713Z configure: writing `config.toml` in current directory
2020-03-23T15:00:31.1044960Z configure: 
2020-03-23T15:00:31.1045392Z configure: run `python /checkout/x.py --help`
2020-03-23T15:00:31.1045624Z configure: 
---
2020-03-23T15:07:55.4420291Z skip untracked path cpu-usage.csv during rustfmt invocations
2020-03-23T15:07:55.4425441Z skip untracked path src/doc/book/ during rustfmt invocations
2020-03-23T15:07:55.4429910Z skip untracked path src/doc/rust-by-example/ during rustfmt invocations
2020-03-23T15:07:55.4434625Z skip untracked path src/llvm-project/ during rustfmt invocations
2020-03-23T15:07:58.5455029Z Diff in /checkout/src/librustc/ty/normalize_erasing_regions.rs at line 94:
2020-03-23T15:07:58.5455590Z  
2020-03-23T15:07:58.5457169Z      fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
2020-03-23T15:07:58.5457169Z      fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
2020-03-23T15:07:58.5457930Z -        self.tcx.normalize_generic_arg_after_erasing_regions(self.param_env.and(GenericArg::from(ty))).expect_ty()
2020-03-23T15:07:58.5458334Z +        self.tcx
2020-03-23T15:07:58.5458734Z +            .normalize_generic_arg_after_erasing_regions(self.param_env.and(GenericArg::from(ty)))
2020-03-23T15:07:58.5459139Z +            .expect_ty()
2020-03-23T15:07:58.5459438Z  
2020-03-23T15:07:58.5459438Z  
2020-03-23T15:07:58.5459974Z      fn fold_const(&mut self, c: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
2020-03-23T15:07:58.5460411Z Diff in /checkout/src/librustc/ty/normalize_erasing_regions.rs at line 101:
2020-03-23T15:07:58.5461143Z -        self.tcx.normalize_generic_arg_after_erasing_regions(self.param_env.and(GenericArg::from(c))).expect_const()
2020-03-23T15:07:58.5461555Z +        self.tcx
2020-03-23T15:07:58.5461915Z +            .normalize_generic_arg_after_erasing_regions(self.param_env.and(GenericArg::from(c)))
2020-03-23T15:07:58.5462295Z +            .expect_const()
2020-03-23T15:07:58.5462618Z  }
2020-03-23T15:07:58.5462737Z  
2020-03-23T15:07:58.5462737Z  
2020-03-23T15:07:58.5463655Z Running `"/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/rustfmt" "--config-path" "/checkout" "--edition" "2018" "--unstable-features" "--skip-children" "--check" "/checkout/src/librustc/ty/normalize_erasing_regions.rs"` failed.
2020-03-23T15:07:58.5464639Z If you're running `tidy`, try again with `--bless` flag. Or, you just want to format code, run `./x.py fmt` instead.
2020-03-23T15:07:58.5479595Z Build completed unsuccessfully in 0:00:39
2020-03-23T15:07:58.5527249Z == clock drift check ==
2020-03-23T15:07:58.5548908Z   local time: Mon Mar 23 15:07:58 UTC 2020
2020-03-23T15:07:58.8433414Z   network time: Mon, 23 Mar 2020 15:07:58 GMT
2020-03-23T15:07:58.8433414Z   network time: Mon, 23 Mar 2020 15:07:58 GMT
2020-03-23T15:07:58.8437368Z == end clock drift check ==
2020-03-23T15:08:00.3979893Z 
2020-03-23T15:08:00.4047088Z ##[error]Bash exited with code '1'.
2020-03-23T15:08:00.4060656Z ##[section]Finishing: Run build
2020-03-23T15:08:00.4110830Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T15:08:00.4116096Z Task         : Get sources
2020-03-23T15:08:00.4116462Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T15:08:00.4116781Z Version      : 1.0.0
2020-03-23T15:08:00.4117008Z Author       : Microsoft
2020-03-23T15:08:00.4117008Z Author       : Microsoft
2020-03-23T15:08:00.4117385Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-23T15:08:00.4117798Z ==============================================================================
2020-03-23T15:08:00.7509213Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-23T15:08:00.7575040Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T15:08:00.7669169Z Cleaning up task key
2020-03-23T15:08:00.7670578Z Start cleaning up orphan processes.
2020-03-23T15:08:00.7869752Z Terminate orphan process: pid (3423) (python)
2020-03-23T15:08:00.8190972Z ##[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)

@varkor varkor added the F-const_generics `#![feature(const_generics)]` label Mar 23, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Mar 23, 2020

this now also implements visit_const in the two cases mentioned in #70317 in the first commit.

If desired I can move that commit into different PR

@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-03-23T17:28:18.3530372Z ========================== Starting Command Output ===========================
2020-03-23T17:28:18.3534721Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/db39795a-0bf8-4cb4-a8b5-315aabe34469.sh
2020-03-23T17:28:18.3535195Z 
2020-03-23T17:28:18.3540612Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-23T17:28:18.3563589Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T17:28:18.3566844Z Task         : Get sources
2020-03-23T17:28:18.3567152Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T17:28:18.3567451Z Version      : 1.0.0
2020-03-23T17:28:18.3567669Z Author       : Microsoft
---
2020-03-23T17:28:19.5761496Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-23T17:28:19.5770357Z ##[command]git config gc.auto 0
2020-03-23T17:28:19.5776926Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-23T17:28:19.5783400Z ##[command]git config --get-all http.proxy
2020-03-23T17:28:19.5792933Z ##[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/70319/merge:refs/remotes/pull/70319/merge
---
2020-03-23T17:34:37.6160199Z     Checking rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
2020-03-23T17:34:38.3614684Z error[E0425]: cannot find value `bound_ty` in this scope
2020-03-23T17:34:38.3615487Z    --> src/librustc/traits/structural_impls.rs:280:21
2020-03-23T17:34:38.3616014Z     |
2020-03-23T17:34:38.3616621Z 280 |                     bound_ty.var.as_u32(),
2020-03-23T17:34:38.3622208Z 
2020-03-23T17:34:38.3667323Z error[E0425]: cannot find value `bound_ty` in this scope
2020-03-23T17:34:38.3668300Z    --> src/librustc/traits/structural_impls.rs:281:52
2020-03-23T17:34:38.3669215Z     |
2020-03-23T17:34:38.3669215Z     |
2020-03-23T17:34:38.3670043Z 281 |                     Symbol::intern(&format!("^{}", bound_ty.var.as_u32())),
2020-03-23T17:34:38.3671626Z 
2020-03-23T17:34:38.7718115Z error: unused import: `GenericArg`
2020-03-23T17:34:38.7718846Z   --> src/librustc/ty/normalize_erasing_regions.rs:11:24
2020-03-23T17:34:38.7719425Z    |
2020-03-23T17:34:38.7719425Z    |
2020-03-23T17:34:38.7720100Z 11 | use crate::ty::subst::{GenericArg, Subst, SubstsRef};
2020-03-23T17:34:38.7721651Z    |
2020-03-23T17:34:38.7722349Z    = note: `-D unused-imports` implied by `-D warnings`
2020-03-23T17:34:38.7722634Z 
2020-03-23T17:34:38.8052194Z     Checking rustc_builtin_macros v0.0.0 (/checkout/src/librustc_builtin_macros)
2020-03-23T17:34:38.8052194Z     Checking rustc_builtin_macros v0.0.0 (/checkout/src/librustc_builtin_macros)
2020-03-23T17:34:43.8818921Z error[E0308]: mismatched types
2020-03-23T17:34:43.8821260Z    --> src/librustc/traits/structural_impls.rs:279:17
2020-03-23T17:34:43.8822669Z     |
2020-03-23T17:34:43.8824165Z 277 |  /         match c.val {
2020-03-23T17:34:43.8826323Z 278 |  |             ty::ConstKind::Bound(debruijn, bound_var) if debruijn == self.binder_index => {
2020-03-23T17:34:43.8831544Z 279 |  |                 self.types.insert(
2020-03-23T17:34:43.8832347Z     |  |_________________^
2020-03-23T17:34:43.8833241Z 280 | ||                     bound_ty.var.as_u32(),
2020-03-23T17:34:43.8834359Z 281 | ||                     Symbol::intern(&format!("^{}", bound_ty.var.as_u32())),
2020-03-23T17:34:43.8835400Z 282 | ||                 )
2020-03-23T17:34:43.8836498Z     | ||_________________^ expected `()`, found enum `std::option::Option`
2020-03-23T17:34:43.8838326Z 284 |  |             _ => (),
2020-03-23T17:34:43.8839111Z 285 |  |         }
2020-03-23T17:34:43.8839922Z     |  |_________- expected this to be `()`
2020-03-23T17:34:43.8840575Z     |
---
2020-03-23T17:34:48.4042302Z For more information about an error, try `rustc --explain E0308`.
2020-03-23T17:34:48.4326095Z error: could not compile `rustc`.
2020-03-23T17:34:48.4327048Z 
2020-03-23T17:34:48.4328153Z To learn more, run the command again with --verbose.
2020-03-23T17:34:48.4370485Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" " llvm" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
2020-03-23T17:34:48.4384316Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2020-03-23T17:34:48.4384665Z Build completed unsuccessfully in 0:04:01
2020-03-23T17:34:48.4439747Z == clock drift check ==
2020-03-23T17:34:48.4456890Z   local time: Mon Mar 23 17:34:48 UTC 2020
2020-03-23T17:34:48.4456890Z   local time: Mon Mar 23 17:34:48 UTC 2020
2020-03-23T17:34:48.6074758Z   network time: Mon, 23 Mar 2020 17:34:48 GMT
2020-03-23T17:34:48.6081872Z == end clock drift check ==
2020-03-23T17:34:49.2517558Z 
2020-03-23T17:34:49.2585618Z ##[error]Bash exited with code '1'.
2020-03-23T17:34:49.2599129Z ##[section]Finishing: Run build
2020-03-23T17:34:49.2653079Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T17:34:49.2658096Z Task         : Get sources
2020-03-23T17:34:49.2658456Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T17:34:49.2658769Z Version      : 1.0.0
2020-03-23T17:34:49.2658993Z Author       : Microsoft
2020-03-23T17:34:49.2658993Z Author       : Microsoft
2020-03-23T17:34:49.2659360Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-23T17:34:49.2659764Z ==============================================================================
2020-03-23T17:34:49.6001971Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-23T17:34:49.6049698Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T17:34:49.6141821Z Cleaning up task key
2020-03-23T17:34:49.6143140Z Start cleaning up orphan processes.
2020-03-23T17:34:49.6325940Z Terminate orphan process: pid (3447) (python)
2020-03-23T17:34:49.6515453Z ##[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-7 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-03-23T17:40:33.1751710Z ========================== Starting Command Output ===========================
2020-03-23T17:40:33.1754355Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/d621a36c-6c80-4461-9140-a216c82fdc8a.sh
2020-03-23T17:40:33.1754615Z 
2020-03-23T17:40:33.1757923Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-23T17:40:33.1778226Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T17:40:33.1781832Z Task         : Get sources
2020-03-23T17:40:33.1782187Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T17:40:33.1782474Z Version      : 1.0.0
2020-03-23T17:40:33.1782668Z Author       : Microsoft
---
2020-03-23T17:40:34.3692275Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-23T17:40:34.3699938Z ##[command]git config gc.auto 0
2020-03-23T17:40:34.3704756Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-23T17:40:34.3715507Z ##[command]git config --get-all http.proxy
2020-03-23T17:40:34.3725619Z ##[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/70319/merge:refs/remotes/pull/70319/merge
---
2020-03-23T18:08:56.2044002Z    Compiling unwind v0.0.0 (/checkout/src/libunwind)
2020-03-23T18:08:57.0849704Z    Compiling backtrace-sys v0.1.34
2020-03-23T18:08:57.9951335Z    Compiling hashbrown v0.6.2
2020-03-23T18:09:07.4118451Z    Compiling rustc-std-workspace-core v1.99.0 (/checkout/src/tools/rustc-std-workspace-core)
2020-03-23T18:09:08.7194763Z error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:603: collection encountered polymorphic constant
2020-03-23T18:09:08.7195917Z   --> /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/compiler_builtins-0.1.25/src/int/mod.rs:50:5
2020-03-23T18:09:08.7197827Z 50 |     const ONE: Self;
2020-03-23T18:09:08.7198528Z    |     ^^^^^^^^^^^^^^^^
2020-03-23T18:09:08.7231945Z 
2020-03-23T18:09:08.7233617Z thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
2020-03-23T18:09:08.7233617Z thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
2020-03-23T18:09:08.7234073Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-03-23T18:09:08.7234349Z 
2020-03-23T18:09:08.7234579Z note: the compiler unexpectedly panicked. this is a bug.
2020-03-23T18:09:08.7234805Z 
2020-03-23T18:09:08.7235566Z note: we would appreciate a bug report: ***/blob/master/CONTRIBUTING.md#bug-reports
2020-03-23T18:09:08.7235880Z 
2020-03-23T18:09:08.7236410Z note: rustc 1.44.0-nightly (fca83592d 2020-03-23) running on x86_64-unknown-linux-gnu
2020-03-23T18:09:08.7236673Z 
2020-03-23T18:09:08.7237770Z note: compiler flags: -Z macro-backtrace -Z binary-dep-depinfo -Z force-unstable-if-unmarked -C opt-level=3 -C codegen-units=1 -C debuginfo=0 -C link-args=-Wl,-rpath,$ORIGIN/../lib -C prefer-dynamic -C llvm-args=-import-instr-limit=10 -C panic=abort -C debug-assertions=no --crate-type lib
2020-03-23T18:09:08.7238670Z note: some of the compiler flags provided by cargo are hidden
2020-03-23T18:09:08.7238885Z 
2020-03-23T18:09:08.7239362Z error: aborting due to previous error
2020-03-23T18:09:08.7239614Z 
---
2020-03-23T18:09:14.3195206Z   local time: Mon Mar 23 18:09:14 UTC 2020
2020-03-23T18:09:14.3990374Z   network time: Mon, 23 Mar 2020 18:09:14 GMT
2020-03-23T18:09:14.3990903Z == end clock drift check ==
2020-03-23T18:09:16.7215001Z 
2020-03-23T18:09:16.7305542Z ##[error]Bash exited with code '1'.
2020-03-23T18:09:16.7319911Z ##[section]Finishing: Run build
2020-03-23T18:09:16.7373487Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T18:09:16.7378860Z Task         : Get sources
2020-03-23T18:09:16.7379236Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T18:09:16.7379566Z Version      : 1.0.0
2020-03-23T18:09:16.7379793Z Author       : Microsoft
2020-03-23T18:09:16.7379793Z Author       : Microsoft
2020-03-23T18:09:16.7380183Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-23T18:09:16.7380608Z ==============================================================================
2020-03-23T18:09:17.0993563Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-23T18:09:17.1041913Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/70319/merge to s
2020-03-23T18:09:17.1134155Z Cleaning up task key
2020-03-23T18:09:17.1135473Z Start cleaning up orphan processes.
2020-03-23T18:09:17.1332189Z Terminate orphan process: pid (4494) (python)
2020-03-23T18:09:17.1503178Z ##[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 lcnr changed the title [WIP] correctly normalize constants correctly normalize constants Mar 23, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Mar 23, 2020

@eddyb this should now close #70317 afaict.

It still does not fix the following though. So we might just
merge this without actually having any new tests.

#![feature(const_generics)]

struct S;
impl S {
    fn test<const A: i32>() -> i32 {
        A
    }
}

fn main() {
    S::test::<{ 16i32 }>();
}

@eddyb
Copy link
Member

eddyb commented Mar 24, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Mar 24, 2020

📌 Commit 11763d4 has been approved by eddyb

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 24, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 24, 2020
@Centril
Copy link
Contributor

Centril commented Mar 24, 2020

Failed in #70363 (comment), @bors r-

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 24, 2020
@lcnr
Copy link
Contributor Author

lcnr commented Mar 24, 2020

seems like the representation of RawVec in mir was changed in another PR.

Will wait for #70371 to get merged first

@wesleywiser
Copy link
Member

I think the issue is differences between 32-bit and 64-bit platforms:

Actual Line: "        ((*_4).0: alloc::raw_vec::RawVec<u32>) = const ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>;"
Expected Line: "  ((*_4).0: alloc::raw_vec::RawVec<u32>) = const ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>;"

The failure happened on Linux dist-i586-gnu-i586-i686-musl.

@oli-obk Is there a nice way to deal with differences like this on 32-vs-64 bit platforms in mir-opt tests? Or should we just make this a 64-bit only test?

@eddyb
Copy link
Member

eddyb commented Mar 24, 2020

@wesleywiser see #69916.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 25, 2020

Make it 64 bit for now and when we move to --bless we can make it a test for both platforms

@lcnr
Copy link
Contributor Author

lcnr commented Mar 25, 2020

updated the test to only run on 64 bit machines, should be ready for merge again. 😅

@oli-obk
Copy link
Contributor

oli-obk commented Mar 25, 2020

@bors r=eddyb

@bors
Copy link
Contributor

bors commented Mar 25, 2020

📌 Commit f8e3da5 has been approved by eddyb

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 25, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 25, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 25, 2020
This was referenced Mar 25, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 25, 2020
Rollup of 5 pull requests

Successful merges:

 - rust-lang#70226 (use checked casts and arithmetic in Miri engine)
 - rust-lang#70319 (correctly normalize constants)
 - rust-lang#70352 (Add long error explanation for E0710 )
 - rust-lang#70366 (Implement Fuse with Option)
 - rust-lang#70379 (fix incorrect type name in doc comments)

Failed merges:

 - rust-lang#70375 (avoid catching InterpError)

r? @ghost
@bors bors merged commit 1154023 into rust-lang:master Mar 25, 2020
@lcnr lcnr deleted the issue63695 branch March 26, 2020 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-const_generics `#![feature(const_generics)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing visit_const/fold_const when visit_ty/fold_ty exists and consts are relevant.
9 participants