diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aad495fa3fae6..2a4c42ea0a456 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,5 +4,12 @@ Thank you for your interest in contributing to Rust! To get started, read the [Getting Started] guide in the [rustc-dev-guide]. +## Bug reports + +Did a compiler error message tell you to come here? If you want to create an ICE report, +refer to [this section][contributing-bug-reports] and [open an issue][issue template]. + [Getting Started]: https://rustc-dev-guide.rust-lang.org/getting-started.html [rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org/ +[contributing-bug-reports]: https://rustc-dev-guide.rust-lang.org/contributing.html#bug-reports +[issue template]: https://github.com/rust-lang/rust/issues/new/choose diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 557fb1aa550a5..f6060ac14e75e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -773,7 +773,8 @@ impl<'a> Builder<'a> { let my_out = match mode { // This is the intended out directory for compiler documentation. Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target), - _ => self.crate_doc_out(target), + Mode::Std => out_dir.join(target).join("doc"), + _ => panic!("doc mode {:?} not expected", mode), }; let rustdoc = self.rustdoc(compiler); self.clear_if_dirty(&my_out, &rustdoc); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 582bc9da0e804..3121690285868 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -417,21 +417,6 @@ impl Step for Std { builder.ensure(compile::Std { compiler, target }); let out_dir = builder.stage_out(compiler, Mode::Std).join(target).join("doc"); - // Here what we're doing is creating a *symlink* (directory junction on - // Windows) to the final output location. This is not done as an - // optimization but rather for correctness. We've got three trees of - // documentation, one for std, one for test, and one for rustc. It's then - // our job to merge them all together. - // - // Unfortunately rustbuild doesn't know nearly as well how to merge doc - // trees as rustdoc does itself, so instead of actually having three - // separate trees we just have rustdoc output to the same location across - // all of them. - // - // This way rustdoc generates output directly into the output, and rustdoc - // will also directly handle merging. - let my_out = builder.crate_doc_out(target); - t!(symlink_dir_force(&builder.config, &my_out, &out_dir)); t!(fs::copy(builder.src.join("src/doc/rust.css"), out.join("rust.css"))); let run_cargo_rustdoc_for = |package: &str| { @@ -439,12 +424,9 @@ impl Step for Std { builder.cargo(compiler, Mode::Std, SourceType::InTree, target, "rustdoc"); compile::std_cargo(builder, target, compiler.stage, &mut cargo); - cargo.arg("-p").arg(package); - // Create all crate output directories first to make sure rustdoc uses - // relative links. - // FIXME: Cargo should probably do this itself. - t!(fs::create_dir_all(out_dir.join(package))); cargo + .arg("-p") + .arg(package) .arg("--") .arg("--markdown-css") .arg("rust.css") @@ -462,11 +444,17 @@ impl Step for Std { // folder structure, that would also build internal crates that we do // not want to show in documentation. These crates will later be visited // by the rustc step, so internal documentation will show them. - let krates = ["alloc", "core", "std", "proc_macro", "test"]; + // + // Note that the order here is important! The crates need to be + // processed starting from the leaves, otherwise rustdoc will not + // create correct links between crates because rustdoc depends on the + // existence of the output directories to know if it should be a local + // or remote link. + let krates = ["core", "alloc", "std", "proc_macro", "test"]; for krate in &krates { run_cargo_rustdoc_for(krate); } - builder.cp_r(&my_out, &out); + builder.cp_r(&out_dir, &out); // Look for src/libstd, src/libcore etc in the `x.py doc` arguments and // open the corresponding rendered docs. @@ -529,8 +517,11 @@ impl Step for Rustc { // Build rustc. builder.ensure(compile::Rustc { compiler, target }); - // We do not symlink to the same shared folder that already contains std library - // documentation from previous steps as we do not want to include that. + // This uses a shared directory so that librustdoc documentation gets + // correctly built and merged with the rustc documentation. This is + // needed because rustdoc is built in a different directory from + // rustc. rustdoc needs to be able to see everything, for example when + // merging the search index, or generating local (relative) links. let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target).join("doc"); t!(symlink_dir_force(&builder.config, &out, &out_dir)); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 783a64c3581f9..9ca9e338d55c5 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -612,13 +612,6 @@ impl Build { INTERNER.intern_path(self.out.join(&*target).join("md-doc")) } - /// Output directory for all crate documentation for a target (temporary) - /// - /// The artifacts here are then copied into `doc_out` above. - fn crate_doc_out(&self, target: Interned) -> PathBuf { - self.out.join(&*target).join("crate-docs") - } - /// Returns `true` if no custom `llvm-config` is set for the specified target. /// /// If no custom `llvm-config` was specified then Rust's llvm will be used. diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index bb9091a66594b..f3781db1cf784 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -1697,6 +1697,8 @@ where pred: F, inner: DrainFilterInner<'a, K, V>, } +/// Most of the implementation of DrainFilter, independent of the type +/// of the predicate, thus also serving for BTreeSet::DrainFilter. pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> { length: &'a mut usize, cur_leaf_edge: Option, K, V, marker::Leaf>, marker::Edge>>, diff --git a/src/liballoc/collections/btree/navigate.rs b/src/liballoc/collections/btree/navigate.rs index 5478d822438b1..44f0e25bbd798 100644 --- a/src/liballoc/collections/btree/navigate.rs +++ b/src/liballoc/collections/btree/navigate.rs @@ -161,15 +161,16 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::Edge impl Handle, marker::Edge> { /// Moves the leaf edge handle to the next leaf edge and returns the key and value /// in between, while deallocating any node left behind. - /// Unsafe for three reasons: + /// Unsafe for two reasons: /// - The caller must ensure that the leaf edge is not the last one in the tree /// and is not a handle previously resulting from counterpart `next_back_unchecked`. - /// - If the leaf edge is the last edge of a node, that node and possibly ancestors + /// - Further use of the updated leaf edge handle is very dangerous. In particular, + /// if the leaf edge is the last edge of a node, that node and possibly ancestors /// will be deallocated, while the reference to those nodes in the surviving ancestor - /// is left dangling; thus further use of the leaf edge handle is dangerous. - /// It is, however, safe to call this method again on the updated handle. - /// if the two preconditions above hold. - /// - Using the updated handle may well invalidate the returned references. + /// is left dangling. + /// The only safe way to proceed with the updated handle is to compare it, drop it, + /// call this method again subject to both preconditions listed in the first point, + /// or call counterpart `next_back_unchecked` subject to its preconditions. pub unsafe fn next_unchecked(&mut self) -> (K, V) { unsafe { replace(self, |leaf_edge| { @@ -183,15 +184,16 @@ impl Handle, marker::Edge> { /// Moves the leaf edge handle to the previous leaf edge and returns the key /// and value in between, while deallocating any node left behind. - /// Unsafe for three reasons: + /// Unsafe for two reasons: /// - The caller must ensure that the leaf edge is not the first one in the tree /// and is not a handle previously resulting from counterpart `next_unchecked`. - /// - If the lead edge is the first edge of a node, that node and possibly ancestors + /// - Further use of the updated leaf edge handle is very dangerous. In particular, + /// if the leaf edge is the first edge of a node, that node and possibly ancestors /// will be deallocated, while the reference to those nodes in the surviving ancestor - /// is left dangling; thus further use of the leaf edge handle is dangerous. - /// It is, however, safe to call this method again on the updated handle. - /// if the two preconditions above hold. - /// - Using the updated handle may well invalidate the returned references. + /// is left dangling. + /// The only safe way to proceed with the updated handle is to compare it, drop it, + /// call this method again subject to both preconditions listed in the first point, + /// or call counterpart `next_unchecked` subject to its preconditions. pub unsafe fn next_back_unchecked(&mut self) -> (K, V) { unsafe { replace(self, |leaf_edge| { diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index a4b6cf12a23bd..ce74d4f8ee688 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -94,7 +94,8 @@ struct InternalNode { data: LeafNode, /// The pointers to the children of this node. `len + 1` of these are considered - /// initialized and valid. + /// initialized and valid. Although during the process of `into_iter` or `drop`, + /// some pointers are dangling while others still need to be traversed. edges: [MaybeUninit>; 2 * B], } @@ -408,7 +409,7 @@ impl NodeRef { impl<'a, K, V, Type> NodeRef, K, V, Type> { /// Unsafely asserts to the compiler some static information about whether this - /// node is a `Leaf`. + /// node is a `Leaf` or an `Internal`. unsafe fn cast_unchecked(&mut self) -> NodeRef, K, V, NewType> { NodeRef { height: self.height, node: self.node, root: self.root, _marker: PhantomData } } @@ -515,7 +516,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { } impl<'a, K, V> NodeRef, K, V, marker::Leaf> { - /// Adds a key/value pair the end of the node. + /// Adds a key/value pair to the end of the node. pub fn push(&mut self, key: K, val: V) { assert!(self.len() < CAPACITY); @@ -602,8 +603,10 @@ impl<'a, K, V> NodeRef, K, V, marker::Internal> { } impl<'a, K, V> NodeRef, K, V, marker::LeafOrInternal> { - /// Removes a key/value pair from the end of this node. If this is an internal node, - /// also removes the edge that was to the right of that pair. + /// Removes a key/value pair from the end of this node and returns the pair. + /// If this is an internal node, also removes the edge that was to the right + /// of that pair and returns the orphaned node that this edge owned with its + /// parent erased. pub fn pop(&mut self) -> (K, V, Option>) { assert!(self.len() > 0); @@ -883,7 +886,7 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: } /// Unsafely asserts to the compiler some static information about whether the underlying - /// node of this handle is a `Leaf`. + /// node of this handle is a `Leaf` or an `Internal`. unsafe fn cast_unchecked( &mut self, ) -> Handle, K, V, NewType>, marker::Edge> { diff --git a/src/libcore/convert/mod.rs b/src/libcore/convert/mod.rs index 8ff1ced53b071..94f7ff5c1f7fe 100644 --- a/src/libcore/convert/mod.rs +++ b/src/libcore/convert/mod.rs @@ -18,8 +18,9 @@ //! [`TryFrom`][`TryFrom`] rather than [`Into`][`Into`] or [`TryInto`][`TryInto`], //! as [`From`] and [`TryFrom`] provide greater flexibility and offer //! equivalent [`Into`] or [`TryInto`] implementations for free, thanks to a -//! blanket implementation in the standard library. Only implement [`Into`] or [`TryInto`] -//! when a conversion to a type outside the current crate is required. +//! blanket implementation in the standard library. When targeting a version prior to Rust 1.41, it +//! may be necessary to implement [`Into`] or [`TryInto`] directly when converting to a type +//! outside the current crate. //! //! # Generic Implementations //! @@ -298,8 +299,10 @@ pub trait Into: Sized { /// because implementing `From` automatically provides one with an implementation of [`Into`] /// thanks to the blanket implementation in the standard library. /// -/// Only implement [`Into`] if a conversion to a type outside the current crate is required. -/// `From` cannot do these type of conversions because of Rust's orphaning rules. +/// Only implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type +/// outside the current crate. +/// `From` was not able to do these types of conversions in earlier versions because of Rust's +/// orphaning rules. /// See [`Into`] for more details. /// /// Prefer using [`Into`] over using `From` when specifying trait bounds on a generic function. diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 393911675c73e..86e8d5c42b7ad 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2374,11 +2374,14 @@ impl str { unsafe { Slices { str: self }.slice } } - /// Converts a mutable string slice to a mutable byte slice. To convert the - /// mutable byte slice back into a mutable string slice, use the - /// [`str::from_utf8_mut`] function. + /// Converts a mutable string slice to a mutable byte slice. /// - /// [`str::from_utf8_mut`]: ./str/fn.from_utf8_mut.html + /// # Safety + /// + /// The caller must ensure that the content of the slice is valid UTF-8 + /// before the borrow ends and the underlying `str` is used. + /// + /// Use of a `str` whose contents are not valid UTF-8 is undefined behavior. /// /// # Examples /// diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index be11e29cb2575..982a615dd9195 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -65,8 +65,8 @@ pub const EXIT_SUCCESS: i32 = 0; /// Exit status code used for compilation failures and invalid flags. pub const EXIT_FAILURE: i32 = 1; -const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.\ - md#bug-reports"; +const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust/issues/new\ + ?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md"; const ICE_REPORT_COMPILER_FLAGS: &[&str] = &["Z", "C", "crate-type"]; diff --git a/src/librustc_macros/src/symbols.rs b/src/librustc_macros/src/symbols.rs index 0f8bc4323070b..2e9b3a2a2562f 100644 --- a/src/librustc_macros/src/symbols.rs +++ b/src/librustc_macros/src/symbols.rs @@ -87,18 +87,29 @@ pub fn symbols(input: TokenStream) -> TokenStream { let mut prefill_stream = quote! {}; let mut counter = 0u32; let mut keys = HashSet::::new(); + let mut prev_key: Option = None; + let mut errors = Vec::::new(); - let mut check_dup = |str: &str| { + let mut check_dup = |str: &str, errors: &mut Vec| { if !keys.insert(str.to_string()) { - panic!("Symbol `{}` is duplicated", str); + errors.push(format!("Symbol `{}` is duplicated", str)); } }; + let mut check_order = |str: &str, errors: &mut Vec| { + if let Some(ref prev_str) = prev_key { + if str < prev_str { + errors.push(format!("Symbol `{}` must precede `{}`", str, prev_str)); + } + } + prev_key = Some(str.to_string()); + }; + // Generate the listed keywords. for keyword in &input.keywords.0 { let name = &keyword.name; let value = &keyword.value; - check_dup(&value.value()); + check_dup(&value.value(), &mut errors); prefill_stream.extend(quote! { #value, }); @@ -116,7 +127,8 @@ pub fn symbols(input: TokenStream) -> TokenStream { Some(value) => value.value(), None => name.to_string(), }; - check_dup(&value); + check_dup(&value, &mut errors); + check_order(&name.to_string(), &mut errors); prefill_stream.extend(quote! { #value, }); @@ -131,7 +143,7 @@ pub fn symbols(input: TokenStream) -> TokenStream { // Generate symbols for the strings "0", "1", ..., "9". for n in 0..10 { let n = n.to_string(); - check_dup(&n); + check_dup(&n, &mut errors); prefill_stream.extend(quote! { #n, }); @@ -141,6 +153,13 @@ pub fn symbols(input: TokenStream) -> TokenStream { counter += 1; } + if !errors.is_empty() { + for error in errors.into_iter() { + eprintln!("error: {}", error) + } + panic!("errors in `Keywords` and/or `Symbols`"); + } + let tt = TokenStream::from(quote! { macro_rules! keywords { () => { diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index 86b770104ea8e..75f588918a020 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -19,6 +19,7 @@ use crate::{Span, DUMMY_SP, SESSION_GLOBALS}; #[cfg(test)] mod tests; +// The proc macro code for this is in `src/librustc_macros/src/symbols.rs`. symbols! { // After modifying this list adjust `is_special`, `is_used_keyword`/`is_unused_keyword`, // this should be rarely necessary though if the keywords are kept in alphabetic order. @@ -113,8 +114,79 @@ symbols! { // As well as the symbols listed, there are symbols for the the strings // "0", "1", ..., "9", which are accessible via `sym::integer`. // - // Keep this list in sorted order, as defined by the Unix `sort` utility. + // The proc macro will abort if symbols are not in alphabetical order (as + // defined by `impl Ord for str`) or if any symbols are duplicated. Vim + // users can sort the list by selecting it and executing the command + // `:'<,'>!LC_ALL=C sort`. + // + // There is currently no checking that all symbols are used; that would be + // nice to have. Symbols { + Arc, + ArgumentV1, + Arguments, + C, + Clone, + Copy, + Debug, + Decodable, + Default, + Encodable, + Eq, + Equal, + Err, + From, + Future, + FxHashMap, + FxHashSet, + GlobalAlloc, + Hash, + HashMap, + HashSet, + Input, + IntoIterator, + ItemContext, + Iterator, + Layout, + LintPass, + None, + Ok, + Option, + Ord, + Ordering, + Output, + PartialEq, + PartialOrd, + Pending, + Pin, + Poll, + ProcMacroHack, + ProceduralMasqueradeDummyType, + Range, + RangeFrom, + RangeFull, + RangeInclusive, + RangeTo, + RangeToInclusive, + Rc, + Ready, + Result, + Return, + RustcDecodable, + RustcEncodable, + Send, + Some, + Sync, + Target, + Try, + Ty, + TyCtxt, + TyKind, + Vec, + Yield, + _Self, + __next, + _task_context, aarch64_target_feature, abi, abi_amdgpu_kernel, @@ -131,8 +203,8 @@ symbols! { aborts, add, add_assign, - address, add_with_overflow, + address, advanced_slice_patterns, adx_target_feature, alias, @@ -141,28 +213,26 @@ symbols! { alignstack, all, alloc, - allocator, - allocator_internals, alloc_error_handler, alloc_layout, alloc_zeroed, + allocator, + allocator_internals, allow, - allowed, allow_fail, allow_internal_unsafe, allow_internal_unstable, allow_internal_unstable_backcompat_hack, + allowed, always, and, any, arbitrary_enum_discriminant, arbitrary_self_types, - Arc, - Arguments, - ArgumentV1, arith_offset, arm_target_feature, array, + as_str, asm, assert, assert_inhabited, @@ -173,16 +243,15 @@ symbols! { associated_type_bounds, associated_type_defaults, associated_types, - as_str, assume, assume_init, async_await, async_closure, atomics, + att_syntax, attr, - attributes, attr_literals, - att_syntax, + attributes, augmented_assignments, automatically_derived, avx512_target_feature, @@ -210,11 +279,11 @@ symbols! { braced_empty_structs, breakpoint, bswap, - C, + c_variadic, call, - caller_location, call_mut, call_once, + caller_location, cdylib, ceilf32, ceilf64, @@ -232,7 +301,6 @@ symbols! { char, clippy, clone, - Clone, clone_closures, clone_from, closure_to_fn_coercion, @@ -274,7 +342,6 @@ symbols! { context, convert, copy, - Copy, copy_closures, copy_nonoverlapping, copysignf32, @@ -303,18 +370,14 @@ symbols! { custom_derive, custom_inner_attributes, custom_test_frameworks, - c_variadic, dead_code, dealloc, debug, - Debug, debug_assertions, debug_trait, - declare_lint_pass, decl_macro, - Decodable, + declare_lint_pass, decode, - Default, default_lib_allocator, default_type_parameter_fallback, default_type_params, @@ -339,8 +402,8 @@ symbols! { doc_masked, doctest, document_private_items, - dotdoteq_in_patterns, dotdot_in_tuple_patterns, + dotdoteq_in_patterns, double_braced_closure: "{{closure}}", double_braced_constant: "{{constant}}", double_braced_constructor: "{{constructor}}", @@ -349,24 +412,20 @@ symbols! { double_braced_misc: "{{misc}}", double_braced_opaque: "{{opaque}}", drop, - dropck_eyepatch, - dropck_parametricity, drop_in_place, drop_types_in_const, + dropck_eyepatch, + dropck_parametricity, dylib, dyn_trait, eh_catch_typeinfo, eh_personality, enable, enclosing_scope, - Encodable, encode, env, eq, - Eq, - Equal, err, - Err, exact_div, except, exchange_malloc, @@ -382,12 +441,12 @@ symbols! { export_name, expr, extern_absolute_paths, - external_doc, extern_crate_item_prelude, extern_crate_self, extern_in_paths, extern_prelude, extern_types, + external_doc, f16c_target_feature, f32, f32_runtime, @@ -424,7 +483,6 @@ symbols! { freeze, frem_fast, from, - From, from_desugaring, from_error, from_generator, @@ -436,29 +494,22 @@ symbols! { fsub_fast, fundamental, future, - Future, future_trait, - FxHashMap, - FxHashSet, ge, + gen_future, + gen_kill, generator, - generators, generator_state, + generators, generic_associated_types, generic_param_attrs, - gen_future, - gen_kill, get_context, - GlobalAlloc, global_allocator, global_asm, globs, gt, half_open_range_patterns, hash, - Hash, - HashMap, - HashSet, hexagon_target_feature, hidden, homogeneous_aggregate, @@ -493,10 +544,8 @@ symbols! { inlateout, inline, inout, - Input, intel, into_iter, - IntoIterator, into_result, intrinsics, irrefutable_let_patterns, @@ -505,10 +554,8 @@ symbols! { issue_5723_bootstrap, issue_tracker_base_url, item, - item_context: "ItemContext", item_like_imports, iter, - Iterator, keyword, kind, label, @@ -516,7 +563,6 @@ symbols! { lang, lang_items, lateout, - Layout, lazy_normalization_consts, le, let_chains, @@ -527,14 +573,13 @@ symbols! { likely, line, link, - linkage, link_args, link_cfg, link_llvm_intrinsics, link_name, link_ordinal, link_section, - LintPass, + linkage, lint_reasons, literal, llvm_asm, @@ -543,9 +588,9 @@ symbols! { log10f64, log2f32, log2f64, + log_syntax, logf32, logf64, - log_syntax, loop_break_value, lt, macro_at_most_once_rep, @@ -554,9 +599,9 @@ symbols! { macro_lifetime_matcher, macro_literal_matcher, macro_reexport, - macros_in_extern, macro_use, macro_vis_matcher, + macros_in_extern, main, managed_boxes, manually_drop, @@ -567,23 +612,23 @@ symbols! { match_default_bindings, maxnumf32, maxnumf64, + may_dangle, maybe_uninit, maybe_uninit_uninit, maybe_uninit_zeroed, - may_dangle, - member_constraints, - memory, mem_uninitialized, mem_zeroed, + member_constraints, + memory, message, meta, min_align_of, min_align_of_val, min_const_fn, min_const_unsafe_fn, + min_specialization, minnumf32, minnumf64, - min_specialization, mips_target_feature, miri_start_panic, mmx_target_feature, @@ -615,7 +660,6 @@ symbols! { never_type, never_type_fallback, new, - __next, next, nll, no, @@ -629,47 +673,41 @@ symbols! { no_link, no_main, no_mangle, + no_niche, + no_sanitize, + no_stack_check, + no_start, + no_std, nomem, non_ascii_idents, - None, - none_error, non_exhaustive, - no_niche, non_modrs_mods, + none_error, nontemporal_store, nontrapping_dash_fptoint: "nontrapping-fptoint", noreturn, - no_sanitize, nostack, - no_stack_check, - no_start, - no_std, not, note, object_safe_for_dispatch, offset, - Ok, omit_gdb_pretty_printer_section, on, on_unimplemented, oom, opaque, ops, + opt_out_copy, optimize, optimize_attribute, optin_builtin_traits, option, - Option, option_env, - options, option_type, - opt_out_copy, + options, or, - Ord, - Ordering, or_patterns, out, - Output, overlapping_marker_traits, owned_box, packed, @@ -686,17 +724,13 @@ symbols! { param_attrs, parent_trait, partial_cmp, - PartialEq, partial_ord, - PartialOrd, passes, pat, path, pattern_parentheses, - Pending, phantom_data, pin, - Pin, pinned, platform_intrinsics, plugin, @@ -704,15 +738,14 @@ symbols! { plugins, pointer, poll, - Poll, post_dash_lto: "post-lto", powerpc_target_feature, powf32, powf64, powif32, powif64, - precise_pointer_size_matching, pre_dash_lto: "pre-lto", + precise_pointer_size_matching, pref_align_of, prefetch_read_data, prefetch_read_instruction, @@ -723,14 +756,12 @@ symbols! { preserves_flags, primitive, proc_dash_macro: "proc-macro", - ProceduralMasqueradeDummyType, proc_macro, proc_macro_attribute, proc_macro_def_site, proc_macro_derive, proc_macro_expr, proc_macro_gen, - ProcMacroHack, proc_macro_hygiene, proc_macro_internals, proc_macro_mod, @@ -747,18 +778,11 @@ symbols! { quad_precision_float, question_mark, quote, - Range, - RangeFrom, - RangeFull, - RangeInclusive, - RangeTo, - RangeToInclusive, raw_dylib, raw_identifiers, raw_ref_op, - Rc, + re_rebalance_coherence, readonly, - Ready, realloc, reason, receiver, @@ -779,11 +803,8 @@ symbols! { repr_packed, repr_simd, repr_transparent, - re_rebalance_coherence, result, - Result, result_type, - Return, rhs, rintf32, rintf64, @@ -799,6 +820,10 @@ symbols! { rust_2015_preview, rust_2018_preview, rust_begin_unwind, + rust_eh_personality, + rust_eh_register_frames, + rust_eh_unregister_frames, + rust_oom, rustc, rustc_allocator, rustc_allocator_nounwind, @@ -810,7 +835,6 @@ symbols! { rustc_const_stable, rustc_const_unstable, rustc_conversion_suggestion, - RustcDecodable, rustc_def_path, rustc_deprecated, rustc_diagnostic_item, @@ -820,7 +844,6 @@ symbols! { rustc_dump_env_program_clauses, rustc_dump_program_clauses, rustc_dump_user_substs, - RustcEncodable, rustc_error, rustc_expected_cgu_reuse, rustc_if_this_changed, @@ -857,19 +880,15 @@ symbols! { rustc_then_this_would_need, rustc_unsafe_specialization_marker, rustc_variance, - rust_eh_personality, rustfmt, - rust_oom, rvalue_static_promotion, sanitize, sanitizer_runtime, saturating_add, saturating_sub, - _Self, self_in_typedefs, self_struct_ctor, semitransparent, - Send, send_trait, shl, shl_assign, @@ -937,9 +956,9 @@ symbols! { sinf32, sinf64, size, - sized, size_of, size_of_val, + sized, slice, slice_alloc, slice_patterns, @@ -947,7 +966,6 @@ symbols! { slice_u8_alloc, slicing_syntax, soft, - Some, specialization, speed, sqrtf32, @@ -957,9 +975,9 @@ symbols! { staged_api, start, static_in_const, - staticlib, static_nobundle, static_recursion, + staticlib, std, std_inject, stmt, @@ -970,10 +988,10 @@ symbols! { stringify, struct_field_attributes, struct_inherit, + struct_variant, structural_match, structural_peq, structural_teq, - struct_variant, sty, sub, sub_assign, @@ -981,9 +999,7 @@ symbols! { suggestion, sym, sync, - Sync, sync_trait, - Target, target_arch, target_endian, target_env, @@ -998,7 +1014,6 @@ symbols! { target_thread_local, target_vendor, task, - _task_context, tbm_target_feature, termination, termination_trait, @@ -1024,7 +1039,6 @@ symbols! { trivial_bounds, truncf32, truncf64, - Try, try_blocks, try_trait, tt, @@ -1032,9 +1046,6 @@ symbols! { tuple_indexing, two_phase, ty, - Ty, - TyCtxt, - TyKind, type_alias_enum_variants, type_alias_impl_trait, type_ascription, @@ -1082,21 +1093,20 @@ symbols! { unwind, unwind_attributes, unwrap_or, - used, use_extern_macros, use_nested_groups, + used, usize, v1, va_arg, va_copy, va_end, - val, va_list, + va_start, + val, var, variant_count, - va_start, vec, - Vec, vec_type, version, vis, @@ -1117,7 +1127,6 @@ symbols! { wrapping_mul, wrapping_sub, write_bytes, - Yield, } } diff --git a/src/librustc_trait_selection/traits/error_reporting/on_unimplemented.rs b/src/librustc_trait_selection/traits/error_reporting/on_unimplemented.rs index ec51dddc2c810..d2b9f84af33ae 100644 --- a/src/librustc_trait_selection/traits/error_reporting/on_unimplemented.rs +++ b/src/librustc_trait_selection/traits/error_reporting/on_unimplemented.rs @@ -126,7 +126,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { let mut flags = vec![]; flags.push(( - sym::item_context, + sym::ItemContext, self.describe_enclosure(obligation.cause.body_id).map(|s| s.to_owned()), )); diff --git a/src/librustc_trait_selection/traits/on_unimplemented.rs b/src/librustc_trait_selection/traits/on_unimplemented.rs index a1dfa838e7af3..deb33708681fa 100644 --- a/src/librustc_trait_selection/traits/on_unimplemented.rs +++ b/src/librustc_trait_selection/traits/on_unimplemented.rs @@ -286,7 +286,7 @@ impl<'tcx> OnUnimplementedFormatString { // `{from_desugaring}` is allowed Position::ArgumentNamed(s) if s == sym::from_desugaring => (), // `{ItemContext}` is allowed - Position::ArgumentNamed(s) if s == sym::item_context => (), + Position::ArgumentNamed(s) if s == sym::ItemContext => (), // So is `{A}` if A is a type parameter Position::ArgumentNamed(s) => { match generics.params.iter().find(|param| param.name == s) { @@ -350,7 +350,7 @@ impl<'tcx> OnUnimplementedFormatString { let s = self.0.as_str(); let parser = Parser::new(&s, None, None, false, ParseMode::Format); - let item_context = (options.get(&sym::item_context)).unwrap_or(&empty_string); + let item_context = (options.get(&sym::ItemContext)).unwrap_or(&empty_string); parser .map(|p| match p { Piece::String(s) => s, @@ -364,7 +364,7 @@ impl<'tcx> OnUnimplementedFormatString { } else if s == sym::from_desugaring || s == sym::from_method { // don't break messages using these two arguments incorrectly &empty_string - } else if s == sym::item_context { + } else if s == sym::ItemContext { &item_context } else { bug!( diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 490afb5a0438f..29893bd12f1f7 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -47,8 +47,6 @@ hermit-abi = { version = "0.1.14", features = ['rustc-dep-of-std'] } wasi = { version = "0.9.0", features = ['rustc-dep-of-std'], default-features = false } [features] -default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"] - backtrace = [ "backtrace_rs/dbghelp", # backtrace/symbolize on MSVC "backtrace_rs/libbacktrace", # symbolize on most platforms diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 5215db7cdb3ce..4fd5e238eea11 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -85,8 +85,9 @@ //! # Contributing changes to the documentation //! //! Check out the rust contribution guidelines [here]( -//! https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md). -//! The source for this documentation can be found on [Github](https://github.com/rust-lang). +//! https://rustc-dev-guide.rust-lang.org/getting-started.html). +//! The source for this documentation can be found on +//! [GitHub](https://github.com/rust-lang/rust). //! To contribute changes, make sure you read the guidelines first, then submit //! pull-requests for your suggested changes. //! diff --git a/src/libtest/Cargo.toml b/src/libtest/Cargo.toml index 170fbb984cf9b..1667334871d5e 100644 --- a/src/libtest/Cargo.toml +++ b/src/libtest/Cargo.toml @@ -23,9 +23,12 @@ proc_macro = { path = "../libproc_macro" } # Forward features to the `std` crate as necessary [features] +default = ["std_detect_file_io", "std_detect_dlsym_getauxval", "panic-unwind"] backtrace = ["std/backtrace"] compiler-builtins-c = ["std/compiler-builtins-c"] llvm-libunwind = ["std/llvm-libunwind"] panic-unwind = ["std/panic_unwind"] panic_immediate_abort = ["std/panic_immediate_abort"] profiler = ["std/profiler"] +std_detect_file_io = ["std/std_detect_file_io"] +std_detect_dlsym_getauxval = ["std/std_detect_dlsym_getauxval"] diff --git a/src/test/ui/pattern/const-pat-ice.stderr b/src/test/ui/pattern/const-pat-ice.stderr index d0018cef5f033..6e87e5c6912c3 100644 --- a/src/test/ui/pattern/const-pat-ice.stderr +++ b/src/test/ui/pattern/const-pat-ice.stderr @@ -5,7 +5,7 @@ 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/blob/master/CONTRIBUTING.md#bug-reports +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 VERSION running on TARGET