Auto merge of #68526 - JohnTitor:rollup-3mmljof, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #68111 (Print constants in `type_name` for const generics)
 - #68374 (Fix invalid link to the C++ Exception Handling ABI documentation)
 - #68504 (Use check-pass mode for lint tests and nll tests)
 - #68509 (Clean up error codes E0223 and E0225 explanations)
 - #68511 (Remove unused ignore-license directives)
 - #68515 (Support feature process_set_argv0 for VxWorks)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-01-24 23:04:54 +00:00
commit 8647aa1a2c
70 changed files with 131 additions and 90 deletions

View File

@ -4,7 +4,7 @@
//! "Exception Handling in LLVM" (llvm.org/docs/ExceptionHandling.html) and
//! documents linked from it.
//! These are also good reads:
//! http://mentorembedded.github.io/cxx-abi/abi-eh.html
//! https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html
//! http://monoinfinito.wordpress.com/series/exception-handling-in-c/
//! http://www.airs.com/blog/index.php?s=exception+frames
//!

View File

@ -831,7 +831,11 @@ pub trait PrettyPrinter<'tcx>:
Ok(self)
}
fn pretty_print_const(mut self, ct: &'tcx ty::Const<'tcx>) -> Result<Self::Const, Self::Error> {
fn pretty_print_const(
mut self,
ct: &'tcx ty::Const<'tcx>,
print_ty: bool,
) -> Result<Self::Const, Self::Error> {
define_scoped_cx!(self);
if self.tcx().sess.verbose() {
@ -839,6 +843,15 @@ pub trait PrettyPrinter<'tcx>:
return Ok(self);
}
macro_rules! print_underscore {
() => {{
p!(write("_"));
if print_ty {
p!(write(": "), print(ct.ty));
}
}};
}
match (ct.val, &ct.ty.kind) {
(_, ty::FnDef(did, substs)) => p!(print_value_path(*did, substs)),
(ty::ConstKind::Unevaluated(did, substs, promoted), _) => {
@ -857,22 +870,27 @@ pub trait PrettyPrinter<'tcx>:
{
p!(write("{}", snip))
} else {
p!(write("_: "), print(ct.ty))
print_underscore!()
}
} else {
p!(write("_: "), print(ct.ty))
print_underscore!()
}
}
}
}
}
(ty::ConstKind::Infer(..), _) => p!(write("_: "), print(ct.ty)),
(ty::ConstKind::Infer(..), _) => print_underscore!(),
(ty::ConstKind::Param(ParamConst { name, .. }), _) => p!(write("{}", name)),
(ty::ConstKind::Value(value), _) => return self.pretty_print_const_value(value, ct.ty),
(ty::ConstKind::Value(value), _) => {
return self.pretty_print_const_value(value, ct.ty, print_ty);
}
_ => {
// fallback
p!(write("{:?} : ", ct.val), print(ct.ty))
p!(write("{:?}", ct.val));
if print_ty {
p!(write(" : "), print(ct.ty));
}
}
};
Ok(self)
@ -882,6 +900,7 @@ pub trait PrettyPrinter<'tcx>:
mut self,
ct: ConstValue<'tcx>,
ty: Ty<'tcx>,
print_ty: bool,
) -> Result<Self::Const, Self::Error> {
define_scoped_cx!(self);
@ -988,7 +1007,10 @@ pub trait PrettyPrinter<'tcx>:
};
if !printed {
// fallback
p!(write("{:?} : ", ct), print(ty))
p!(write("{:?}", ct));
if print_ty {
p!(write(" : "), print(ty));
}
}
}
};
@ -1162,7 +1184,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
}
fn print_const(self, ct: &'tcx ty::Const<'tcx>) -> Result<Self::Const, Self::Error> {
self.pretty_print_const(ct)
self.pretty_print_const(ct, true)
}
fn path_crate(mut self, cnum: CrateNum) -> Result<Self::Path, Self::Error> {

View File

@ -237,7 +237,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
// only print integers
if let ty::ConstKind::Value(ConstValue::Scalar(Scalar::Raw { .. })) = ct.val {
if ct.ty.is_integral() {
return self.pretty_print_const(ct);
return self.pretty_print_const(ct, true);
}
}
self.write_str("_")?;

View File

@ -1,5 +1,6 @@
An attempt was made to retrieve an associated type, but the type was ambiguous.
For example:
Erroneous code example:
```compile_fail,E0223
trait MyTrait {type X; }

View File

@ -1,5 +1,6 @@
You attempted to use multiple types as bounds for a closure or trait object.
Rust does not currently support this. A simple example that causes this error:
Multiple types were used as bounds for a closure or trait object.
Erroneous code example:
```compile_fail,E0225
fn main() {
@ -7,6 +8,8 @@ fn main() {
}
```
Rust does not currently support this.
Auto traits such as Send and Sync are an exception to this rule:
It's possible to have bounds of one non-builtin trait, plus any number of
auto traits. For example, the following compiles correctly:

View File

@ -69,9 +69,8 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
}
}
fn print_const(self, _: &'tcx ty::Const<'tcx>) -> Result<Self::Const, Self::Error> {
// don't print constants to the user
Ok(self)
fn print_const(self, ct: &'tcx ty::Const<'tcx>) -> Result<Self::Const, Self::Error> {
self.pretty_print_const(ct, false)
}
fn print_dyn_existential(

View File

@ -21,9 +21,6 @@
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
// Appease Rust's tidy.
// ignore-license
#[cfg(feature = "bitflags")]
use bitflags::bitflags;

View File

@ -26,7 +26,6 @@
// Source: https://github.com/NuxiNL/cloudabi
// Appease Rust's tidy.
// ignore-license
// ignore-tidy-linelength
//! **PLEASE NOTE: This entire crate including this

View File

@ -2,6 +2,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use crate::ffi::OsStr;
use crate::io;
use crate::process;
use crate::sys;
@ -105,6 +106,15 @@ pub trait CommandExt {
/// cross-platform `spawn` instead.
#[stable(feature = "process_exec2", since = "1.9.0")]
fn exec(&mut self) -> io::Error;
/// Set executable argument
///
/// Set the first process argument, `argv[0]`, to something other than the
/// default executable path.
#[unstable(feature = "process_set_argv0", issue = "66510")]
fn arg0<S>(&mut self, arg: S) -> &mut process::Command
where
S: AsRef<OsStr>;
}
#[stable(feature = "rust1", since = "1.0.0")]
@ -130,6 +140,14 @@ impl CommandExt for process::Command {
fn exec(&mut self) -> io::Error {
self.as_inner_mut().exec(sys::process::Stdio::Inherit)
}
fn arg0<S>(&mut self, arg: S) -> &mut process::Command
where
S: AsRef<OsStr>,
{
self.as_inner_mut().set_arg_0(arg.as_ref());
self
}
}
/// Unix-specific extensions to [`process::ExitStatus`].

View File

@ -90,8 +90,8 @@ impl Command {
let program = os2c(program, &mut saw_nul);
Command {
argv: Argv(vec![program.as_ptr(), ptr::null()]),
args: vec![program.clone()],
program,
args: Vec::new(),
env: Default::default(),
cwd: None,
uid: None,
@ -104,11 +104,19 @@ impl Command {
}
}
pub fn set_arg_0(&mut self, arg: &OsStr) {
// Set a new arg0
let arg = os2c(arg, &mut self.saw_nul);
debug_assert!(self.argv.0.len() > 1);
self.argv.0[0] = arg.as_ptr();
self.args[0] = arg;
}
pub fn arg(&mut self, arg: &OsStr) {
// Overwrite the trailing NULL pointer in `argv` and then add a new null
// pointer.
let arg = os2c(arg, &mut self.saw_nul);
self.argv.0[self.args.len() + 1] = arg.as_ptr();
self.argv.0[self.args.len()] = arg.as_ptr();
self.argv.0.push(ptr::null());
// Also make sure we keep track of the owned value to schedule a
@ -133,6 +141,10 @@ impl Command {
&self.argv.0
}
pub fn get_program(&self) -> &CStr {
&*self.program
}
#[allow(dead_code)]
pub fn get_cwd(&self) -> &Option<CString> {
&self.cwd
@ -315,8 +327,12 @@ impl ChildStdio {
impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.program)?;
for arg in &self.args {
if self.program != self.args[0] {
write!(f, "[{:?}] ", self.program)?;
}
write!(f, "{:?}", self.args[0])?;
for arg in &self.args[1..] {
write!(f, " {:?}", arg)?;
}
Ok(())

View File

@ -67,7 +67,7 @@ impl Command {
let _lock = sys::os::env_lock();
let ret = libc::rtpSpawn(
self.get_argv()[0], // executing program
self.get_program().as_ptr(),
self.get_argv().as_ptr() as *mut *const c_char, // argv
c_envp as *mut *const c_char,
100 as c_int, // initial priority

View File

@ -1,11 +1,6 @@
/// Some doc comment.
struct X;
// ignore-license
// http://rust-lang.org/COPYRIGHT.
//
// pp-exact
// Test that rust can properly pretty print a doc comment if it's the first line in a file. some

View File

@ -1,4 +1,3 @@
// ignore-license
#ifdef _WIN32
__declspec(dllexport)
#endif

View File

@ -1,5 +1,3 @@
// ignore-license
#ifdef _WIN32
__declspec(dllexport)
#endif

View File

@ -1,4 +1,3 @@
// ignore-license
void foo();
int main() {

View File

@ -1,4 +1,3 @@
// ignore-license
void foo();
int main() {

View File

@ -1,2 +1 @@
// ignore-license
int foo() { return 0; }

View File

@ -1,2 +1 @@
// ignore-license
int foo() { return 0; }

View File

@ -1,4 +1,3 @@
// ignore-license
extern "C" void foo() {
int *a = new int(3);
delete a;

View File

@ -1,4 +1,3 @@
// ignore-license
#include <stdint.h>
typedef struct TestStruct {

View File

@ -1,4 +1,3 @@
// ignore-license
#include <stdint.h>
uint32_t foo();

View File

@ -1,4 +1,3 @@
// ignore-license
#include <stdio.h>
#include <stdint.h>

View File

@ -1,4 +1,3 @@
// ignore-license
// Pragma needed cause of gcc bug on windows: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
#include <assert.h>

View File

@ -1,4 +1,3 @@
// ignore-license
#include <stdio.h>
#include <stdint.h>

View File

@ -1,4 +1,3 @@
// ignore-license
void args_check();
int main() {

View File

@ -1,4 +1,3 @@
// ignore-license
void foo();
void bar() { foo(); }

View File

@ -1,2 +1 @@
// ignore-license
void foo() {}

View File

@ -1,4 +1,3 @@
// ignore-license
#include <stddef.h>
#include <stdint.h>

View File

@ -1,2 +1 @@
// ignore-license
int should_return_one() { return 1; }

View File

@ -1,2 +1 @@
// ignore-license
int should_return_one() { return 0; }

View File

@ -1,4 +1,3 @@
// ignore-license
#include <stdint.h>
extern int32_t BAZ;

View File

@ -1,4 +1,3 @@
// ignore-license
void foo();
int main() {

View File

@ -1,2 +1 @@
// ignore-license
void bar() {}

View File

@ -1,2 +1 @@
// ignore-license
void bar() {}

View File

@ -1,4 +1,3 @@
// ignore-license
void overflow();
int main() {

View File

@ -3,4 +3,3 @@
#![allow(stable_features)]
#![feature(rust1)]
pub fn main() { }
// ignore-license

View File

@ -0,0 +1,11 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
#[derive(Debug)]
struct S<const N: usize>;
fn main() {
assert_eq!(std::any::type_name::<S<3>>(), "const_generic_type_name::S<3usize>");
}

View File

@ -0,0 +1,8 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-generic-type_name.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default

View File

@ -1,11 +1,8 @@
// run-pass
// ignore-tidy-cr ignore-license
// ignore-tidy-cr
// ignore-tidy-cr (repeated again because of tidy bug)
// license is ignored because tidy can't handle the CRLF here properly.
// http://rust-lang.org/COPYRIGHT.
//
// N.B., this file needs CRLF line endings. The .gitattributes file in
// this directory should enforce it.

View File

@ -1,5 +1,5 @@
// compile-flags: -A bad-style
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
fn main() {
let _InappropriateCamelCasing = true;

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![deny(dead_code)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// run-rustfix
#![warn(ellipsis_inclusive_range_patterns)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// run-rustfix
#![warn(ellipsis_inclusive_range_patterns)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// Issue #7526: lowercase static constants in patterns look like bindings
// This is similar to lint-lowercase-static-const-pattern.rs, except it

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![deny(non_camel_case_types)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![allow(dead_code)]
// This is ok because we often use the trailing underscore to mean 'prime'

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![allow(dead_code)]
// pretty-expanded FIXME #23616

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![allow(dead_code)]

View File

@ -1,7 +1,7 @@
// aux-build:lint_output_format.rs
#![feature(unstable_test_feature)]
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
extern crate lint_output_format;
use lint_output_format::{foo, bar};

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// aux-build:lint_stability.rs
// aux-build:inherited_stability.rs
// aux-build:stability_cfg1.rs

View File

@ -1,5 +1,5 @@
// aux-build:lints-in-foreign-macros.rs
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![warn(unused_imports)] //~ missing documentation for crate [missing_docs]
#![warn(missing_docs)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(lint_reasons)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![warn(overflowing_literals)]
fn main() {

View File

@ -2,7 +2,7 @@
// should also deal with the edge cases where a label is shadowed,
// within nested loops
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(label_break_value)]
#![warn(unused_labels)]

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![warn(unused_imports)]
use crate::foo::Bar;

View File

@ -4,7 +4,7 @@
// regions is erased.
// compile-flags:-Zborrowck=mir -Zverbose
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(rustc_attrs)]

View File

@ -2,7 +2,7 @@
// arbitrary types without ICEs.
// compile-flags:-Zborrowck=mir
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
const HI: &str = "hi";

View File

@ -3,7 +3,7 @@
// including) the call to `use_x`. The `else` branch is not included.
// compile-flags:-Zborrowck=mir
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![allow(warnings)]
#![feature(dropck_eyepatch)]

View File

@ -1,6 +1,6 @@
// extra unused mut lint tests for #51918
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(generators, nll)]
#![deny(unused_mut)]

View File

@ -6,7 +6,7 @@
// over a yield -- because the data that is borrowed (`*x`) is not
// stored on the stack.
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
fn foo(x: &mut u32) {
move || {

View File

@ -1,5 +1,5 @@
// compile-flags: -Zborrowck=mir
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![allow(warnings)]

View File

@ -1,5 +1,5 @@
// compile-flags:-Zborrowck=mir
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![feature(rustc_attrs)]

View File

@ -6,7 +6,7 @@
// another -- effectively, the single lifetime `'a` is just inferred
// to be the intersection of the two distinct lifetimes.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// compile-flags:-Zno-leak-check
#![feature(nll)]

View File

@ -2,7 +2,7 @@
// function returning always its first argument can be upcast to one
// that returns either first or second argument.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// compile-flags:-Zno-leak-check
#![feature(nll)]

View File

@ -1,7 +1,7 @@
// Test that when we infer the lifetime to a subset of the fn body, it
// works out.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
trait MyTrait<'a> {
type Output;

View File

@ -3,7 +3,7 @@
// we don't even propagate constraints from the closures to the callers.
// compile-flags:-Zborrowck=mir -Zverbose
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
#![allow(warnings)]
#![feature(rustc_attrs)]

View File

@ -4,7 +4,7 @@
//
// Regression test for #53121.
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
trait MyTrait<'a> {
type Output;

View File

@ -4,7 +4,7 @@
// MyTrait<'a>>::Output: 'a` outlives `'a` (because the trait says
// so).
//
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
trait MyTrait<'a> {
type Output: 'a;

View File

@ -1,5 +1,5 @@
// compile-flags:-Zborrowck=mir -Zverbose
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// Test that we assume that universal types like `T` outlive the
// function body.

View File

@ -1,4 +1,4 @@
// build-pass (FIXME(62277): could be check-pass?)
// check-pass
// Check that we don't try to downcast `_` when type-checking the annotation.
fn main() {