Commit graph

5387 commits

Author SHA1 Message Date
bors 506e75cbf8 Auto merge of #85109 - RalfJung:remove-const_fn, r=oli-obk
remove const_fn feature gate

Fixes https://github.com/rust-lang/rust/issues/84510
r? `@oli-obk`
2021-05-11 10:25:14 +00:00
bors 382f748f23 Auto merge of #85100 - HKalbasi:issue-68049-fix, r=Aaron1011
Fix invalid suggestion of changing impl trait signature

Fix #68049
2021-05-11 07:44:16 +00:00
bors fe62c6e295 Auto merge of #80300 - LeSeulArtichaut:80275-doc-inline, r=Manishearth
Emit errors/warns on some wrong uses of rustdoc attributes

This PR adds a few diagnostics:
- error if conflicting `#[doc(inline)]`/`#[doc(no_inline)]` are found
- introduce the `invalid_doc_attributes` lint (warn-by-default) which triggers:
  - if a crate-level attribute is used on a non-`crate` item
  - if `#[doc(inline)]`/`#[doc(no_inline)]` is used on a non-`use` item

The code could probably be improved but I wanted to get feedback first. Also, some of those changes could be considered breaking changes, so I don't know what the procedure would be? ~~And finally, for the warnings, they are currently hard warnings, maybe it would be better to introduce a lint?~~ (EDIT: introduced the `invalid_doc_attributes` lint)

Closes #80275.
r? `@jyn514`
2021-05-11 05:03:18 +00:00
hamidreza kalbasi 1f20966e90 Fix CI problems 2021-05-11 08:50:43 +04:30
bors 455c5e061c Auto merge of #85165 - JohnTitor:rollup-ew1ls7x, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #84777 (Apply `--cfg parallel_compiler` when documenting)
 - #84783 (Allow formatting specific subdirectories)
 - #84998 (Show nicer error when an 'unstable fingerprints' error occurs)
 - #85002 (RELEASES.md: Use broken_intra_doc_links as an example, not nightly lint)
 - #85051 (Allow checking miri and RLS with `x.py check src/tools/{miri,rls}`)
 - #85114 (Remove outdated FIXME for download-rustc)
 - #85143 (Document Rc::from)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-11 02:41:38 +00:00
Yuki Okushi c65663a781
Rollup merge of #84998 - Aaron1011:pretty-unstable-fingerprint, r=Mark-Simulacrum
Show nicer error when an 'unstable fingerprints' error occurs

An example of the error produced by this PR:

```
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(9f2ad55260c30262-c36667639674ad83)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p syn` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information

thread 'rustc' panicked at 'Found unstable fingerprints for evaluate_obligation(9f2ad55260c30262-c36667639674ad83): Ok(EvaluatedToOk)', /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:595:9
stack backtrace:
   0: rust_begin_unwind
             at /home/aaron/repos/rust/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /home/aaron/repos/rust/library/std/src/panicking.rs:435:5
   2: rustc_query_system::query::plumbing::incremental_verify_ich
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:595:9
   3: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:557:9
   4: rustc_query_system::query::plumbing::try_execute_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:473:21
   5: core::option::Option<T>::map
             at /home/aaron/repos/rust/library/core/src/option.rs:487:29
   6: rustc_query_system::query::plumbing::try_execute_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:471:13
   7: stacker::maybe_grow
             at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
   8: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/aaron/repos/rust/compiler/rustc_data_structures/src/stack.rs:16:5
   9: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:169:17
  10: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
  11: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
  12: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
  13: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:168:13
  14: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1780:13
  15: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
  16: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
  17: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
  18: rustc_middle::ty::context::tls::with_related_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1777:9
  19: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:157:9
  20: rustc_query_system::query::plumbing::try_execute_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:469:22
  21: rustc_query_system::query::plumbing::get_query_impl
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:674:5
  22: rustc_query_system::query::plumbing::get_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:785:9
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:603:17
  24: rustc_middle::ty::query::TyCtxtAt::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:204:17
  25: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:185:17
  26: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:72:9
  27: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:82:15
  28: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_modulo_regions
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:58:9
  29: rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/mod.rs:146:18
  30: rustc_ty_utils::common_traits::is_item_raw::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_ty_utils/src/common_traits.rs:33:9
  31: rustc_infer::infer::InferCtxtBuilder::enter
             at /home/aaron/repos/rust/compiler/rustc_infer/src/infer/mod.rs:582:9
  32: rustc_ty_utils::common_traits::is_item_raw
             at /home/aaron/repos/rust/compiler/rustc_ty_utils/src/common_traits.rs:32:5
  33: rustc_query_system::query::config::QueryVtable<CTX,K,V>::compute
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/config.rs:44:9
  34: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:544:67
  35: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:46
  36: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
  37: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
  38: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
  39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:13
  40: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
  41: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
  42: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
  43: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:74:9
  44: rustc_query_system::dep_graph::graph::DepGraph<K>::with_ignore
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:167:9
  45: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:544:22
  46: rustc_query_system::query::plumbing::try_execute_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:473:21
  47: core::option::Option<T>::map
             at /home/aaron/repos/rust/library/core/src/option.rs:487:29
  48: rustc_query_system::query::plumbing::try_execute_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:471:13
  49: stacker::maybe_grow
             at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
  50: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/aaron/repos/rust/compiler/rustc_data_structures/src/stack.rs:16:5
  51: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:169:17
  52: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
  53: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
  54: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
  55: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:168:13
  56: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1780:13
  57: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
  58: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
  59: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
  60: rustc_middle::ty::context::tls::with_related_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1777:9
  61: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:157:9
  62: rustc_query_system::query::plumbing::try_execute_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:469:22
  63: rustc_query_system::query::plumbing::get_query_impl
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:674:5
  64: rustc_query_system::query::plumbing::get_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:785:9
  65: rustc_middle::ty::query::TyCtxtAt::is_unpin_raw
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:204:17
  66: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::is_unpin
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/util.rs:727:38
  67: rustc_middle::ty::layout::<impl rustc_target::abi::TyAndLayoutMethods<C> for &rustc_middle::ty::TyS>::pointee_info_at
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2341:32
  68: rustc_target::abi::TyAndLayout<Ty>::pointee_info_at
             at /home/aaron/repos/rust/compiler/rustc_target/src/abi/mod.rs:1164:9
  69: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2781:36
  70: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2840:17
  71: rustc_target::abi::call::ArgAbi<Ty>::new
             at /home/aaron/repos/rust/compiler/rustc_target/src/abi/call/mod.rs:457:53
  72: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2838:27
  73: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2870:32
  74: core::iter::adapters::map::map_fold::{{closure}}
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:82:28
  75: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}}
             at /home/aaron/repos/rust/library/core/src/iter/adapters/enumerate.rs:104:27
  76: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/aaron/repos/rust/library/core/src/ops/function.rs:269:13
  77: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/aaron/repos/rust/library/core/src/ops/function.rs:269:13
  78: core::iter::adapters::map::map_fold::{{closure}}
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:82:21
  79: core::iter::traits::iterator::Iterator::fold
             at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:2146:21
  80: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:122:9
  81: <core::iter::adapters::cloned::Cloned<I> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/cloned.rs:58:9
  82: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/chain.rs:119:19
  83: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/chain.rs:119:19
  84: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/enumerate.rs:110:9
  85: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:122:9
  86: core::iter::traits::iterator::Iterator::for_each
             at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:776:9
  87: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
             at /home/aaron/repos/rust/library/alloc/src/vec/spec_extend.rs:40:17
  88: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
             at /home/aaron/repos/rust/library/alloc/src/vec/spec_from_iter_nested.rs:56:9
  89: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
             at /home/aaron/repos/rust/library/alloc/src/vec/spec_from_iter.rs:36:9
  90: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /home/aaron/repos/rust/library/alloc/src/vec/mod.rs:2448:9
  91: core::iter::traits::iterator::Iterator::collect
             at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:1788:9
  92: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2864:19
  93: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::of_instance
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2670:9
  94: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/mono_item.rs:57:22
  95: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::predefine
             at /home/aaron/repos/rust/compiler/rustc_codegen_ssa/src/mono_item.rs:76:17
  96: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/base.rs:122:17
  97: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:235:62
  98: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:46
  99: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
 100: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
 101: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
 102: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:13
 103: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
 104: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
 105: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
 106: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:74:9
 107: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:235:26
 108: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:205:9
 109: rustc_codegen_llvm::base::compile_codegen_unit
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/base.rs:103:9
 110: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/lib.rs:109:9
 111: rustc_codegen_ssa::base::codegen_crate
             at /home/aaron/repos/rust/compiler/rustc_codegen_ssa/src/base.rs:655:38
 112: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/lib.rs:270:18
 113: rustc_interface::passes::start_codegen::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:1021:9
 114: rustc_data_structures::profiling::VerboseTimingGuard::run
             at /home/aaron/repos/rust/compiler/rustc_data_structures/src/profiling.rs:573:9
 115: rustc_session::utils::<impl rustc_session::session::Session>::time
             at /home/aaron/repos/rust/compiler/rustc_session/src/utils.rs:16:9
 116: rustc_interface::passes::start_codegen
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:1020:19
 117: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:296:20
 118: rustc_interface::passes::QueryContext::enter::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:755:42
 119: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
 120: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
 121: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
 122: rustc_interface::passes::QueryContext::enter
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:755:9
 123: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:287:13
 124: rustc_interface::queries::Query<T>::compute
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:40:28
 125: rustc_interface::queries::Queries::ongoing_codegen
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:285:9
 126: rustc_driver::run_compiler::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_driver/src/lib.rs:442:13
 127: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:428:19
 128: rustc_driver::run_compiler::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_driver/src/lib.rs:337:22
 129: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:208:13
 130: rustc_span::with_source_map
             at /home/aaron/repos/rust/compiler/rustc_span/src/lib.rs:788:5
 131: rustc_interface::interface::create_compiler_and_run
             at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:202:5
 132: rustc_interface::interface::run_compiler::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:224:12
 133: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:155:13
 134: scoped_tls::ScopedKey<T>::set
             at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
 135: rustc_span::with_session_globals
             at /home/aaron/repos/rust/compiler/rustc_span/src/lib.rs:105:5
 136: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:153:9
 137: rustc_interface::util::scoped_thread::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:128:24
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: 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.54.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `quote::Tokens: std::marker::Unpin`
#1 [is_unpin_raw] computing whether `quote::Tokens` is `Unpin`
end of query stack
error: aborting due to previous error

error: could not compile `syn`

To learn more, run the command again with --verbose.
```

I've left in the panic and ICE following the pretty error, so that we still have all of the debug information available in a bug report.

This message can be reproduced by cloning the repository `https://github.com/Aaron1011/syn-crash`, and running the following shell script (with a `rustup override` set in the directory):

```
set -xe
cargo clean -p syn
cargo clean --release -p syn

git checkout minimize
cargo build --release -j 1

git checkout minimize-change
cargo build --release -j 1
```

r? ``@Mark-Simulacrum``
2021-05-11 09:28:04 +09:00
Yuki Okushi 5fc898782c
Rollup merge of #84777 - jyn514:rustdoc-parallel, r=Mark-Simulacrum
Apply `--cfg parallel_compiler` when documenting

This also reverts commit 9823c2cc70 working around the bug.

Fixes https://github.com/rust-lang/rust/issues/82301.
2021-05-11 09:28:03 +09:00
bors d4d129d566 Auto merge of #85012 - FabianWolff:struct-rec, r=davidtwco
Fix stack overflow when checking for structural recursion

This pull request aims to fix #74224 and fix #84611. The current logic for detecting ADTs with structural recursion is flawed because it only looks at the root type, and then for exact matches. What I mean by this is that for examples such as:
```rust
struct A<T> {
    x: T,
    y: A<A<T>>,
}

struct B {
    z: A<usize>
}

fn main() {}
```
When checking `A`, the compiler correctly determines that it has an infinite size (because the "root" type is `A`, and `A` occurs, albeit with different type arguments, as a nested type in `A`).

However, when checking `B`, it also recurses into `A`, but now `B` is the root type, and it only checks for _exact_ matches of `A`, but since `A` never precisely contains itself (only `A<A<T>>`, `A<A<A<T>>>`, etc.), an endless recursion ensues until the stack overflows.

In this PR, I have attempted to fix this behavior by implementing a two-phase checking: When checking `B`, my code first checks `A` _separately_ and stops if `A` already turns out to be infinite. If not (such as for `Option<T>`), the second phase checks whether the root type (`B`) is ever nested inside itself, e.g.:
```rust
struct Foo { x: Option<Option<Foo>> }
```

Special care needs to be taken for mutually recursive types, e.g.:
```rust
struct A<T> {
    z: T,
    x: B<T>,
}

struct B<T> {
    y: A<T>
}
```
Here, both `A` and `B` both _are_ `SelfRecursive` and _contain_ a recursive type. The current behavior, which I have maintained, is to treat both `A` and `B` as `SelfRecursive`, and accordingly report errors for both.
2021-05-11 00:00:53 +00:00
Aaron Hill a4c0793551 Show nicer error when an 'unstable fingerprints' error occurs 2021-05-10 17:43:51 -04:00
Guillaume Gomez 6ec1de7d4f
Rollup merge of #85152 - nagisa:target-search-rustlib, r=Mark-Simulacrum
Adjust target search algorithm for rustlib path

With this the concerns expressed in #83800 should be addressed.

r? `@Mark-Simulacrum`
2021-05-10 20:05:27 +02:00
LeSeulArtichaut 6e8d0dbe11 Add documentation 2021-05-10 18:38:09 +02:00
Simonas Kazlauskas b7c5599d22 Adjust target search algorithm for rustlib path
With this the concerns expressed in #83800 should be addressed.
2021-05-10 19:15:19 +03:00
Fabian Wolff 98728c2b35 Implement changes suggested by tmiasko and davidtwco 2021-05-10 17:47:50 +02:00
bors 266f452118 Auto merge of #85150 - Dylan-DPC:rollup-q26gbx3, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #85050 (Fix suggestions for missing return type lifetime specifiers)
 - #85075 (Improve "panic message is not a string literal" warning)
 - #85096 (Make unchecked_{add,sub,mul} inherent methods unstably const)
 - #85112 (ensure failing promoteds in const/static bodies are handled correctly)
 - #85146 (Provide io::Seek::rewind)
 - #85147 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-10 15:08:08 +00:00
Dylan DPC 37c603864e
Rollup merge of #85075 - ptrojahn:panic_warning, r=jackh726
Improve "panic message is not a string literal" warning

This warning always referenced panic! even in case of an
assert. Related to #84656
2021-05-10 16:15:01 +02:00
Dylan DPC 0740015d59
Rollup merge of #85050 - FabianWolff:issue-84592, r=jackh726
Fix suggestions for missing return type lifetime specifiers

This pull request aims to fix #84592. The issue is that the current code seems to assume that there is only a single relevant span pointing to the missing lifetime, and only looks at the first one:
e5f83d24ae/compiler/rustc_resolve/src/late/lifetimes.rs (L2959)

This is incorrect, though, and leads to incorrect error messages and invalid suggestions. For instance, the example from #84592:
```rust
struct TwoLifetimes<'x, 'y> {
    x: &'x (),
    y: &'y (),
}

fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
    TwoLifetimes { x: &(), y: &() }
}
```
currently leads to:
```
error[E0106]: missing lifetime specifiers
 --> src/main.rs:6:57
  |
6 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
  |                            ---     ---                  ^^ expected 2 lifetime parameters
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider introducing a named lifetime parameter
  |
6 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'_<'a, 'a>, '_> {
  |                        ^^^^    ^^^^^^     ^^^^^^                  ^^^^^^^^^^
```
There are two problems:
- The error message is wrong. There is only _one_ lifetime parameter expected at the location pointed to by the error message (and another one at a separate location).
- The suggestion is incorrect and will not lead to correct code.

With the changes in this PR, I get the following output:
```
error[E0106]: missing lifetime specifiers
 --> p.rs:6:57
  |
6 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
  |                            ---     ---                  ^^  ^^ expected named lifetime parameter
  |                                                         |
  |                                                         expected named lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider introducing a named lifetime parameter
  |
6 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> {
  |                        ^^^^    ^^^^^^     ^^^^^^                  ^^  ^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0106`.
```
Mainly, I changed `add_missing_lifetime_specifiers_label()` to receive a _vector_ of spans (and counts) instead of just one, and adjusted its body accordingly.
2021-05-10 16:15:00 +02:00
Fabian Wolff 2448c7698e More minor fixes suggested by @jackh726 2021-05-10 15:02:15 +02:00
bors 544d124b81 Auto merge of #85079 - petrochenkov:sessclean, r=davidtwco
rustc_session: Move more option building code from the `options!` macro

The moved code doesn't need to be generated by a macro, it can use a regular (generic) function and type aliases instead.

(The refactoring is salvaged from a branch with different now abandoned work.)
2021-05-10 12:26:46 +00:00
Vadim Petrochenkov 273e0a2a05 rustc_session: Use Iterator::find instead of manual search 2021-05-10 14:52:31 +03:00
Vadim Petrochenkov 9d18d4df0e rustc_session: Move more option building code from the options! macro 2021-05-10 14:41:45 +03:00
bors 1b30245ea1 Auto merge of #85053 - camsteffen:duplicate-lint, r=davidtwco
Fix duplicate unknown lint errors

Fixes rust-lang/rust-clippy#6602
2021-05-10 09:45:28 +00:00
bors 2fb1dee14b Auto merge of #85104 - hi-rustin:rustin-patch-typo, r=jonas-schievink
Fix typo
2021-05-10 07:15:23 +00:00
hamidreza kalbasi 8f5585ac00 remove big match 2021-05-10 05:53:42 +04:30
bors d29289c509 Auto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisa
Add primary marker on codegen unit and generate main wrapper on primary codegen.

This is the codegen part of changes extracted from #84062.

This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.

cc #28937

I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
r? `@nagisa`
2021-05-10 00:42:31 +00:00
hamidreza kalbasi 48f5f01e8b move logic to a function 2021-05-10 03:31:31 +04:30
bors c55c26cb36 Auto merge of #83800 - xobs:impl-16351-nightly, r=nagisa
Add default search path to `Target::search()`

The function `Target::search()` accepts a target triple and returns a `Target` struct defining the requested target.

There is a `// FIXME 16351: add a sane default search path?` comment that indicates it is desirable to include some sort of default. This was raised in https://github.com/rust-lang/rust/issues/16351 which was closed without any resolution.

https://github.com/rust-lang/rust/pull/31117 was proposed, however that has platform-specific logic that is unsuitable for systems without `/etc/`.

This patch implements the suggestion raised in https://github.com/rust-lang/rust/issues/16351#issuecomment-180878193 where a `target.json` file may be placed in `$(rustc --print sysroot)/lib/rustlib/<target-triple>/target.json`. This allows shipping a toolchain distribution as a single file that gets extracted to the sysroot.
2021-05-09 22:01:26 +00:00
Fabian Wolff 3c0c3874fc Implement @jackh726's suggestions 2021-05-09 22:35:18 +02:00
bors ca82264ec7 Auto merge of #85065 - Mark-Simulacrum:preds-no-alloc, r=jackh726
Avoid predecessors having Drop impls

Should be a simple win - but let's make sure with perf.
2021-05-09 19:01:05 +00:00
bors 7a2f446889 Auto merge of #83894 - nikic:newpm, r=nagisa
Improve support for NewPM

This adds various missing bits of support for NewPM and allows us to successfully run stage 2 tests with NewPM enabled.

This does not yet enable NewPM by default, as there are still known issue on LLVM 12 (such as a weak fat LTO pipeline). The plan is to make the switch after we update to LLVM 13.
2021-05-09 16:19:21 +00:00
Paul Trojahn 8f14592aa2 Improve "panic message is not a string literal" warning
This warning always referenced panic! even in case of an
assert. Related to #84656
2021-05-09 17:56:50 +02:00
Ralf Jung bafc51e01a remove const_fn feature gate 2021-05-09 14:29:31 +02:00
hi-rustin fc544abe03 Fix typo 2021-05-09 12:24:58 +08:00
Joshua Nelson f25aa5767f Remove unused opt_span_warn function 2021-05-08 23:14:09 -04:00
Joshua Nelson ebbc949575 Note why Handler::fatal is different from Sesssion::fatal 2021-05-08 23:13:04 -04:00
Joshua Nelson 96509b4835 Make Diagnostic::span_fatal unconditionally raise an error
It had no callers which didn't immediately call `raise()`, and this
unifies the behavior with `Session`.
2021-05-08 23:12:04 -04:00
Joshua Nelson e49f4471aa Remove some unnecessary uses of struct_span_fatal
All of them immediately called `emit()` then `raise()`, so they could
just call `span_fatal` directly.
2021-05-08 23:12:04 -04:00
Joshua Nelson 955fdaea4a Rename Parser::span_fatal_err -> Parser::span_err
The name was misleading, it wasn't actually a fatal error.
2021-05-08 23:11:59 -04:00
Charles Lew 89a67051a7 Add primary marker on codegen unit to take charge of main_wrapper for non-local cases. 2021-05-09 10:52:03 +08:00
hamidreza kalbasi efc8f65b85 Try to fix issue 68049 2021-05-09 05:26:59 +04:30
LeSeulArtichaut f2077c728c Error on conflicting #[doc(inline)]/#[doc(no_inline)] attributes 2021-05-08 17:22:26 +02:00
LeSeulArtichaut 245f582139 Emit invalid_doc_attributes warnings in more cases 2021-05-08 16:42:22 +02:00
Nikita Popov c2b15a6b64 Support -C passes in NewPM
And report an error if parsing the additional pass pipeline fails.
Threading through the error accounts for most of the changes here.
2021-05-08 10:58:08 +02:00
Nikita Popov 5519cbfe33 Don't force -O1 with ThinLTO
This doesn't seem to be necessary anymore, although I don't know
at which point or why that changed.

Forcing -O1 makes some tests fail under NewPM, because NewPM also
performs inlining at -O1, so it ends up performing much more
optimization in practice than before.
2021-05-08 10:58:08 +02:00
Nikita Popov db140de8f2 Explicitly register GCOV profiling pass as well 2021-05-08 10:58:08 +02:00
Nikita Popov 5ecbe7fcf8 Explicitly register instrprof pass
Don't use "passes" for this purpose, explicitly insert it into
the correct place in the pipeline instead.
2021-05-08 10:58:08 +02:00
Nikita Popov 0318883cd6 Make -Z new-llvm-pass-manager an Option<bool>
To allow it to have an LLVM version dependent default.
2021-05-08 10:58:08 +02:00
Mark Rousskov 0367e24f94 Avoid predecessors having Drop impls 2021-05-07 22:44:08 -04:00
bors abf3ec5b33 Auto merge of #85057 - Dylan-DPC:rollup-efaseq2, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #76808 (Improve diagnostics for functions in `struct` definitions)
 - #84887 (Remove SpanInterner::get)
 - #85034 (fix null pointer error messages)
 - #85038 (Don't stop running rustdoc-gui tests at first failure)
 - #85044 (Use `path.exists()` instead of `fs::metadata(path).is_ok()`)
 - #85052 (rustdoc: Link to the docs on namespaces when an unknown disambiguator is found)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-08 00:37:38 +00:00
Dylan DPC b5092627c7
Rollup merge of #85044 - ChrisDenton:file-exists, r=jackh726
Use `path.exists()` instead of `fs::metadata(path).is_ok()`

It's more explicit and potentially allows platforms to optimize the existence check.
2021-05-08 01:06:26 +02:00
Dylan DPC bba8f99281
Rollup merge of #85034 - RalfJung:null-ptr, r=oli-obk
fix null pointer error messages

I got the `match` in https://github.com/rust-lang/rust/pull/84972 wrong, this fixes that.
Also avoid redundant "inbounds test failed:" prefix.

Should fix https://github.com/rust-lang/rust/issues/85027

r? `@oli-obk`
2021-05-08 01:06:24 +02:00