Skip to content

delay a bug when encountering an ambiguity in MIR typeck #116530

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

aliemjay
Copy link
Member

@aliemjay aliemjay commented Oct 8, 2023

We shouldn't have any trait selection ambiguities in MIR typeck.

See #114586 (comment)

r? @oli-obk @compiler-errors @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 8, 2023
@compiler-errors
Copy link
Member

Makes sense.

r? compiler-errors @bors r+

@bors
Copy link
Collaborator

bors commented Oct 9, 2023

📌 Commit 710c073 has been approved by compiler-errors

It is now in the queue for this repository.

@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 Oct 9, 2023
@bors
Copy link
Collaborator

bors commented Oct 9, 2023

⌛ Testing commit 710c073 with merge 20b9ec8...

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 9, 2023
…r-errors

delay a bug when encountering an ambiguity in MIR typeck

We shouldn't have any trait selection ambiguities in MIR typeck.

See rust-lang#114586 (comment)

r? `@oli-obk` `@compiler-errors` `@lcnr`
@lcnr
Copy link
Contributor

lcnr commented Oct 9, 2023

what kinds of programs ICE if you change tis to a bug! instead?

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/panics/default-backtrace-ice.rs stdout ----
diff of stderr:

7 
8 aborting due to `-Z treat-err-as-bug=1`
- (end_short_backtrace)
11 (begin_short_backtrace)
12 (end_short_backtrace)
13 (begin_short_backtrace)
---
To only update this specific test, also pass `--test-args panics/default-backtrace-ice.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: env -u RUST_BACKTRACE RUSTC_ICE="0" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "/Users/runner/work/rust/rust/tests/ui/panics/default-backtrace-ice.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/Users/runner/.cargo" "--sysroot" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage2" "--target=x86_64-apple-darwin" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/panics/default-backtrace-ice" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/Users/runner/work/rust/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "-L" "/Users/runner/work/rust/rust/build/x86_64-apple-darwin/test/ui/panics/default-backtrace-ice/auxiliary" "-Z" "treat-err-as-bug=1"
--- stderr -------------------------------
error[E0425]: cannot find value `missing_ident` in this scope
##[error]  --> /Users/runner/work/rust/rust/tests/ui/panics/default-backtrace-ice.rs:21:13
   |
   |
LL | fn main() { missing_ident; }

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:1729:30:
thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:1729:30:
aborting due to `-Z treat-err-as-bug=1`
   0:        0x1031fc80b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hab9a645d4c6cae58
   1:        0x10325ced3 - core::fmt::write::h255af4a54bb1fa79
   2:        0x1031f1b2e - std::io::Write::write_fmt::he05f6325a196c841
   3:        0x1031fc5e9 - std::sys_common::backtrace::print::he315a4faa7beea82
   3:        0x1031fc5e9 - std::sys_common::backtrace::print::he315a4faa7beea82
   4:        0x1031ff9e5 - std::panicking::default_hook::{{closure}}::ha06ef57fa3fc186f
   5:        0x1031ff74c - std::panicking::default_hook::h6a7faad2270d4b15
   6:        0x10bbb3eac - std[671f820cec1cf149]::panicking::update_hook::<alloc[74d386d8e8450bf7]::boxed::Box<rustc_driver_impl[8cf711d4d0fcadf9]::install_ice_hook::{closure#0}>>::{closure#0}
   8:        0x1031ffe27 - std::panicking::begin_panic_handler::{{closure}}::ha83980314bc0c146
   9:        0x1031fcd19 - ___udivmoddi4
  10:        0x1031ffb9d - _rust_begin_unwind
  11:        0x103288215 - core::panicking::panic_fmt::h9e138a7655e4026a
  11:        0x103288215 - core::panicking::panic_fmt::h9e138a7655e4026a
  12:        0x1106b573f - <rustc_errors[4a2f97d5a6758d7a]::HandlerInner>::panic_if_treat_err_as_bug
  13:        0x1106b4a87 - <rustc_errors[4a2f97d5a6758d7a]::HandlerInner>::emit_diagnostic::{closure#2}
  14:        0x10bd1e95f - rustc_interface[35dd32b46cf34317]::callbacks::track_diagnostic
  15:        0x1106b43ee - <rustc_errors[4a2f97d5a6758d7a]::HandlerInner>::emit_diagnostic
  16:        0x1106d8101 - <rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed as rustc_errors[4a2f97d5a6758d7a]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
  17:        0x10f04011d - <rustc_resolve[9ee15daa354b9ce8]::Resolver>::report_errors
  18:        0x10f0be093 - <rustc_session[15201c05148c3e3]::session::Session>::time::<(), <rustc_resolve[9ee15daa354b9ce8]::Resolver>::resolve_crate::{closure#0}>
  19:        0x10f0736fe - <rustc_resolve[9ee15daa354b9ce8]::Resolver>::resolve_crate
  20:        0x10bd25475 - rustc_interface[35dd32b46cf34317]::passes::resolver_for_lowering
  21:        0x10f6c394d - rustc_query_impl[fe09369826c2ba2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fe09369826c2ba2]::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f2b601c0ba6c1077]::query::erase::Erased<[u8; 8usize]>>
  22:        0x10f7f8179 - <rustc_query_impl[fe09369826c2ba2]::query_impl::resolver_for_lowering::dynamic_query::{closure#2} as core[30426629a36827b9]::ops::function::FnOnce<(rustc_middle[f2b601c0ba6c1077]::ty::context::TyCtxt, ())>>::call_once
  23:        0x10f615f1b - rustc_query_system[f56bcbed907ebf29]::query::plumbing::try_execute_query::<rustc_query_impl[fe09369826c2ba2]::DynamicConfig<rustc_query_system[f56bcbed907ebf29]::query::caches::SingleCache<rustc_middle[f2b601c0ba6c1077]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[fe09369826c2ba2]::plumbing::QueryCtxt, false>
  24:        0x10f71e39a - rustc_query_impl[fe09369826c2ba2]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
  25:        0x10bb705d6 - <rustc_middle[f2b601c0ba6c1077]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[8cf711d4d0fcadf9]::run_compiler::{closure#1}::{closure#2}::{closure#4}, &rustc_data_structures[4d7720560792e628]::steal::Steal<(rustc_middle[f2b601c0ba6c1077]::ty::ResolverAstLowering, alloc[74d386d8e8450bf7]::rc::Rc<rustc_ast[fdc19c2a1ab7c13f]::ast::Crate>)>>
  26:        0x10bb95476 - rustc_span[68ec3145a42ee6ed]::set_source_map::<core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>, rustc_interface[35dd32b46cf34317]::interface::run_compiler<core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>, rustc_driver_impl[8cf711d4d0fcadf9]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  27:        0x10bb7a82c - std[671f820cec1cf149]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[35dd32b46cf34317]::util::run_in_thread_with_globals<rustc_interface[35dd32b46cf34317]::interface::run_compiler<core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>, rustc_driver_impl[8cf711d4d0fcadf9]::run_compiler::{closure#1}>::{closure#0}, core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>>
  28:        0x10bb7bfde - <<std[671f820cec1cf149]::thread::Builder>::spawn_unchecked_<rustc_interface[35dd32b46cf34317]::util::run_in_thread_with_globals<rustc_interface[35dd32b46cf34317]::interface::run_compiler<core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>, rustc_driver_impl[8cf711d4d0fcadf9]::run_compiler::{closure#1}>::{closure#0}, core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[30426629a36827b9]::result::Result<(), rustc_span[68ec3145a42ee6ed]::ErrorGuaranteed>>::{closure#1} as core[30426629a36827b9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7ff8093191d3 - __pthread_start

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


note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.75.0-nightly (20b9ec86b 2023-10-09) running on x86_64-apple-darwin

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/Users/runner/.cargo -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0 -Z treat-err-as-bug=1
query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
------------------------------------------

@bors
Copy link
Collaborator

bors commented Oct 9, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 9, 2023
@aliemjay
Copy link
Member Author

probably unrelated?
@bors retry rollup

@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 Oct 10, 2023
@aliemjay
Copy link
Member Author

what kinds of programs ICE if you change tis to a bug! instead?

A handful of ui tests. All of which involve a TyKind::Error, either in the query or because of an invalid trait impls.

bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2023
Rollup of 4 pull requests

Successful merges:

 - rust-lang#95967 (Add explicit-endian String::from_utf16 variants)
 - rust-lang#116530 (delay a bug when encountering an ambiguity in MIR typeck)
 - rust-lang#116611 (Document `diagnostic_namespace` feature)
 - rust-lang#116612 (Remove unused dominator iterator)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a7042a9 into rust-lang:master Oct 11, 2023
@rustbot rustbot added this to the 1.75.0 milestone Oct 11, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 11, 2023
Rollup merge of rust-lang#116530 - aliemjay:ice-on-ambiguity, r=compiler-errors

delay a bug when encountering an ambiguity in MIR typeck

We shouldn't have any trait selection ambiguities in MIR typeck.

See rust-lang#114586 (comment)

r? `@oli-obk` `@compiler-errors` `@lcnr`
@aliemjay aliemjay deleted the ice-on-ambiguity branch October 11, 2023 06:21
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Oct 12, 2023
48: Pull upstream master 2023 10 12 r=tshepang a=Dajamante

* rust-lang/rust#113487
* rust-lang/rust#116506
* rust-lang/rust#116448
* rust-lang/rust#116640
  * rust-lang/rust#116627
  * rust-lang/rust#116597
  * rust-lang/rust#116436
  * rust-lang/rust#116315
  * rust-lang/rust#116219
* rust-lang/rust#113218
* rust-lang/rust#115937
* rust-lang/rust#116014
* rust-lang/rust#116623
* rust-lang/rust#112818
* rust-lang/rust#115948
* rust-lang/rust#116622
* rust-lang/rust#116621
  * rust-lang/rust#116612
  * rust-lang/rust#116611
  * rust-lang/rust#116530
  * rust-lang/rust#95967
* rust-lang/rust#116578
* rust-lang/rust#113915
* rust-lang/rust#116605
  * rust-lang/rust#116574
  * rust-lang/rust#116560
  * rust-lang/rust#116559
  * rust-lang/rust#116503
  * rust-lang/rust#116444
  * rust-lang/rust#116250
  * rust-lang/rust#109422
* rust-lang/rust#116598
  * rust-lang/rust#116596
  * rust-lang/rust#116595
  * rust-lang/rust#116589
  * rust-lang/rust#116586
* rust-lang/rust#116551
* rust-lang/rust#116409
* rust-lang/rust#116548
* rust-lang/rust#116366
* rust-lang/rust#109882
* rust-lang/rust#116497
* rust-lang/rust#116532
* rust-lang/rust#116569
  * rust-lang/rust#116561
  * rust-lang/rust#116556
  * rust-lang/rust#116549
  * rust-lang/rust#116543
  * rust-lang/rust#116537
  * rust-lang/rust#115882
* rust-lang/rust#116142
* rust-lang/rust#115238
* rust-lang/rust#116533
* rust-lang/rust#116096
* rust-lang/rust#116468
* rust-lang/rust#116515
* rust-lang/rust#116454
* rust-lang/rust#116183
* rust-lang/rust#116514
* rust-lang/rust#116509
* rust-lang/rust#116487
* rust-lang/rust#116486
* rust-lang/rust#116450
* rust-lang/rust#114623
* rust-lang/rust#116416
* rust-lang/rust#116437
* rust-lang/rust#100806
* rust-lang/rust#116330
* rust-lang/rust#116310
* rust-lang/rust#115583
* rust-lang/rust#116457
* rust-lang/rust#116508
* rust-lang/rust#109214
* rust-lang/rust#116318
* rust-lang/rust#116501
  * rust-lang/rust#116500
  * rust-lang/rust#116458
  * rust-lang/rust#116400
  * rust-lang/rust#116277
* rust-lang/rust#114709
* rust-lang/rust#116492
  * rust-lang/rust#116484
  * rust-lang/rust#116481
  * rust-lang/rust#116474
  * rust-lang/rust#116466
  * rust-lang/rust#116423
  * rust-lang/rust#116297
  * rust-lang/rust#114564
* rust-lang/rust#114811
* rust-lang/rust#116489
* rust-lang/rust#115304

Co-authored-by: Peter Hall <peter.hall@hyperexponential.com>
Co-authored-by: Emanuele Vannacci <emanuele.vannacci@gmail.com>
Co-authored-by: Neven Villani <vanille@crans.org>
Co-authored-by: Alex Macleod <alex@macleod.io>
Co-authored-by: Tamir Duberstein <tamird@gmail.com>
Co-authored-by: Eduardo Sánchez Muñoz <eduardosm-dev@e64.io>
Co-authored-by: koka <koka.code@gmail.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Camille GILLOT <gillot.camille@gmail.com>
Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
Co-authored-by: Ralf Jung <post@ralfj.de>
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Oct 13, 2023
48: Pull upstream master 2023 10 12 r=tshepang a=Dajamante

* rust-lang/rust#113487
* rust-lang/rust#116506
* rust-lang/rust#116448
* rust-lang/rust#116640
  * rust-lang/rust#116627
  * rust-lang/rust#116597
  * rust-lang/rust#116436
  * rust-lang/rust#116315
  * rust-lang/rust#116219
* rust-lang/rust#113218
* rust-lang/rust#115937
* rust-lang/rust#116014
* rust-lang/rust#116623
* rust-lang/rust#112818
* rust-lang/rust#115948
* rust-lang/rust#116622
* rust-lang/rust#116621
  * rust-lang/rust#116612
  * rust-lang/rust#116611
  * rust-lang/rust#116530
  * rust-lang/rust#95967
* rust-lang/rust#116578
* rust-lang/rust#113915
* rust-lang/rust#116605
  * rust-lang/rust#116574
  * rust-lang/rust#116560
  * rust-lang/rust#116559
  * rust-lang/rust#116503
  * rust-lang/rust#116444
  * rust-lang/rust#116250
  * rust-lang/rust#109422
* rust-lang/rust#116598
  * rust-lang/rust#116596
  * rust-lang/rust#116595
  * rust-lang/rust#116589
  * rust-lang/rust#116586
* rust-lang/rust#116551
* rust-lang/rust#116409
* rust-lang/rust#116548
* rust-lang/rust#116366
* rust-lang/rust#109882
* rust-lang/rust#116497
* rust-lang/rust#116532
* rust-lang/rust#116569
  * rust-lang/rust#116561
  * rust-lang/rust#116556
  * rust-lang/rust#116549
  * rust-lang/rust#116543
  * rust-lang/rust#116537
  * rust-lang/rust#115882
* rust-lang/rust#116142
* rust-lang/rust#115238
* rust-lang/rust#116533
* rust-lang/rust#116096
* rust-lang/rust#116468
* rust-lang/rust#116515
* rust-lang/rust#116454
* rust-lang/rust#116183
* rust-lang/rust#116514
* rust-lang/rust#116509
* rust-lang/rust#116487
* rust-lang/rust#116486
* rust-lang/rust#116450
* rust-lang/rust#114623
* rust-lang/rust#116416
* rust-lang/rust#116437
* rust-lang/rust#100806
* rust-lang/rust#116330
* rust-lang/rust#116310
* rust-lang/rust#115583
* rust-lang/rust#116457
* rust-lang/rust#116508
* rust-lang/rust#109214
* rust-lang/rust#116318
* rust-lang/rust#116501
  * rust-lang/rust#116500
  * rust-lang/rust#116458
  * rust-lang/rust#116400
  * rust-lang/rust#116277
* rust-lang/rust#114709
* rust-lang/rust#116492
  * rust-lang/rust#116484
  * rust-lang/rust#116481
  * rust-lang/rust#116474
  * rust-lang/rust#116466
  * rust-lang/rust#116423
  * rust-lang/rust#116297
  * rust-lang/rust#114564
* rust-lang/rust#114811
* rust-lang/rust#116489
* rust-lang/rust#115304

Co-authored-by: Emanuele Vannacci <emanuele.vannacci@gmail.com>
Co-authored-by: Neven Villani <vanille@crans.org>
Co-authored-by: Alex Macleod <alex@macleod.io>
Co-authored-by: Tamir Duberstein <tamird@gmail.com>
Co-authored-by: Eduardo Sánchez Muñoz <eduardosm-dev@e64.io>
Co-authored-by: koka <koka.code@gmail.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Camille GILLOT <gillot.camille@gmail.com>
Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: ShE3py <52315535+she3py@users.noreply.github.com>
rust-cloud-vms bot pushed a commit to aliemjay/rust that referenced this pull request Dec 8, 2023
rust-cloud-vms bot pushed a commit to aliemjay/rust that referenced this pull request Dec 8, 2023
rust-cloud-vms bot pushed a commit to aliemjay/rust that referenced this pull request Dec 8, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2023
…mpiler-errors

temporarily revert "ice on ambguity in mir typeck"

Reverts rust-lang#116530 as a temporary measure to fix rust-lang#117577. That issue should be ultimately fixed by checking WF of type annotations prior to normalization, which is implemented in rust-lang#104098 but this PR is intended to be backported to beta.

r? `@compiler-errors` (the reviewer of the reverted PR)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2023
…mpiler-errors

temporarily revert "ice on ambguity in mir typeck"

Reverts rust-lang#116530 as a temporary measure to fix rust-lang#117577. That issue should be ultimately fixed by checking WF of type annotations prior to normalization, which is implemented in rust-lang#104098 but this PR is intended to be backported to beta.

r? ``@compiler-errors`` (the reviewer of the reverted PR)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2023
Rollup merge of rust-lang#118736 - aliemjay:revert-ice-on-ambig, r=compiler-errors

temporarily revert "ice on ambguity in mir typeck"

Reverts rust-lang#116530 as a temporary measure to fix rust-lang#117577. That issue should be ultimately fixed by checking WF of type annotations prior to normalization, which is implemented in rust-lang#104098 but this PR is intended to be backported to beta.

r? ``@compiler-errors`` (the reviewer of the reverted PR)
cuviper pushed a commit to cuviper/rust that referenced this pull request Dec 15, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants