Skip to content
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

Rollup of 6 pull requests #83714

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8f77356
give full path of constraint in suggest_constraining_type_param
Rustin170506 Mar 30, 2021
c3ec0ad
Add allocation information to undefined behaviour errors.
hameerabbasi Feb 1, 2021
091433d
Rename stderr->64bit.stderr where needed.
hameerabbasi Mar 31, 2021
f80b9ac
Add 32bit.stderr files.
hameerabbasi Mar 31, 2021
ce66588
Add a regression test for issue-68830
JohnTitor Mar 31, 2021
e7821e5
Fix documentation of conversion from String to OsString
steffahn Mar 31, 2021
f5e7dbb
Add a few missing links, fix a typo
steffahn Mar 31, 2021
7509aa1
Apply suggestions from code review
steffahn Mar 31, 2021
38b3169
Fix compiletest to use correct bitwidth stderr files.
hameerabbasi Mar 31, 2021
38f3c3b
Try again, this time with both 64 and 32 bit ignores.
hameerabbasi Mar 31, 2021
82c6709
Clarify `--print target-list` is a rustc's option
JohnTitor Mar 31, 2021
9acf558
Update LLVM with another wasm simd fix
alexcrichton Mar 31, 2021
952ed03
Rollup merge of #76881 - hameerabbasi:issue-53325, r=oli-obk
Dylan-DPC Mar 31, 2021
918166e
Rollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebank
Dylan-DPC Mar 31, 2021
8b99dc3
Rollup merge of #83699 - JohnTitor:issue-68830, r=Dylan-DPC
Dylan-DPC Mar 31, 2021
8346973
Rollup merge of #83700 - steffahn:string_to_pathbuf_conversion_docume…
Dylan-DPC Mar 31, 2021
3b0d38b
Rollup merge of #83711 - JohnTitor:more-friendly-unknown-target-error…
Dylan-DPC Mar 31, 2021
cbdb5ef
Rollup merge of #83712 - alexcrichton:more-wasm-simd-llvm-updates, r=…
Dylan-DPC Mar 31, 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
10 changes: 10 additions & 0 deletions compiler/rustc_mir/src/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::interpret::{
Immediate, InternKind, InterpCx, InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, Scalar,
ScalarMaybeUninit, StackPopCleanup,
};
use crate::util::pretty::display_allocation;

use rustc_errors::ErrorReported;
use rustc_hir::def::DefKind;
Expand Down Expand Up @@ -360,6 +361,15 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
"it is undefined behavior to use this value",
|mut diag| {
diag.note(note_on_undefined_behavior_error());
diag.note(&format!(
"the raw bytes of the constant ({}",
display_allocation(
*ecx.tcx,
ecx.tcx
.global_alloc(mplace.ptr.assert_ptr().alloc_id)
.unwrap_memory()
)
));
diag.emit();
},
))
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ pub fn build_target_config(opts: &Options, target_override: Option<Target>) -> T
opts.error_format,
&format!(
"Error loading target specification: {}. \
Use `--print target-list` for a list of built-in targets",
Run `rustc --print target-list` for a list of built-in targets",
e
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use std::fmt;

use super::InferCtxtPrivExt;
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
use rustc_middle::ty::print::with_no_trimmed_paths;

#[derive(Debug)]
pub enum GeneratorInteriorOrUpvar {
Expand Down Expand Up @@ -440,7 +441,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
{
// Missing generic type parameter bound.
let param_name = self_ty.to_string();
let constraint = trait_ref.print_only_trait_path().to_string();
let constraint =
with_no_trimmed_paths(|| trait_ref.print_only_trait_path().to_string());
if suggest_constraining_type_param(
self.tcx,
generics,
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ impl OsString {
impl From<String> for OsString {
/// Converts a [`String`] into a [`OsString`].
///
/// The conversion copies the data, and includes an allocation on the heap.
/// This conversion does not allocate or copy memory.
#[inline]
fn from(s: String) -> OsString {
OsString { inner: Buf::from_string(s) }
Expand Down Expand Up @@ -858,7 +858,7 @@ impl From<Cow<'_, OsStr>> for Box<OsStr> {

#[stable(feature = "os_string_from_box", since = "1.18.0")]
impl From<Box<OsStr>> for OsString {
/// Converts a [`Box`]`<`[`OsStr`]`>` into a `OsString` without copying or
/// Converts a [`Box`]`<`[`OsStr`]`>` into an [`OsString`] without copying or
/// allocating.
#[inline]
fn from(boxed: Box<OsStr>) -> OsString {
Expand Down
14 changes: 7 additions & 7 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf {

#[stable(feature = "rust1", since = "1.0.0")]
impl From<OsString> for PathBuf {
/// Converts a `OsString` into a `PathBuf`
/// Converts an [`OsString`] into a [`PathBuf`]
///
/// This conversion does not allocate or copy memory.
#[inline]
Expand All @@ -1478,7 +1478,7 @@ impl From<OsString> for PathBuf {

#[stable(feature = "from_path_buf_for_os_string", since = "1.14.0")]
impl From<PathBuf> for OsString {
/// Converts a `PathBuf` into a `OsString`
/// Converts a [`PathBuf`] into an [`OsString`]
///
/// This conversion does not allocate or copy memory.
#[inline]
Expand All @@ -1489,7 +1489,7 @@ impl From<PathBuf> for OsString {

#[stable(feature = "rust1", since = "1.0.0")]
impl From<String> for PathBuf {
/// Converts a `String` into a `PathBuf`
/// Converts a [`String`] into a [`PathBuf`]
///
/// This conversion does not allocate or copy memory.
#[inline]
Expand Down Expand Up @@ -1595,7 +1595,7 @@ impl<'a> From<Cow<'a, Path>> for PathBuf {

#[stable(feature = "shared_from_slice2", since = "1.24.0")]
impl From<PathBuf> for Arc<Path> {
/// Converts a `PathBuf` into an `Arc` by moving the `PathBuf` data into a new `Arc` buffer.
/// Converts a [`PathBuf`] into an [`Arc`] by moving the [`PathBuf`] data into a new [`Arc`] buffer.
#[inline]
fn from(s: PathBuf) -> Arc<Path> {
let arc: Arc<OsStr> = Arc::from(s.into_os_string());
Expand All @@ -1605,7 +1605,7 @@ impl From<PathBuf> for Arc<Path> {

#[stable(feature = "shared_from_slice2", since = "1.24.0")]
impl From<&Path> for Arc<Path> {
/// Converts a `Path` into an `Arc` by copying the `Path` data into a new `Arc` buffer.
/// Converts a [`Path`] into an [`Arc`] by copying the [`Path`] data into a new [`Arc`] buffer.
#[inline]
fn from(s: &Path) -> Arc<Path> {
let arc: Arc<OsStr> = Arc::from(s.as_os_str());
Expand All @@ -1615,7 +1615,7 @@ impl From<&Path> for Arc<Path> {

#[stable(feature = "shared_from_slice2", since = "1.24.0")]
impl From<PathBuf> for Rc<Path> {
/// Converts a `PathBuf` into an `Rc` by moving the `PathBuf` data into a new `Rc` buffer.
/// Converts a [`PathBuf`] into an [`Rc`] by moving the [`PathBuf`] data into a new `Rc` buffer.
#[inline]
fn from(s: PathBuf) -> Rc<Path> {
let rc: Rc<OsStr> = Rc::from(s.into_os_string());
Expand All @@ -1625,7 +1625,7 @@ impl From<PathBuf> for Rc<Path> {

#[stable(feature = "shared_from_slice2", since = "1.24.0")]
impl From<&Path> for Rc<Path> {
/// Converts a `Path` into an `Rc` by copying the `Path` data into a new `Rc` buffer.
/// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new `Rc` buffer.
#[inline]
fn from(s: &Path) -> Rc<Path> {
let rc: Rc<OsStr> = Rc::from(s.as_os_str());
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/associated-types/defaults-suitability.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ LL | type Bar: Clone = Vec<T>;
= note: required because of the requirements on the impl of `Clone` for `Vec<T>`
help: consider restricting type parameter `T`
|
LL | trait Foo<T: Clone> {
| ^^^^^^^
LL | trait Foo<T: std::clone::Clone> {
| ^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `(): Foo<Self>` is not satisfied
--> $DIR/defaults-suitability.rs:34:5
Expand Down Expand Up @@ -99,8 +99,8 @@ LL | type Baz = T;
|
help: consider further restricting type parameter `T`
|
LL | Self::Baz: Clone, T: Clone
| ^^^^^^^^^^
LL | Self::Baz: Clone, T: std::clone::Clone
| ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 8 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LL | copy::<dyn Setup<From=T>>(t)
|
help: consider restricting type parameter `T`
|
LL | pub fn copy_any<T: Copy>(t: &T) -> T {
| ^^^^^^
LL | pub fn copy_any<T: std::marker::Copy>(t: &T) -> T {
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LL | type Assoc = T;
|
help: consider restricting type parameter `T`
|
LL | impl<T: Copy> Complete for T {
| ^^^^^^
LL | impl<T: std::marker::Copy> Complete for T {
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/async-await/issue-70818.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | async { (ty, ty1) }
| ^^^ has type `U` which is not `Send`
help: consider restricting type parameter `U`
|
LL | fn foo<T: Send, U: Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

4 changes: 2 additions & 2 deletions src/test/ui/bad/bad-method-typaram-kind.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ LL | 1.bar::<T>();
|
help: consider further restricting this bound
|
LL | fn foo<T:'static + Send>() {
| ^^^^^^
LL | fn foo<T:'static + std::marker::Send>() {
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/bound-suggestions.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ use std::fmt::Debug;
// Rustfix should add this, or use `std::fmt::Debug` instead.

#[allow(dead_code)]
fn test_impl(t: impl Sized + Debug) {
fn test_impl(t: impl Sized + std::fmt::Debug) {
println!("{:?}", t);
//~^ ERROR doesn't implement
}

#[allow(dead_code)]
fn test_no_bounds<T: Debug>(t: T) {
fn test_no_bounds<T: std::fmt::Debug>(t: T) {
println!("{:?}", t);
//~^ ERROR doesn't implement
}

#[allow(dead_code)]
fn test_one_bound<T: Sized + Debug>(t: T) {
fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
println!("{:?}", t);
//~^ ERROR doesn't implement
}

#[allow(dead_code)]
fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: Debug {
fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
println!("{:?} {:?}", x, y);
//~^ ERROR doesn't implement
}

#[allow(dead_code)]
fn test_one_bound_where<X>(x: X) where X: Sized + Debug {
fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
println!("{:?}", x);
//~^ ERROR doesn't implement
}

#[allow(dead_code)]
fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: Debug {
fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
println!("{:?}", x);
//~^ ERROR doesn't implement
}
Expand Down
24 changes: 12 additions & 12 deletions src/test/ui/bound-suggestions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ LL | println!("{:?}", t);
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_impl(t: impl Sized + Debug) {
| ^^^^^^^
LL | fn test_impl(t: impl Sized + std::fmt::Debug) {
| ^^^^^^^^^^^^^^^^^

error[E0277]: `T` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:15:22
Expand All @@ -21,8 +21,8 @@ LL | println!("{:?}", t);
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
LL | fn test_no_bounds<T: Debug>(t: T) {
| ^^^^^^^
LL | fn test_no_bounds<T: std::fmt::Debug>(t: T) {
| ^^^^^^^^^^^^^^^^^

error[E0277]: `T` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:21:22
Expand All @@ -34,8 +34,8 @@ LL | println!("{:?}", t);
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_one_bound<T: Sized + Debug>(t: T) {
| ^^^^^^^
LL | fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) {
| ^^^^^^^^^^^^^^^^^

error[E0277]: `Y` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:27:30
Expand All @@ -47,8 +47,8 @@ LL | println!("{:?} {:?}", x, y);
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `Y`
|
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: Debug {
| ^^^^^^^^^^
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug {
| ^^^^^^^^^^^^^^^^^^^^

error[E0277]: `X` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:33:22
Expand All @@ -60,8 +60,8 @@ LL | println!("{:?}", x);
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_one_bound_where<X>(x: X) where X: Sized + Debug {
| ^^^^^^^
LL | fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug {
| ^^^^^^^^^^^^^^^^^

error[E0277]: `X` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:39:22
Expand All @@ -73,8 +73,8 @@ LL | println!("{:?}", x);
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `X`
|
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: Debug {
| ^^^^^^^^^^
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: std::fmt::Debug {
| ^^^^^^^^^^^^^^^^^^^^

error[E0277]: the size for values of type `Self` cannot be known at compilation time
--> $DIR/bound-suggestions.rs:44:46
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ LL | impl <T: Sync+'static> Foo for (T,) { }
= note: required because it appears within the type `(T,)`
help: consider further restricting this bound
|
LL | impl <T: Sync+'static + Send> Foo for (T,) { }
| ^^^^^^
LL | impl <T: Sync+'static + std::marker::Send> Foo for (T,) { }
| ^^^^^^^^^^^^^^^^^^^

error[E0277]: `T` cannot be shared between threads safely
--> $DIR/builtin-superkinds-double-superkind.rs:9:16
Expand All @@ -25,8 +25,8 @@ LL | impl <T: Send> Foo for (T,T) { }
= note: required because it appears within the type `(T, T)`
help: consider further restricting this bound
|
LL | impl <T: Send + Sync> Foo for (T,T) { }
| ^^^^^^
LL | impl <T: Send + std::marker::Sync> Foo for (T,T) { }
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }
= note: required because it appears within the type `X<T>`
help: consider further restricting this bound
|
LL | impl <T:Sync+'static + Send> RequiresRequiresShareAndSend for X<T> { }
| ^^^^^^
LL | impl <T:Sync+'static + std::marker::Send> RequiresRequiresShareAndSend for X<T> { }
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LL | impl <T: Sync+'static> Foo for T { }
|
help: consider further restricting this bound
|
LL | impl <T: Sync+'static + Send> Foo for T { }
| ^^^^^^
LL | impl <T: Sync+'static + std::marker::Send> Foo for T { }
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
|
help: consider further restricting this bound
|
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + Send {
| ^^^^^^
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send {
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/closures/closure-bounds-subtype.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LL | take_const_owned(f);
|
help: consider further restricting this bound
|
LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + Sync {
| ^^^^^^
LL | fn give_owned<F>(f: F) where F: FnOnce() + Send + std::marker::Sync {
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
--> $DIR/const-argument-if-length.rs:7:28
|
LL | pub const fn is_zst<T: ?Sized>() -> usize {
| - this type parameter needs to be `Sized`
| - this type parameter needs to be `std::marker::Sized`
LL | if std::mem::size_of::<T>() == 0 {
| ^ doesn't have a size known at compile-time
|
Expand All @@ -15,7 +15,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
--> $DIR/const-argument-if-length.rs:16:12
|
LL | pub struct AtLeastByte<T: ?Sized> {
| - this type parameter needs to be `Sized`
| - this type parameter needs to be `std::marker::Sized`
LL | value: T,
| ^ doesn't have a size known at compile-time
|
Expand Down
Loading