Skip to content

Rollup of 7 pull requests #103055

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 17 commits into from
Closed
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -2937,19 +2937,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
ObligationCauseCode::BinOp { rhs_span: Some(span), is_lit, .. } if *is_lit => span,
_ => return,
};
match (
trait_ref.skip_binder().self_ty().kind(),
trait_ref.skip_binder().substs.type_at(1).kind(),
) {
(ty::Float(_), ty::Infer(InferTy::IntVar(_))) => {
err.span_suggestion_verbose(
rhs_span.shrink_to_hi(),
"consider using a floating-point literal by writing it with `.0`",
".0",
Applicability::MaybeIncorrect,
);
}
_ => {}
if let ty::Float(_) = trait_ref.skip_binder().self_ty().kind()
&& let ty::Infer(InferTy::IntVar(_)) = trait_ref.skip_binder().substs.type_at(1).kind()
{
err.span_suggestion_verbose(
rhs_span.shrink_to_hi(),
"consider using a floating-point literal by writing it with `.0`",
".0",
Applicability::MaybeIncorrect,
);
}
}

9 changes: 0 additions & 9 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
@@ -652,7 +652,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(2), Some(1));")]
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_rem(-1), None);")]
@@ -704,7 +703,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".checked_neg(), Some(-5));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_neg(), None);")]
/// ```
@@ -820,7 +818,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!((-5", stringify!($SelfT), ").checked_abs(), Some(5));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);")]
/// ```
@@ -1026,7 +1023,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(10", stringify!($SelfT), ".saturating_mul(12), 120);")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.saturating_mul(10), ", stringify!($SelfT), "::MAX);")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_mul(10), ", stringify!($SelfT), "::MIN);")]
@@ -1085,7 +1081,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!((-4", stringify!($SelfT), ").saturating_pow(3), -64);")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(2), ", stringify!($SelfT), "::MAX);")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT), "::MIN);")]
@@ -1498,7 +1493,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($SelfT), "::MIN, true));")]
/// ```
@@ -1593,7 +1587,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));")]
/// ```
@@ -1703,7 +1696,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_div(2), (2, false));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div(-1), (", stringify!($SelfT), "::MIN, true));")]
/// ```
@@ -1766,7 +1758,6 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_rem(2), (1, false));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem(-1), (0, true));")]
/// ```
2 changes: 0 additions & 2 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
@@ -1456,7 +1456,6 @@ macro_rules! uint_impl {
/// Basic usage
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));")]
/// ```
@@ -1551,7 +1550,6 @@ macro_rules! uint_impl {
/// Basic usage
///
/// ```
///
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".overflowing_sub(2), (3, false));")]
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT), "::MAX, true));")]
/// ```
3 changes: 2 additions & 1 deletion library/std/src/io/error.rs
Original file line number Diff line number Diff line change
@@ -481,6 +481,7 @@ impl Error {
/// originate from the OS itself. The `error` argument is an arbitrary
/// payload which will be contained in this [`Error`].
///
/// Note that this function allocates memory on the heap.
/// If no extra payload is required, use the `From` conversion from
/// `ErrorKind`.
///
@@ -495,7 +496,7 @@ impl Error {
/// // errors can also be created from other errors
/// let custom_error2 = Error::new(ErrorKind::Interrupted, custom_error);
///
/// // creating an error without payload
/// // creating an error without payload (and without memory allocation)
/// let eof_error = Error::from(ErrorKind::UnexpectedEof);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.3
0.12.4
4 changes: 3 additions & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ set -eu

X_PY="$1"

# Try to test all the tools and store the build/test success in the TOOLSTATE_FILE
# Try to test the toolstate-tracked tools and store the build/test success in the TOOLSTATE_FILE.

set +e
python3 "$X_PY" test --stage 2 --no-fail-fast \
@@ -19,6 +19,8 @@ set -e

# debugging: print out the saved toolstates
cat /tmp/toolstate/toolstates.json

# Test remaining tools that must pass.
python3 "$X_PY" test --stage 2 check-tools
python3 "$X_PY" test --stage 2 src/tools/clippy
python3 "$X_PY" test --stage 2 src/tools/rustfmt
10 changes: 8 additions & 2 deletions src/etc/cat-and-grep.sh
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ Options:
-i Case insensitive search.
'

GREPPER=fgrep
GREPPER=grep
INVERT=0
GREPFLAGS='q'
while getopts ':vieh' OPTION; do
@@ -39,7 +39,7 @@ while getopts ':vieh' OPTION; do
GREPFLAGS="i$GREPFLAGS"
;;
e)
GREPPER=egrep
GREPFLAGS="E$GREPFLAGS"
;;
h)
echo "$USAGE"
@@ -51,6 +51,12 @@ while getopts ':vieh' OPTION; do
esac
done

if ! echo "$GREPFLAGS" | grep -q E
then
# use F flag if there is not an E flag
GREPFLAGS="F$GREPFLAGS"
fi

shift $((OPTIND - 1))

# use gnu version of tool if available (for bsd)
96 changes: 26 additions & 70 deletions src/test/rustdoc-gui/rust-logo.goml
Original file line number Diff line number Diff line change
@@ -1,78 +1,34 @@
// This test ensures that the correct style is applied to the rust logo in the sidebar.
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"

// First we start with the dark theme.
local-storage: {
"rustdoc-theme": "dark",
"rustdoc-preferred-dark-theme": "dark",
"rustdoc-use-system-theme": "false",
}
reload:

assert-css: (
".rust-logo",
{"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"},
define-function: (
"check-logo",
(theme, filter),
[
// Going to the doc page.
("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"),
// Changing theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".rust-logo", {"filter": |filter|})),
// Going to the source code page.
("goto", "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"),
// Changing theme (since it's local files, the local storage works by folder).
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".rust-logo", {"filter": |filter|})),
],
)

// In the source view page now.
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"

local-storage: {
"rustdoc-theme": "dark",
"rustdoc-preferred-dark-theme": "dark",
"rustdoc-use-system-theme": "false",
}
reload:

assert-css: (
".rust-logo",
{"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"},
call-function: (
"check-logo",
("ayu", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"),
)

// Then with the ayu theme.
local-storage: {
"rustdoc-theme": "ayu",
"rustdoc-preferred-dark-theme": "ayu",
"rustdoc-use-system-theme": "false",
}
reload:

assert-css: (
".rust-logo",
{"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"},
call-function: (
"check-logo",
("dark", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"),
)

// In the source view page now.
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"

local-storage: {
"rustdoc-theme": "ayu",
"rustdoc-preferred-dark-theme": "ayu",
"rustdoc-use-system-theme": "false",
}
reload:

assert-css: (
".rust-logo",
{"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"},
)

// And finally with the light theme.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:

assert-css: (
".rust-logo",
{"filter": "none"},
)

// In the source view page now.
goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"

local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:

assert-css: (
".rust-logo",
{"filter": "none"},
call-function: (
"check-logo",
("light", "none"),
)
19 changes: 19 additions & 0 deletions src/test/ui/traits/issue-102989.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//~ ERROR can't find crate for `profiler_builtins`
// compile-flags: -Cinstrument-coverage
// normalize-stderr-test "loaded from .*libcore-.*.rlib" -> "loaded from SYSROOT/libcore-*.rlib"

#![no_core]
#![feature(no_core, lang_items)]
#[lang="sized"]
trait Sized { } //~ ERROR found duplicate lang item `sized`

fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
//~^ ERROR `self` parameter is only allowed in associated functions
//~| ERROR cannot find type `Struct` in this scope
//~| ERROR mismatched types
let x = x << 1;
//~^ ERROR the size for values of type `{integer}` cannot be known at compilation time
//~| ERROR cannot find value `x` in this scope
}

fn main() {}
72 changes: 72 additions & 0 deletions src/test/ui/traits/issue-102989.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
error: `self` parameter is only allowed in associated functions
--> $DIR/issue-102989.rs:10:15
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^^^^ not semantically valid as function parameter
|
= note: associated functions are those in `impl` or `trait` definitions

error[E0412]: cannot find type `Struct` in this scope
--> $DIR/issue-102989.rs:10:22
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^^^^^^ not found in this scope

error[E0425]: cannot find value `x` in this scope
--> $DIR/issue-102989.rs:14:13
|
LL | let x = x << 1;
| ^ help: a local variable with a similar name exists: `f`

error: `profiler_builtins` crate (required by compiler options) is not compatible with crate attribute `#![no_core]`

error[E0463]: can't find crate for `profiler_builtins`
|
= note: the compiler may have been built without the profiler runtime

error[E0152]: found duplicate lang item `sized`
--> $DIR/issue-102989.rs:8:1
|
LL | trait Sized { }
| ^^^^^^^^^^^
|
= note: the lang item is first defined in crate `core`.
= note: first definition in `core` loaded from SYSROOT/libcore-*.rlib
= note: second definition in the local crate (`issue_102989`)

error: `#[panic_handler]` function required, but not found

error: language item required, but not found: `eh_personality`
|
= note: this can occur when a binary crate with `#![no_std]` is compiled for a target where `eh_personality` is defined in the standard library
= help: you may be able to compile for a target that doesn't need `eh_personality`, specify a target with `--target` or in `.cargo/config`

error[E0277]: the size for values of type `{integer}` cannot be known at compilation time
--> $DIR/issue-102989.rs:14:15
|
LL | let x = x << 1;
| ^^ doesn't have a size known at compile-time
|
= help: the trait `core::marker::Sized` is not implemented for `{integer}`

error[E0308]: mismatched types
--> $DIR/issue-102989.rs:10:42
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ---------- ^^^^ expected `&u32`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
|
note: consider returning one of these bindings
--> $DIR/issue-102989.rs:10:30
|
LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^
...
LL | let x = x << 1;
| ^

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0152, E0277, E0308, E0412, E0425, E0463.
For more information about an error, try `rustc --explain E0152`.