Skip to content

Rollup of 10 pull requests #87806

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3171bd5
ignore comments in tidy-filelength
ibraheemdev Jul 25, 2021
a77d6ff
add long error explanation for E0625
bhgomes Aug 3, 2021
2fd874d
Fix overflow when calculating expected_min in generics diagnostics
SkiFire13 Aug 3, 2021
ae313da
Add regression tests
SkiFire13 Aug 3, 2021
e3389be
Bless test
SkiFire13 Aug 3, 2021
2f85aa6
remove trailing newline
bhgomes Aug 3, 2021
a96fd57
Validate FFI-safety warnings on naked functions
npmccallum Aug 3, 2021
1247f9b
Add back -Zno-profiler-runtime
Amanieu Aug 4, 2021
f280a12
Re-use std::sealed::Sealed in os/linux/process.
m-ou-se Aug 4, 2021
94ffa00
Promote `aarch64-apple-ios-sim` to Tier 2
badboy Aug 2, 2021
b1d14ef
dropck
BoxyUwU Aug 4, 2021
dc5f6d2
move full explanation to after erroneous example
bhgomes Aug 4, 2021
fa46715
remove tywf relation
BoxyUwU Aug 5, 2021
1db8737
alloc: Use intra doc links for the reserve function
est31 Aug 5, 2021
1a7e56c
Remove special case for statement `NodeId` assignment
Aaron1011 Aug 5, 2021
a633895
Rollup merge of #87462 - ibraheemdev:tidy-file-length-ignore-comment,…
JohnTitor Aug 6, 2021
f13c61d
Rollup merge of #87715 - bhgomes:long-explanation-E0625, r=GuillaumeG…
JohnTitor Aug 6, 2021
928c719
Rollup merge of #87727 - SkiFire13:fix-87718, r=jackh726
JohnTitor Aug 6, 2021
bd8858b
Rollup merge of #87742 - npmccallum:naked_ffi, r=Amanieu
JohnTitor Aug 6, 2021
0fc0614
Rollup merge of #87756 - Amanieu:no_profiler_runtime, r=jackh726
JohnTitor Aug 6, 2021
57ffa31
Rollup merge of #87759 - m-ou-se:linux-process-sealed, r=jyn514
JohnTitor Aug 6, 2021
f91d8d1
Rollup merge of #87760 - badboy:promote-ios-sim-target, r=Mark-Simula…
JohnTitor Aug 6, 2021
5f37944
Rollup merge of #87770 - BoxyUwU:cec-drop-impl, r=lcnr
JohnTitor Aug 6, 2021
7353e2f
Rollup merge of #87779 - Aaron1011:stmt-ast-id, r=petrochenkov
JohnTitor Aug 6, 2021
0b3a5b0
Rollup merge of #87780 - est31:intra_doc_links, r=jyn514
JohnTitor Aug 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0625.md
Original file line number Diff line number Diff line change
@@ -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;
```
9 changes: 2 additions & 7 deletions compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
@@ -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
25 changes: 4 additions & 21 deletions compiler/rustc_expand/src/placeholders.rs
Original file line number Diff line number Diff line change
@@ -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<ast::NodeId, AstFragment>,
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<ast::Block>) {
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();
}
}
}
}
1 change: 0 additions & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
@@ -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};
3 changes: 2 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
@@ -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")));
2 changes: 0 additions & 2 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

//! Lints in the Rust compiler.
//!
//! This contains lints which can feasibly be implemented as their own
2 changes: 0 additions & 2 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
@@ -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
10 changes: 4 additions & 6 deletions compiler/rustc_metadata/src/creader.rs
Original file line number Diff line number Diff line change
@@ -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) \
4 changes: 2 additions & 2 deletions compiler/rustc_metadata/src/locator.rs
Original file line number Diff line number Diff line change
@@ -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");
}
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-filelength
use crate::ich::StableHashingContext;
use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use crate::mir::{GeneratorLayout, GeneratorSavedLocal};
6 changes: 4 additions & 2 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
@@ -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<PathBuf> = (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<String> = (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],
1 change: 0 additions & 1 deletion compiler/rustc_typeck/src/astconv/generics.rs
Original file line number Diff line number Diff line change
@@ -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());
13 changes: 10 additions & 3 deletions compiler/rustc_typeck/src/check/dropck.rs
Original file line number Diff line number Diff line change
@@ -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,
}
};
3 changes: 0 additions & 3 deletions compiler/rustc_typeck/src/collect.rs
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 3 additions & 1 deletion library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
@@ -697,7 +697,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
///
/// 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
///
4 changes: 3 additions & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
@@ -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
///
8 changes: 6 additions & 2 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
@@ -811,7 +811,9 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// 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<T, A: Allocator> Vec<T, A> {
///
/// 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
///
4 changes: 0 additions & 4 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
@@ -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};

1 change: 0 additions & 1 deletion library/core/src/slice/iter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// ignore-tidy-filelength
//! Definitions of a bunch of iterators for `[T]`.

#[macro_use] // import iterator! and forward_iterator!
2 changes: 0 additions & 2 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

//! Slice management and manipulation.
//!
//! For more details see [`std::slice`].
2 changes: 0 additions & 2 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

#[cfg(test)]
mod tests;

4 changes: 3 additions & 1 deletion library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
@@ -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
///
15 changes: 3 additions & 12 deletions library/std/src/os/linux/process.rs
Original file line number Diff line number Diff line change
@@ -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<PidFd>;
}

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.
4 changes: 4 additions & 0 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
@@ -205,6 +205,10 @@ pub struct Child {
pub stderr: Option<ChildStderr>,
}

/// Allows extension traits within `std`.
#[unstable(feature = "sealed", issue = "none")]
impl crate::sealed::Sealed for Child {}

impl AsInner<imp::Process> for Child {
fn as_inner(&self) -> &imp::Process {
&self.handle
2 changes: 1 addition & 1 deletion src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
@@ -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` | ? | |
11 changes: 5 additions & 6 deletions src/doc/rustc/src/platform-support/aarch64-apple-ios-sim.md
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 12 additions & 0 deletions src/test/ui/asm/naked-functions-ffi.rs
Original file line number Diff line number Diff line change
@@ -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)); }
}
20 changes: 20 additions & 0 deletions src/test/ui/asm/naked-functions-ffi.stderr
Original file line number Diff line number Diff line change
@@ -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

16 changes: 16 additions & 0 deletions src/test/ui/const-generics/const_evaluatable_checked/drop_impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//check-pass
#![feature(const_generics, const_evaluatable_checked)]
#![allow(incomplete_features)]

struct Foo<const N: usize>
where
[(); N + 1]: ;

impl<const N: usize> Drop for Foo<N>
where
[(); N + 1]: ,
{
fn drop(&mut self) {}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -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::<str, String>("".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<T: ?Sized>(_f: impl AsRef<T>) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// check-pass

#![feature(explicit_generic_args_with_impl_trait)]

fn f<T: ?Sized>(_: impl AsRef<T>, _: impl AsRef<T>) {}

fn main() {
f::<[u8]>("a", b"a");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![feature(explicit_generic_args_with_impl_trait)]

fn f<T: ?Sized, U: ?Sized>(_: impl AsRef<T>, _: impl AsRef<U>) {}

fn main() {
f::<[u8]>("a", b"a");
//~^ ERROR: this function takes 2 generic arguments but 1 generic argument was supplied
}
Original file line number Diff line number Diff line change
@@ -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<T: ?Sized, U: ?Sized>(_: impl AsRef<T>, _: impl AsRef<U>) {}
| ^ - -
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`.
1 change: 1 addition & 0 deletions src/test/ui/thread-local-in-ctfe.stderr
Original file line number Diff line number Diff line change
@@ -30,3 +30,4 @@ LL | A

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0625`.
2 changes: 1 addition & 1 deletion src/test/ui/thread-local-static.stderr
Original file line number Diff line number Diff line change
@@ -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`.
5 changes: 4 additions & 1 deletion src/tools/tidy/src/style.rs
Original file line number Diff line number Diff line change
@@ -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());