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 5 pull requests #71171

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
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
91 changes: 48 additions & 43 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,9 @@ dependencies = [

[[package]]
name = "compiler_builtins"
version = "0.1.25"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "438ac08ddc5efe81452f984a9e33ba425b00b31d1f48e6acd9e2210aa28cc52e"
checksum = "38f18416546abfbf8d801c555a0e99524453e7214f9cc9107ad49de3d5948ccc"
dependencies = [
"cc",
"rustc-std-workspace-core",
Expand Down Expand Up @@ -2704,9 +2704,9 @@ dependencies = [

[[package]]
name = "racer"
version = "2.1.32"
version = "2.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e805a6c323d08b26270f0276cef35608456916dc266ef27434edbe666eceeeb5"
checksum = "54322b696f7df20e0d79d0244a1088f387b7164a5f17987c4ab984dec1a23e42"
dependencies = [
"bitflags",
"clap",
Expand Down Expand Up @@ -3146,25 +3146,25 @@ dependencies = [

[[package]]
name = "rustc-ap-arena"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632704fb93ca8148957191e5d2d827082f93c4aa20cdd242fb46d8cca57029da"
checksum = "81dfcfbb0ddfd533abf8c076e3b49d1e5042d1962526a12ce2c66d514b24cca3"
dependencies = [
"rustc-ap-rustc_data_structures",
"smallvec 1.0.0",
]

[[package]]
name = "rustc-ap-graphviz"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdd4689b814859c9f1b3e314ed2bde596acac428a256a16894635f600bed46b4"
checksum = "7490bb07b014a7f9531bde33c905a805e08095dbefdb4c9988a1b19fe6d019fd"

[[package]]
name = "rustc-ap-rustc_ast"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "101c1517d3fd19d083aaca5b113f9965e6ae353a0bb09c49959b0f62b95b75d9"
checksum = "189f16dbb8dd11089274c9ced58b0cae9e1ea3e434a58f3db683817eda849e58"
dependencies = [
"log",
"rustc-ap-rustc_data_structures",
Expand All @@ -3179,10 +3179,11 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_ast_passes"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab3f5a7e939b37c99d8ca371f09b10bb5b5c85ad5d5b8d1d736ce8248c71be0"
checksum = "bbe619609b56a617fa986332b066d53270093c816d8ff8281fc90e1dbe74c1cc"
dependencies = [
"itertools 0.8.0",
"log",
"rustc-ap-rustc_ast",
"rustc-ap-rustc_ast_pretty",
Expand All @@ -3197,9 +3198,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_ast_pretty"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05046d3a2b8de22b20bcda9a1c063dc5c1f2f721f042b6c2809df2d23c64a13e"
checksum = "26ab1495f7b420e937688749c1da5763aaabd6ebe8cacb758665a0b8481da094"
dependencies = [
"log",
"rustc-ap-rustc_ast",
Expand All @@ -3209,9 +3210,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_attr"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f00b7ccad6fc3628fb44950435772945a425575f9ea0b3708c536fe75623a6e8"
checksum = "2e057495724c60729c1d1d9d49374e0b3ebd6d3481cd161b2871f52fe017b7b5"
dependencies = [
"rustc-ap-rustc_ast",
"rustc-ap-rustc_ast_pretty",
Expand All @@ -3227,9 +3228,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_data_structures"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c6121ab6766644fa76b711f65d4c39f2e335488ab768324567fed0ed191166e"
checksum = "d2130997667833692f4bec4681d0e73b066d5a01dac1d8a68f22068b82bf173a"
dependencies = [
"bitflags",
"cfg-if",
Expand All @@ -3238,6 +3239,7 @@ dependencies = [
"indexmap",
"jobserver",
"lazy_static 1.4.0",
"libc",
"log",
"measureme",
"parking_lot 0.10.0",
Expand All @@ -3254,9 +3256,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_errors"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adab84c842003ad1c8435fd71b8d0cc19bf0d702a8a2147d5be06e083db2d207"
checksum = "908e1ea187c6bb368af4ba6db980001e920515e67371ddc4086e749baabe6080"
dependencies = [
"annotate-snippets",
"atty",
Expand All @@ -3272,9 +3274,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_expand"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb001df541ea02b65c8e294252530010c6f90e3c6a5716e8e24e58c12dd1cd86"
checksum = "50066a75bca872ff933b0ee8a582d18ef1876c8054a392f60c39e538446bfb00"
dependencies = [
"log",
"rustc-ap-rustc_ast",
Expand All @@ -3294,9 +3296,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_feature"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "446cc60613cc3b05d0bdbcab7feb02305790b5617fa43c532d51ae3223d677a4"
checksum = "96fb53e1710e6de7c2e371ca56c857b79f9b399aba58aa6b6fbed6e2f677d3f6"
dependencies = [
"lazy_static 1.4.0",
"rustc-ap-rustc_data_structures",
Expand All @@ -3305,34 +3307,34 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_fs_util"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ac99d6f67e7db3bb300895630e769ed41bd3e336c0e725870c70e676c1a5ff1"
checksum = "e3f91357e5e468fc2729211571d769723c728a34e200d90a70164e945f881e09"

[[package]]
name = "rustc-ap-rustc_index"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5608c1cf50d2251b7e10a138cf6dd388e97f139b21c00b06a22d06f89c6591f6"
checksum = "32220c3e6cdf226f38e4474b747dca15f3106bb680c74f10b299af3f6cdb1663"
dependencies = [
"rustc-ap-serialize",
"smallvec 1.0.0",
]

[[package]]
name = "rustc-ap-rustc_lexer"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74e9c1c6f5dc85977b3adb6fb556b2ff23354d1a12021da15eb1d36353458bde"
checksum = "3b324d2a2bacad344e53e182e5ca04ffb74745b932849aa074f8f7fec8177da5"
dependencies = [
"unicode-xid 0.2.0",
]

[[package]]
name = "rustc-ap-rustc_macros"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3226b5ec864312a5d23eb40a5d621ee06bdc0754228d20d6eb76d4ddc4f2d4a1"
checksum = "59686c56d5f1b3ed47d0f070c257ed35caf24ecf2d744dd11fe44b1014baee0f"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
Expand All @@ -3342,9 +3344,9 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_parse"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3b042344c2280b50d5df0058d11379028a8f016a407e575bb3ea8b6c798049"
checksum = "2dfb0c11c591ec5f87bbadb10819795abc9035ff79a26703c1b6c9487ac51f49"
dependencies = [
"bitflags",
"log",
Expand All @@ -3362,10 +3364,11 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_session"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff35ef4b5d9fbcb2fd539c7c908eb3cdd1f68ddbccd042945ef50ae65564f941"
checksum = "3d1a194b1a81d7233ee492847638dc9ebdb7d084300e5ade8dea0ceaa98f95b9"
dependencies = [
"getopts",
"log",
"num_cpus",
"rustc-ap-rustc_ast",
Expand All @@ -3381,26 +3384,28 @@ dependencies = [

[[package]]
name = "rustc-ap-rustc_span"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e323b1f4a824039886eed8e33cad20ea4f492a9f9b3c9441009797c91de3e87a"
checksum = "a648146050fed6b58e681ec22488e728f60e16036bb7497c9815e3debd1e4242"
dependencies = [
"cfg-if",
"log",
"md-5",
"rustc-ap-arena",
"rustc-ap-rustc_data_structures",
"rustc-ap-rustc_index",
"rustc-ap-rustc_macros",
"rustc-ap-serialize",
"scoped-tls",
"sha-1",
"unicode-width",
]

[[package]]
name = "rustc-ap-rustc_target"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e161eb7b3a5b7993c6b480135296dc61476db80041d49dd446422742426e390b"
checksum = "28cf28798f0988b808e3616713630e4098d68c6f1f41052a2f7e922e094da744"
dependencies = [
"bitflags",
"log",
Expand All @@ -3413,9 +3418,9 @@ dependencies = [

[[package]]
name = "rustc-ap-serialize"
version = "651.0.0"
version = "654.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af510a659098d8c45a7303fb882fa780f4a87ec5f5d7a2053521e7d5d7f332c4"
checksum = "756e8f526ec7906e132188bf25e3c10a6ee42ab77294ecb3b3602647f0508eef"
dependencies = [
"indexmap",
"smallvec 1.0.0",
Expand Down Expand Up @@ -4404,7 +4409,7 @@ dependencies = [

[[package]]
name = "rustfmt-nightly"
version = "1.4.13"
version = "1.4.14"
dependencies = [
"annotate-snippets",
"bytecount",
Expand Down
5 changes: 0 additions & 5 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ fn main() {
cmd.arg(format!("-Clinker={}", host_linker));
}

// Override linker flavor if necessary.
if let Ok(host_linker_flavor) = env::var("RUSTC_HOST_LINKER_FLAVOR") {
cmd.arg(format!("-Clinker-flavor={}", host_linker_flavor));
}

if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") {
if s == "true" {
cmd.arg("-C").arg("target-feature=+crt-static");
Expand Down
16 changes: 0 additions & 16 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,27 +969,11 @@ impl<'a> Builder<'a> {
// See https://github.com/rust-lang/rust/issues/68647.
let can_use_lld = mode != Mode::Std;

// FIXME: The beta compiler doesn't pick the `lld-link` flavor for `*-pc-windows-msvc`
// Remove `RUSTC_HOST_LINKER_FLAVOR` when this is fixed
let lld_linker_flavor = |linker: &Path, target: Interned<String>| {
compiler.stage == 0
&& linker.file_name() == Some(OsStr::new("rust-lld"))
&& target.contains("pc-windows-msvc")
};

if let Some(host_linker) = self.linker(compiler.host, can_use_lld) {
if lld_linker_flavor(host_linker, compiler.host) {
cargo.env("RUSTC_HOST_LINKER_FLAVOR", "lld-link");
}

cargo.env("RUSTC_HOST_LINKER", host_linker);
}

if let Some(target_linker) = self.linker(target, can_use_lld) {
if lld_linker_flavor(target_linker, target) {
rustflags.arg("-Clinker-flavor=lld-link");
}

let target = crate::envify(&target);
cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker);
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_error_codes/error_codes/E0518.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This error indicates that an `#[inline(..)]` attribute was incorrectly placed
on something other than a function or method.
An `#[inline(..)]` attribute was incorrectly placed on something other than a
function or method.

Examples of erroneous code:
Example of erroneous code:

```compile_fail,E0518
#[inline(always)]
Expand Down
23 changes: 22 additions & 1 deletion src/librustc_trait_selection/traits/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
)),
Some(
"the question mark operation (`?`) implicitly performs a \
conversion on the error value using the `From` trait"
conversion on the error value using the `From` trait"
.to_owned(),
),
)
Expand All @@ -312,6 +312,27 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
))
);

let should_convert_option_to_result =
format!("{}", trait_ref.print_only_trait_path())
.starts_with("std::convert::From<std::option::NoneError");
let should_convert_result_to_option = format!("{}", trait_ref)
.starts_with("<std::option::NoneError as std::convert::From<");
if is_try && is_from && should_convert_option_to_result {
err.span_suggestion_verbose(
span.shrink_to_lo(),
"consider converting the `Option<T>` into a `Result<T, _>` using `Option::ok_or` or `Option::ok_or_else`",
".ok_or_else(|| /* error value */)".to_string(),
Applicability::HasPlaceholders,
);
} else if is_try && is_from && should_convert_result_to_option {
err.span_suggestion_verbose(
span.shrink_to_lo(),
"consider converting the `Result<T, _>` into an `Option<T>` using `Result::ok`",
".ok()".to_string(),
Applicability::MachineApplicable,
);
}

let explanation =
if obligation.cause.code == ObligationCauseCode::MainFunctionType {
"consider using `()`, or a `Result`".to_owned()
Expand Down
13 changes: 13 additions & 0 deletions src/test/ui/option-to-result.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
fn main(){ }

fn test_result() -> Result<(),()> {
let a:Option<()> = Some(());
a?;//~ ERROR `?` couldn't convert the error
Ok(())
}

fn test_option() -> Option<i32>{
let a:Result<i32, i32> = Ok(5);
a?;//~ ERROR `?` couldn't convert the error
Some(5)
}
Loading