Auto merge of #75747 - cuviper:rollup-icke90l, r=cuviper

Rollup of 8 pull requests

Successful merges:

 - #75672 (Move to intra-doc links for task.rs and vec.rs)
 - #75702 (Clean up E0759 explanation)
 - #75703 (Enable stack-overflow detection on musl for non-main threads)
 - #75710 (Fix bad printing of const-eval queries)
 - #75716 (Upgrade Emscripten on CI to 1.39.20 )
 - #75731 (Suppress ty::Float in MIR comments of ty::Const)
 - #75733 (Remove duplicated alloc vec bench push_all_move)
 - #75743 (Rename rustc_lexer::TokenKind::Not to Bang)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-08-20 18:02:46 +00:00
commit 3323691109
17 changed files with 131 additions and 144 deletions

View file

@ -19,5 +19,5 @@ exit 1
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
cd /emsdk-portable
hide_output ./emsdk install 1.38.47-upstream
./emsdk activate 1.38.47-upstream
hide_output ./emsdk install 1.39.20
./emsdk activate 1.39.20

View file

@ -1,34 +1,28 @@
A `'static` requirement in a return type involving a trait is not fulfilled.
Return type involving a trait did not require `'static` lifetime.
Erroneous code examples:
```compile_fail,E0759
use std::fmt::Debug;
fn foo(x: &i32) -> impl Debug {
fn foo(x: &i32) -> impl Debug { // error!
x
}
```
```compile_fail,E0759
# use std::fmt::Debug;
fn bar(x: &i32) -> Box<dyn Debug> {
fn bar(x: &i32) -> Box<dyn Debug> { // error!
Box::new(x)
}
```
These examples have the same semantics as the following:
Add `'static` requirement to fix them:
```compile_fail,E0759
# use std::fmt::Debug;
fn foo(x: &i32) -> impl Debug + 'static {
fn foo(x: &i32) -> impl Debug + 'static { // ok!
x
}
```
```compile_fail,E0759
# use std::fmt::Debug;
fn bar(x: &i32) -> Box<dyn Debug + 'static> {
fn bar(x: &i32) -> Box<dyn Debug + 'static> { // ok!
Box::new(x)
}
```

View file

@ -103,7 +103,7 @@ pub enum TokenKind {
/// "="
Eq,
/// "!"
Not,
Bang,
/// "<"
Lt,
/// ">"
@ -378,7 +378,7 @@ impl Cursor<'_> {
':' => Colon,
'$' => Dollar,
'=' => Eq,
'!' => Not,
'!' => Bang,
'<' => Lt,
'>' => Gt,
'-' => Minus,

View file

@ -143,6 +143,17 @@ pub struct GlobalId<'tcx> {
pub promoted: Option<mir::Promoted>,
}
impl GlobalId<'tcx> {
pub fn display(self, tcx: TyCtxt<'tcx>) -> String {
let instance_name = tcx.def_path_str(self.instance.def.def_id());
if let Some(promoted) = self.promoted {
format!("{}::{:?}", instance_name, promoted)
} else {
instance_name
}
}
}
/// Input argument for `tcx.lit_to_const`.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, HashStable)]
pub struct LitToConstInput<'tcx> {

View file

@ -684,7 +684,7 @@ rustc_queries! {
-> ConstEvalRawResult<'tcx> {
desc { |tcx|
"const-evaluating `{}`",
tcx.def_path_str(key.value.instance.def.def_id())
key.value.display(tcx)
}
}
@ -700,7 +700,7 @@ rustc_queries! {
-> ConstEvalResult<'tcx> {
desc { |tcx|
"const-evaluating + checking `{}`",
tcx.def_path_str(key.value.instance.def.def_id())
key.value.display(tcx)
}
cache_on_disk_if(_, opt_result) {
// Only store results without errors

View file

@ -406,7 +406,7 @@ impl Visitor<'tcx> for ExtraComments<'tcx> {
self.super_const(constant);
let ty::Const { ty, val, .. } = constant;
match ty.kind {
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char => {}
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => {}
// Unit type
ty::Tuple(tys) if tys.is_empty() => {}
ty::FnDef(..) => {}

View file

@ -290,7 +290,7 @@ impl<'a> StringReader<'a> {
rustc_lexer::TokenKind::Colon => token::Colon,
rustc_lexer::TokenKind::Dollar => token::Dollar,
rustc_lexer::TokenKind::Eq => token::Eq,
rustc_lexer::TokenKind::Not => token::Not,
rustc_lexer::TokenKind::Bang => token::Not,
rustc_lexer::TokenKind::Lt => token::Lt,
rustc_lexer::TokenKind::Gt => token::Gt,
rustc_lexer::TokenKind::Minus => token::BinOp(token::Minus),

View file

@ -12,9 +12,6 @@
- _0 = Baz { x: move _2, y: const 0f32, z: const false }; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
+ (_0.0: usize) = move _2; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
+ (_0.1: f32) = const 0f32; // scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
// ty::Const
// + ty: f32
// + val: Value(Scalar(0x00000000))
// mir::Constant
// + span: $DIR/deaggregator_test.rs:9:20: 9:23
// + literal: Const { ty: f32, val: Value(Scalar(0x00000000)) }

View file

@ -11,7 +11,6 @@
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes
// ignore-musl FIXME #31506
use std::mem::MaybeUninit;
use std::process::Command;

View file

@ -32,7 +32,7 @@ note: ...which requires const-evaluating `Tr::B`...
LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires normalizing `<() as Tr>::A`, completing the cycle
note: cycle used when const-evaluating `main`
note: cycle used when const-evaluating `main::promoted[2]`
--> $DIR/defaults-cyclic-fail.rs:14:1
|
LL | fn main() {

View file

@ -0,0 +1,21 @@
// compile-flags: -Ztreat-err-as-bug
// build-fail
// failure-status: 101
// rustc-env:RUST_BACKTRACE=1
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
// normalize-stderr-test "thread.*panicked.*\n" -> ""
// normalize-stderr-test "stack backtrace:\n" -> ""
// normalize-stderr-test " \d{1,}: .*\n" -> ""
// normalize-stderr-test ".*note: Some details.*\n" -> ""
#![allow(unconditional_panic)]
fn main() {
let x: &'static i32 = &(1 / 0);
//~^ ERROR reaching this expression at runtime will panic or abort [const_err]
println!("x={}", x);
}

View file

@ -0,0 +1,18 @@
error: reaching this expression at runtime will panic or abort
--> $DIR/const-eval-query-stack.rs:18:28
|
LL | let x: &'static i32 = &(1 / 0);
| -^^^^^^^
| |
| dividing by zero
|
= note: `#[deny(const_err)]` on by default
query stack during panic:
#0 [const_eval_raw] const-evaluating `main::promoted[1]`
#1 [const_eval_validated] const-evaluating + checking `main::promoted[1]`
#2 [const_eval_validated] const-evaluating + checking `main::promoted[1]`
#3 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]`
#4 [optimized_mir] optimizing MIR for `main`
#5 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

View file

@ -3,7 +3,6 @@
#![allow(unused_must_use)]
#![allow(unconditional_recursion)]
// ignore-android: FIXME (#20004)
// ignore-musl
// ignore-cloudabi no processes
// ignore-emscripten no processes
// ignore-sgx no processes