diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index 65999ba707c85..719c2c6768bc8 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -359,6 +359,7 @@ E0621: include_str!("./error_codes/E0621.md"), E0622: include_str!("./error_codes/E0622.md"), E0623: include_str!("./error_codes/E0623.md"), E0624: include_str!("./error_codes/E0624.md"), +E0625: include_str!("./error_codes/E0625.md"), E0626: include_str!("./error_codes/E0626.md"), E0627: include_str!("./error_codes/E0627.md"), E0628: include_str!("./error_codes/E0628.md"), @@ -622,7 +623,6 @@ E0783: include_str!("./error_codes/E0783.md"), // E0611, // merged into E0616 // E0612, // merged into E0609 // E0613, // Removed (merged with E0609) - E0625, // thread-local statics cannot be accessed at compile-time // E0629, // missing 'feature' (rustc_const_unstable) // E0630, // rustc_const_unstable attribute must be paired with stable/unstable // attribute diff --git a/compiler/rustc_error_codes/src/error_codes/E0625.md b/compiler/rustc_error_codes/src/error_codes/E0625.md new file mode 100644 index 0000000000000..7db857723ccbb --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0625.md @@ -0,0 +1,28 @@ +A compile-time const variable is referring to a thread-local static variable. + +Erroneous code example: + +```compile_fail,E0625 +#![feature(thread_local)] + +#[thread_local] +static X: usize = 12; + +const Y: usize = 2 * X; +``` + +Static and const variables can refer to other const variables but a const +variable cannot refer to a thread-local static variable. In this example, +`Y` cannot refer to `X`. To fix this, the value can be extracted as a const +and then used: + +``` +#![feature(thread_local)] + +const C: usize = 12; + +#[thread_local] +static X: usize = C; + +const Y: usize = 2 * C; +``` diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 09beda3348374..3629e668fa9f8 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -559,7 +559,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.cx.force_mode = orig_force_mode; // Finally incorporate all the expanded macros into the input AST fragment. - let mut placeholder_expander = PlaceholderExpander::new(self.cx, self.monotonic); + let mut placeholder_expander = PlaceholderExpander::default(); while let Some(expanded_fragments) = expanded_fragments.pop() { for (expn_id, expanded_fragment) in expanded_fragments.into_iter().rev() { placeholder_expander @@ -1341,14 +1341,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } } - // The placeholder expander gives ids to statements, so we avoid folding the id here. // We don't use `assign_id!` - it will be called when we visit statement's contents // (e.g. an expression, item, or local) - let ast::Stmt { id, kind, span } = stmt; - let res = noop_flat_map_stmt_kind(kind, self) - .into_iter() - .map(|kind| ast::Stmt { id, kind, span }) - .collect(); + let res = noop_flat_map_stmt(stmt, self); self.cx.current_expansion.is_trailing_mac = false; res diff --git a/compiler/rustc_expand/src/placeholders.rs b/compiler/rustc_expand/src/placeholders.rs index 6586ba138fb99..8e78fcbb8dbc1 100644 --- a/compiler/rustc_expand/src/placeholders.rs +++ b/compiler/rustc_expand/src/placeholders.rs @@ -1,4 +1,3 @@ -use crate::base::ExtCtxt; use crate::expand::{AstFragment, AstFragmentKind}; use rustc_ast as ast; @@ -175,17 +174,12 @@ pub fn placeholder( } } -pub struct PlaceholderExpander<'a, 'b> { +#[derive(Default)] +pub struct PlaceholderExpander { expanded_fragments: FxHashMap, - cx: &'a mut ExtCtxt<'b>, - monotonic: bool, } -impl<'a, 'b> PlaceholderExpander<'a, 'b> { - pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self { - PlaceholderExpander { cx, expanded_fragments: FxHashMap::default(), monotonic } - } - +impl PlaceholderExpander { pub fn add(&mut self, id: ast::NodeId, mut fragment: AstFragment) { fragment.mut_visit_with(self); self.expanded_fragments.insert(id, fragment); @@ -196,7 +190,7 @@ impl<'a, 'b> PlaceholderExpander<'a, 'b> { } } -impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { +impl MutVisitor for PlaceholderExpander { fn flat_map_arm(&mut self, arm: ast::Arm) -> SmallVec<[ast::Arm; 1]> { if arm.is_placeholder { self.remove(arm.id).make_arms() @@ -360,15 +354,4 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { _ => noop_visit_ty(ty, self), } } - - fn visit_block(&mut self, block: &mut P) { - noop_visit_block(block, self); - - for stmt in block.stmts.iter_mut() { - if self.monotonic { - assert_eq!(stmt.id, ast::DUMMY_NODE_ID); - stmt.id = self.cx.resolver.next_node_id(); - } - } - } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index aac5d296f17b5..fe1d190b4ec1a 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1,4 +1,3 @@ -// ignore-tidy-filelength use crate::def::{CtorKind, DefKind, Res}; use crate::def_id::{DefId, CRATE_DEF_ID}; crate use crate::hir_id::{HirId, ItemLocalId}; diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index de0d5fb0097f9..b896143400698 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -740,6 +740,7 @@ fn test_debugging_options_tracking_hash() { tracked!(new_llvm_pass_manager, Some(true)); tracked!(no_generate_arange_section, true); tracked!(no_link, true); + tracked!(no_profiler_runtime, true); tracked!(osx_rpath_install_name, true); tracked!(panic_abort_tests, true); tracked!(plt, Some(true)); @@ -748,7 +749,7 @@ fn test_debugging_options_tracking_hash() { tracked!(print_fuel, Some("abc".to_string())); tracked!(profile, true); tracked!(profile_emit, Some(PathBuf::from("abc"))); - tracked!(profiler_runtime, None); + tracked!(profiler_runtime, "abc".to_string()); tracked!(relax_elf_relocations, Some(true)); tracked!(relro_level, Some(RelroLevel::Full)); tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc"))); diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index c590cd00bd545..f341ca686593c 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1,5 +1,3 @@ -// ignore-tidy-filelength - //! Lints in the Rust compiler. //! //! This contains lints which can feasibly be implemented as their own diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 9b1ee53df23bd..8376734166bb8 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1,5 +1,3 @@ -// ignore-tidy-filelength - //! Some lints that are built in to the compiler. //! //! These are the built-in lints that are emitted direct in the main diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index 5373169bda7ab..394cb8389357f 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -777,19 +777,17 @@ impl<'a> CrateLoader<'a> { } fn inject_profiler_runtime(&mut self, krate: &ast::Crate) { - let profiler_runtime = &self.sess.opts.debugging_opts.profiler_runtime; - - if !(profiler_runtime.is_some() - && (self.sess.instrument_coverage() + if self.sess.opts.debugging_opts.no_profiler_runtime + || !(self.sess.instrument_coverage() || self.sess.opts.debugging_opts.profile - || self.sess.opts.cg.profile_generate.enabled())) + || self.sess.opts.cg.profile_generate.enabled()) { return; } info!("loading profiler"); - let name = Symbol::intern(profiler_runtime.as_ref().unwrap()); + let name = Symbol::intern(&self.sess.opts.debugging_opts.profiler_runtime); if name == sym::profiler_builtins && self.sess.contains_name(&krate.attrs, sym::no_core) { self.sess.err( "`profiler_builtins` crate (required by compiler options) \ diff --git a/compiler/rustc_metadata/src/locator.rs b/compiler/rustc_metadata/src/locator.rs index 4936b22c7b983..cf8577a26cf71 100644 --- a/compiler/rustc_metadata/src/locator.rs +++ b/compiler/rustc_metadata/src/locator.rs @@ -1103,8 +1103,8 @@ impl CrateError { if sess.is_nightly_build() { err.help("consider building the standard library from source with `cargo build -Zbuild-std`"); } - } else if Some(crate_name) - == sess.opts.debugging_opts.profiler_runtime.as_deref().map(Symbol::intern) + } else if crate_name + == Symbol::intern(&sess.opts.debugging_opts.profiler_runtime) { err.note(&"the compiler may have been built without the profiler runtime"); } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 2e4395cfca8c1..423f3faf21fff 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -1,4 +1,3 @@ -// ignore-tidy-filelength use crate::ich::StableHashingContext; use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; use crate::mir::{GeneratorLayout, GeneratorSavedLocal}; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index ec23a0769af77..95a7b0994b8ad 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1172,6 +1172,8 @@ options! { "compile without linking"), no_parallel_llvm: bool = (false, parse_no_flag, [UNTRACKED], "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"), + no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED], + "prevent automatic injection of the profiler_builtins crate"), normalize_docs: bool = (false, parse_bool, [TRACKED], "normalize associated items in rustdoc when generating documentation"), osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], @@ -1217,8 +1219,8 @@ options! { profile_emit: Option = (None, parse_opt_pathbuf, [TRACKED], "file path to emit profiling data at runtime when using 'profile' \ (default based on relative source path)"), - profiler_runtime: Option = (Some(String::from("profiler_builtins")), parse_opt_string, [TRACKED], - "name of the profiler runtime crate to automatically inject, or None to disable"), + profiler_runtime: String = (String::from("profiler_builtins"), parse_string, [TRACKED], + "name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)"), query_dep_graph: bool = (false, parse_bool, [UNTRACKED], "enable queries of the dependency graph for regression testing (default: no)"), query_stats: bool = (false, parse_bool, [UNTRACKED], diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index 0cfdde26c2b8f..fd0544a47bb7c 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -613,7 +613,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { param_counts.consts + named_type_param_count - default_counts.types - default_counts.consts - - synth_type_param_count }; debug!("expected_min: {:?}", expected_min); debug!("arg_counts.lifetimes: {:?}", gen_args.num_lifetime_params()); diff --git a/compiler/rustc_typeck/src/check/dropck.rs b/compiler/rustc_typeck/src/check/dropck.rs index 01276495c185a..17f5020300d40 100644 --- a/compiler/rustc_typeck/src/check/dropck.rs +++ b/compiler/rustc_typeck/src/check/dropck.rs @@ -218,9 +218,9 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( // This closure is a more robust way to check `Predicate` equality // than simple `==` checks (which were the previous implementation). - // It relies on `ty::relate` for `TraitPredicate` and `ProjectionPredicate` - // (which implement the Relate trait), while delegating on simple equality - // for the other `Predicate`. + // It relies on `ty::relate` for `TraitPredicate`, `ProjectionPredicate`, + // `ConstEvaluatable` and `TypeOutlives` (which implement the Relate trait), + // while delegating on simple equality for the other `Predicate`. // This implementation solves (Issue #59497) and (Issue #58311). // It is unclear to me at the moment whether the approach based on `relate` // could be extended easily also to the other `Predicate`. @@ -235,6 +235,13 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( (ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => { relator.relate(predicate.rebind(a), p.rebind(b)).is_ok() } + ( + ty::PredicateKind::ConstEvaluatable(def_a, substs_a), + ty::PredicateKind::ConstEvaluatable(def_b, substs_b), + ) => tcx.try_unify_abstract_consts(((def_a, substs_a), (def_b, substs_b))), + (ty::PredicateKind::TypeOutlives(a), ty::PredicateKind::TypeOutlives(b)) => { + relator.relate(predicate.rebind(a.0), p.rebind(b.0)).is_ok() + } _ => predicate == p, } }; diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 06cb33b9ebf4b..eb94fde21099b 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -1,4 +1,3 @@ -// ignore-tidy-filelength //! "Collection" is the process of determining the type and other external //! details of each item in Rust. Collection is specifically concerned //! with *inter-procedural* things -- for example, for a function @@ -15,8 +14,6 @@ //! At present, however, we do run collection across all items in the //! crate as a kind of pass. This should eventually be factored away. -// ignore-tidy-filelength - use crate::astconv::{AstConv, SizedByDefault}; use crate::bounds::Bounds; use crate::check::intrinsic::intrinsic_operation_unsafety; diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 3cf6c56f43a57..6bbddeb69b296 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -697,7 +697,9 @@ impl VecDeque { /// /// Note that the allocator may give the collection more space than it /// requests. Therefore, capacity can not be relied upon to be precisely - /// minimal. Prefer `reserve` if future insertions are expected. + /// minimal. Prefer [`reserve`] if future insertions are expected. + /// + /// [`reserve`]: VecDeque::reserve /// /// # Errors /// diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 5411316f55af0..a6b8bdef89c11 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1035,7 +1035,9 @@ impl String { /// /// Note that the allocator may give the collection more space than it /// requests. Therefore, capacity can not be relied upon to be precisely - /// minimal. Prefer `reserve` if future insertions are expected. + /// minimal. Prefer [`reserve`] if future insertions are expected. + /// + /// [`reserve`]: String::reserve /// /// # Errors /// diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 0db06812a4cbe..c54c91509d48b 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -811,7 +811,9 @@ impl Vec { /// /// Note that the allocator may give the collection more space than it /// requests. Therefore, capacity can not be relied upon to be precisely - /// minimal. Prefer `reserve` if future insertions are expected. + /// minimal. Prefer [`reserve`] if future insertions are expected. + /// + /// [`reserve`]: Vec::reserve /// /// # Panics /// @@ -875,7 +877,9 @@ impl Vec { /// /// Note that the allocator may give the collection more space than it /// requests. Therefore, capacity can not be relied upon to be precisely - /// minimal. Prefer `reserve` if future insertions are expected. + /// minimal. Prefer [`reserve`] if future insertions are expected. + /// + /// [`reserve`]: Vec::reserve /// /// # Errors /// diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 537e42f66de1b..c199b068cbb59 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -1,7 +1,3 @@ -// ignore-tidy-filelength -// This file almost exclusively consists of the definition of `Iterator`. We -// can't split that into multiple files. - use crate::cmp::{self, Ordering}; use crate::ops::{ControlFlow, Try}; diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index 419bf0e292ae1..d67af9cf6680c 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -1,4 +1,3 @@ -// ignore-tidy-filelength //! Definitions of a bunch of iterators for `[T]`. #[macro_use] // import iterator! and forward_iterator! diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 67eecab99d89a..51227d5411549 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -1,5 +1,3 @@ -// ignore-tidy-filelength - //! Slice management and manipulation. //! //! For more details see [`std::slice`]. diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 933d686521e53..1628e1bceda72 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -1,5 +1,3 @@ -// ignore-tidy-filelength - #[cfg(test)] mod tests; diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 2a85f375ae279..84735345ac3b6 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -271,7 +271,9 @@ impl OsString { /// /// Note that the allocator may give the collection more space than it /// requests. Therefore, capacity can not be relied upon to be precisely - /// minimal. Prefer reserve if future insertions are expected. + /// minimal. Prefer [`reserve`] if future insertions are expected. + /// + /// [`reserve`]: OsString::reserve /// /// # Examples /// diff --git a/library/std/src/os/linux/process.rs b/library/std/src/os/linux/process.rs index 91547b8f91622..6daff0f003c8f 100644 --- a/library/std/src/os/linux/process.rs +++ b/library/std/src/os/linux/process.rs @@ -5,6 +5,7 @@ use crate::io::Result; use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use crate::process; +use crate::sealed::Sealed; #[cfg(not(doc))] use crate::sys::fd::FileDesc; use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; @@ -84,15 +85,10 @@ impl IntoRawFd for PidFd { } } -mod private_child_ext { - pub trait Sealed {} - impl Sealed for crate::process::Child {} -} - /// Os-specific extensions for [`Child`] /// /// [`Child`]: process::Child -pub trait ChildExt: private_child_ext::Sealed { +pub trait ChildExt: Sealed { /// Obtains a reference to the [`PidFd`] created for this [`Child`], if available. /// /// A pidfd will only be available if its creation was requested with @@ -120,15 +116,10 @@ pub trait ChildExt: private_child_ext::Sealed { fn take_pidfd(&mut self) -> Result; } -mod private_command_ext { - pub trait Sealed {} - impl Sealed for crate::process::Command {} -} - /// Os-specific extensions for [`Command`] /// /// [`Command`]: process::Command -pub trait CommandExt: private_command_ext::Sealed { +pub trait CommandExt: Sealed { /// Sets whether a [`PidFd`](struct@PidFd) should be created for the [`Child`] /// spawned by this [`Command`]. /// By default, no pidfd will be created. diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 99c3369425b06..d3e271df8d8cc 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -205,6 +205,10 @@ pub struct Child { pub stderr: Option, } +/// Allows extension traits within `std`. +#[unstable(feature = "sealed", issue = "none")] +impl crate::sealed::Sealed for Child {} + impl AsInner for Child { fn as_inner(&self) -> &imp::Process { &self.handle diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 90ef48798ddab..b265760dc5757 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -165,6 +165,7 @@ target | std | notes `wasm32-unknown-unknown` | ✓ | WebAssembly `wasm32-wasi` | ✓ | WebAssembly with WASI `x86_64-apple-ios` | ✓ | 64-bit x86 iOS +[`aarch64-apple-ios-sim`](platform-support/aarch64-apple-ios-sim.md) | ✓ | | Apple iOS Simulator on ARM64 `x86_64-fortanix-unknown-sgx` | ✓ | [Fortanix ABI] for 64-bit Intel SGX `x86_64-fuchsia` | ✓ | 64-bit Fuchsia `x86_64-linux-android` | ✓ | 64-bit x86 Android @@ -196,7 +197,6 @@ host tools. target | std | host | notes -------|:---:|:----:|------- `aarch64-apple-ios-macabi` | ? | | Apple Catalyst on ARM64 -[`aarch64-apple-ios-sim`](platform-support/aarch64-apple-ios-sim.md) | ✓ | | Apple iOS Simulator on ARM64 `aarch64-apple-tvos` | * | | ARM64 tvOS `aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD `aarch64-unknown-hermit` | ? | | diff --git a/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md b/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md index 9aa5db26f917e..3f29e2c5e1f7a 100644 --- a/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md +++ b/src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md @@ -1,6 +1,6 @@ # aarch64-apple-ios-sim -**Tier: 3** +**Tier: 2** Apple iOS Simulator on ARM64. @@ -39,17 +39,16 @@ Currently there is no support to run the rustc test suite for this target. *Note: Building for this target requires the corresponding iOS SDK, as provided by Xcode 12+.* -If `rustc` has support for that target and the library artifacts are available, -then Rust programs can be built for that target: +From Rust Nightly 1.56.0 (2021-08-03) on the artifacts are shipped pre-compiled: ```text -rustc --target aarch64-apple-ios-sim your-code.rs +rustup target add aarch64-apple-ios-sim --toolchain nightly ``` -On Rust Nightly it is possible to build without the target artifacts available: +Rust programs can be built for that target: ```text -cargo build -Z build-std --target aarch64-apple-ios-sim +rustc --target aarch64-apple-ios-sim your-code.rs ``` There is no easy way to run simple programs in the iOS simulator. diff --git a/src/test/ui/asm/naked-functions-ffi.rs b/src/test/ui/asm/naked-functions-ffi.rs new file mode 100644 index 0000000000000..5b2a8ed3034a6 --- /dev/null +++ b/src/test/ui/asm/naked-functions-ffi.rs @@ -0,0 +1,12 @@ +// check-pass +// only-x86_64 +#![feature(asm)] +#![feature(naked_functions)] +#![crate_type = "lib"] + +#[naked] +pub extern "C" fn naked(p: char) -> u128 { + //~^ WARN uses type `char` + //~| WARN uses type `u128` + unsafe { asm!("", options(noreturn)); } +} diff --git a/src/test/ui/asm/naked-functions-ffi.stderr b/src/test/ui/asm/naked-functions-ffi.stderr new file mode 100644 index 0000000000000..a6772badeb65f --- /dev/null +++ b/src/test/ui/asm/naked-functions-ffi.stderr @@ -0,0 +1,20 @@ +warning: `extern` fn uses type `char`, which is not FFI-safe + --> $DIR/naked-functions-ffi.rs:8:28 + | +LL | pub extern "C" fn naked(p: char) -> u128 { + | ^^^^ not FFI-safe + | + = note: `#[warn(improper_ctypes_definitions)]` on by default + = help: consider using `u32` or `libc::wchar_t` instead + = note: the `char` type has no C equivalent + +warning: `extern` fn uses type `u128`, which is not FFI-safe + --> $DIR/naked-functions-ffi.rs:8:37 + | +LL | pub extern "C" fn naked(p: char) -> u128 { + | ^^^^ not FFI-safe + | + = note: 128-bit integers don't currently have a known stable ABI + +warning: 2 warnings emitted + diff --git a/src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs b/src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs new file mode 100644 index 0000000000000..41fb5d70afd6e --- /dev/null +++ b/src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs @@ -0,0 +1,16 @@ +//check-pass +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] + +struct Foo +where + [(); N + 1]: ; + +impl Drop for Foo +where + [(); N + 1]: , +{ + fn drop(&mut self) {} +} + +fn main() {} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index 739e55e294381..3add0429d2d58 100644 --- a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -1,12 +1,12 @@ -error[E0107]: this function takes at most 1 generic argument but 2 generic arguments were supplied +error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/explicit-generic-args-for-impl.rs:6:5 | LL | foo::("".to_string()); | ^^^ ------ help: remove this generic argument | | - | expected at most 1 generic argument + | expected 1 generic argument | -note: function defined here, with at most 1 generic parameter: `T` +note: function defined here, with 1 generic parameter: `T` --> $DIR/explicit-generic-args-for-impl.rs:3:4 | LL | fn foo(_f: impl AsRef) {} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs new file mode 100644 index 0000000000000..e2ee63821ae74 --- /dev/null +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs @@ -0,0 +1,9 @@ +// check-pass + +#![feature(explicit_generic_args_with_impl_trait)] + +fn f(_: impl AsRef, _: impl AsRef) {} + +fn main() { + f::<[u8]>("a", b"a"); +} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.rs b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.rs new file mode 100644 index 0000000000000..ffb0582fe8df4 --- /dev/null +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.rs @@ -0,0 +1,8 @@ +#![feature(explicit_generic_args_with_impl_trait)] + +fn f(_: impl AsRef, _: impl AsRef) {} + +fn main() { + f::<[u8]>("a", b"a"); + //~^ ERROR: this function takes 2 generic arguments but 1 generic argument was supplied +} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr new file mode 100644 index 0000000000000..233b47445db02 --- /dev/null +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr @@ -0,0 +1,21 @@ +error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied + --> $DIR/not-enough-args.rs:6:5 + | +LL | f::<[u8]>("a", b"a"); + | ^ ---- supplied 1 generic argument + | | + | expected 2 generic arguments + | +note: function defined here, with 2 generic parameters: `T`, `U` + --> $DIR/not-enough-args.rs:3:4 + | +LL | fn f(_: impl AsRef, _: impl AsRef) {} + | ^ - - +help: add missing generic argument + | +LL | f::<[u8], U>("a", b"a"); + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/thread-local-in-ctfe.stderr b/src/test/ui/thread-local-in-ctfe.stderr index 9890597b7bd5b..fd967604624cb 100644 --- a/src/test/ui/thread-local-in-ctfe.stderr +++ b/src/test/ui/thread-local-in-ctfe.stderr @@ -30,3 +30,4 @@ LL | A error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0625`. diff --git a/src/test/ui/thread-local-static.stderr b/src/test/ui/thread-local-static.stderr index 08bf593a5a748..712050a25fcfe 100644 --- a/src/test/ui/thread-local-static.stderr +++ b/src/test/ui/thread-local-static.stderr @@ -40,5 +40,5 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) error: aborting due to 5 previous errors -Some errors have detailed explanations: E0013, E0133, E0658. +Some errors have detailed explanations: E0013, E0133, E0625, E0658. For more information about an error, try `rustc --explain E0013`. diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 15ed2f7a0a975..d8d3dc3ddb1e5 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -344,7 +344,10 @@ pub fn check(path: &Path, bad: &mut bool) { } else { trailing_new_lines = 0; } - lines = i; + + if !line.trim().starts_with("//") { + lines += 1; + } } if leading_new_lines { tidy_error!(bad, "{}: leading newline", file.display());