diff --git a/Cargo.lock b/Cargo.lock index 742ed5db60f..a42e5c15b15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -443,9 +443,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" dependencies = [ "crossbeam-utils 0.7.2", "maybe-uninit", @@ -1296,14 +1296,13 @@ dependencies = [ [[package]] name = "measureme" -version = "0.7.1" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef709d3257013bba7cff14fc504e07e80631d3fe0f6d38ce63b8f6510ccb932" +checksum = "22bf8d885d073610aee20e7fa205c4341ed32a761dbde96da5fd96301a8d3e82" dependencies = [ - "byteorder", - "memmap", - "parking_lot 0.9.0", + "parking_lot 0.11.0", "rustc-hash", + "smallvec 1.4.0", ] [[package]] @@ -1312,16 +1311,6 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi 0.3.8", -] - [[package]] name = "memoffset" version = "0.5.4" @@ -1684,9 +1673,9 @@ dependencies = [ [[package]] name = "racer" -version = "2.1.39" +version = "2.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9424b4650b9c1134d0a1b34dab82319691e1c95fa8af1658fc640deb1b6823c" +checksum = "68c5fb83bc092c10e12ca863ab8922b1833382d5d248aaafca779886d3396a44" dependencies = [ "bitflags", "clap", @@ -1958,19 +1947,18 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_arena" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e941a8fc3878a111d2bbfe78e39522d884136f0b412b12592195f26f653476" +checksum = "477085eefed2f12085c68577cc3827c8c39a31a4a750978aacb9af10f7903174" dependencies = [ - "rustc-ap-rustc_data_structures", "smallvec 1.4.0", ] [[package]] name = "rustc-ap-rustc_ast" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b58b6b035710df7f339a2bf86f6dafa876efd95439540970e24609e33598ca6" +checksum = "4d4ad5ec25f6b3d122354595be0d1b513f37fca3299d9b448b1db28f4a9e4b12" dependencies = [ "bitflags", "rustc-ap-rustc_data_structures", @@ -1985,9 +1973,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_ast_passes" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d379a900d6a1f098490d92ab83e87487dcee2e4ec3f04c3ac4512b5117b64e2" +checksum = "0c6d8635298d7736decdb3c6e92e784d3eccde557462a9c10ac11a34fec3d756" dependencies = [ "itertools 0.9.0", "rustc-ap-rustc_ast", @@ -2004,9 +1992,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_ast_pretty" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658d925c0da9e3c5cddc5e54f4fa8c03b41aff1fc6dc5e41837c1118ad010ac0" +checksum = "7a61bdb5252e1a95b7715038949e10f07ce770a436fcd497cdd9bc7255471de9" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_span", @@ -2016,9 +2004,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_attr" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f387037534f34c148aed753622677500e42d190a095670e7ac3fffc09811a59" +checksum = "84520a16cb61bd31e9c27e87eca5d933a9c94ac84f25649bddcc19989275ab2a" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_pretty", @@ -2035,10 +2023,11 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_data_structures" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ffd17a37e00d77926a0713f191c59ff3aeb2b551a024c7cfffce14bab79be8" +checksum = "b1cb2b6a38759cf7c0c1434c8b4cbfcab9cd24970d05f960f2ca01226ddb4d68" dependencies = [ + "arrayvec", "bitflags", "cfg-if", "crossbeam-utils 0.7.2", @@ -2065,9 +2054,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_errors" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3263ddcfa9eb911e54a4e8088878dd9fd10e00d8b99b01033ba4a2733fe91d" +checksum = "46cfb19536426bf9252827a78552d635be207a4be74f4e92832aad82d7f2135c" dependencies = [ "annotate-snippets 0.8.0", "atty", @@ -2084,9 +2073,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_expand" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1ab7e68cede8a2273fd8b8623002ce9dc832e061dfc3330e9bcc1fc2a722d73" +checksum = "6273e60042a0ef31f6cfe783c519873993eb426f055be2bc058a48b6ca3934d0" dependencies = [ "rustc-ap-rustc_ast", "rustc-ap-rustc_ast_passes", @@ -2107,9 +2096,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_feature" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eea2dc95421bc19bbd4d939399833a882c46b684283b4267ad1fcf982fc043d9" +checksum = "2936e8346157e2848305e509f38aa3ed4e97697975ef68027587f5db6a38703f" dependencies = [ "rustc-ap-rustc_data_structures", "rustc-ap-rustc_span", @@ -2117,21 +2106,21 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_fs_util" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e44c1804f09635f83f6cf1e04c2e92f8aeb7b4e850ac6c53d373dab02c13053" +checksum = "9b4c3ae17776b5a5aa441ca510a650f75805e1f5569edd231caa8378552195a4" [[package]] name = "rustc-ap-rustc_graphviz" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc491f2b9be6e928f6df6b287549b8d50c48e8eff8638345155f40fa2cfb785d" +checksum = "5611bf0ac0ac49c2a22c959c7d8b17f85f69959293f0e8c4f753eca832fe7ad0" [[package]] name = "rustc-ap-rustc_index" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa73f3fed413cdb6290738a10267da17b9ae8e02087334778b9a8c9491c5efc0" +checksum = "ca67cf37c427057192e451c7f912e94ae9a8ca5ad69fd481c011fad3f86982cb" dependencies = [ "arrayvec", "rustc-ap-rustc_macros", @@ -2140,18 +2129,18 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_lexer" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e993881244a92f3b44cf43c8f22ae2ca5cefe4f55a34e2b65b72ee66fe5ad077" +checksum = "a5b04cd2159495584d976d501c5394498470c2e94e4f0cebb8186562d407a678" dependencies = [ "unicode-xid", ] [[package]] name = "rustc-ap-rustc_macros" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4effe366556e1d75344764adf4d54cba7c2fad33dbd07588e96d0853831ddc7c" +checksum = "61ec6d623853449acd3c65050d249d3674edab5f6e4d9f074c7bac183269f9c8" dependencies = [ "proc-macro2", "quote", @@ -2161,9 +2150,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_parse" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0342675835251571471d3dca9ea1576a853a8dfa1f4b0084db283c861223cb60" +checksum = "ca524bafce4b04d2b49fee2d40b4b26c3ebab9f1a4f731fdf561f00617862f02" dependencies = [ "bitflags", "rustc-ap-rustc_ast", @@ -2181,9 +2170,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_serialize" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "438255ed968d73bf6573aa18d3b8d33c0a85ecdfd14160ef09ff813938e0606c" +checksum = "c67920561e58f98c4de864407c92b2dd05ace5d5e5301e17444f10f742c005b7" dependencies = [ "indexmap", "smallvec 1.4.0", @@ -2191,9 +2180,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_session" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d61ff76dede8eb827f6805754900d1097a7046f938f950231b62b448f55bf78" +checksum = "0762fd855792e06ef639327237898e4e092ad68150e6a8e19aeb7dc06276ad7a" dependencies = [ "bitflags", "getopts", @@ -2212,9 +2201,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_span" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c267f15c3cfc82a8a441d2bf86bcccf299d1eb625822468e3d8ee6f7c5a1c89" +checksum = "0bf3db7b4ca5d21c14c45475df155e5e020c9a3760346945a662c9a9053b49c8" dependencies = [ "cfg-if", "md-5", @@ -2231,9 +2220,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_target" -version = "679.0.0" +version = "686.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1b4b266c4d44aac0f7f83b6741d8f0545b03d1ce32f3b5254f2014225cb96c" +checksum = "3aa6560bb9742b276064d67ab9edb5766ecb303f8ae3854835ad3fad4b432188" dependencies = [ "bitflags", "rustc-ap-rustc_data_structures", @@ -2316,7 +2305,7 @@ dependencies = [ [[package]] name = "rustfmt-config_proc_macro" version = "0.2.0" -source = "git+https://github.com/rust-lang/rustfmt?branch=rustfmt-1.4.22#97d0301011533e1c131c0edd660d77b4bd476c8b" +source = "git+https://github.com/rust-lang/rustfmt?branch=rustfmt-1.4.23#ea97ec5a4e822a55568ad6216f6aba56c03c464e" dependencies = [ "proc-macro2", "quote", @@ -2325,8 +2314,8 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "1.4.22" -source = "git+https://github.com/rust-lang/rustfmt?branch=rustfmt-1.4.22#97d0301011533e1c131c0edd660d77b4bd476c8b" +version = "1.4.23" +source = "git+https://github.com/rust-lang/rustfmt?branch=rustfmt-1.4.23#ea97ec5a4e822a55568ad6216f6aba56c03c464e" dependencies = [ "annotate-snippets 0.6.1", "anyhow", @@ -2557,9 +2546,9 @@ checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" [[package]] name = "stacker" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92bc346006ae78c539d6ab2cf1a1532bc657b8339c464877a990ec82073c66f" +checksum = "21ccb4c06ec57bc82d0f610f1a2963d7648700e43a6f513e564b9c89f7991786" dependencies = [ "cc", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index 4c346036ece..4d0ac8fa459 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,11 +42,11 @@ lsp-types = { version = "0.60", features = ["proposed"] } lazy_static = "1" log = "0.4" num_cpus = "1" -racer = { version = "2.1.39", default-features = false } +racer = { version = "2.1.40", default-features = false } rand = "0.7" rayon = "1" rustc_tools_util = "0.2" -rustfmt-nightly = { version = "1.4.22", git = "https://github.com/rust-lang/rustfmt", branch = "rustfmt-1.4.22" } +rustfmt-nightly = { version = "1.4.23", git = "https://github.com/rust-lang/rustfmt", branch = "rustfmt-1.4.23" } serde = "1.0" serde_json = "1.0" serde_derive = "1.0" diff --git a/rls-rustc/src/lib.rs b/rls-rustc/src/lib.rs index 988c83b377c..b5d77dff5c5 100644 --- a/rls-rustc/src/lib.rs +++ b/rls-rustc/src/lib.rs @@ -9,7 +9,7 @@ extern crate rustc_span; #[cfg(feature = "ipc")] use rustc_driver::Compilation; -use rustc_driver::{run_compiler, Callbacks}; +use rustc_driver::{Callbacks, RunCompiler}; use rustc_interface::interface; #[cfg(feature = "ipc")] use rustc_interface::Queries; @@ -75,8 +75,10 @@ pub fn run() -> Result<(), ()> { }; rustc_driver::install_ice_hook(); - rustc_driver::catch_fatal_errors(|| { - run_compiler(&args, &mut shim_calls, file_loader, None, None) + rustc_driver::catch_fatal_errors(move || { + let mut compiler = RunCompiler::new(&args, &mut shim_calls); + compiler.set_file_loader(file_loader); + compiler.run() }) .map(|_| ()) .map_err(|_| ()) diff --git a/rls/src/build/rustc.rs b/rls/src/build/rustc.rs index 947869aabb3..b937c3cf252 100644 --- a/rls/src/build/rustc.rs +++ b/rls/src/build/rustc.rs @@ -19,7 +19,7 @@ use log::trace; use rls_data::Analysis; use rls_vfs::Vfs; -use self::rustc_driver::{run_compiler, Compilation}; +use self::rustc_driver::{Compilation, RunCompiler}; use self::rustc_interface::interface; use self::rustc_interface::Queries; use self::rustc_save_analysis as save; @@ -185,14 +185,12 @@ fn run_in_process( let stderr = Arc::clone(&stderr); || { rustc_driver::catch_fatal_errors(move || { - // Replace stderr so we catch most errors. - run_compiler( - &args, - &mut callbacks, - Some(Box::new(ReplacedFileLoader::new(changed))), - Some(Box::new(BufWriter(stderr))), - None, - ) + let mut compiler = RunCompiler::new(&args, &mut callbacks); + compiler + .set_file_loader(Some(Box::new(ReplacedFileLoader::new(changed)))) + // Replace stderr so we catch most errors. + .set_emitter(Some(Box::new(BufWriter(stderr)))); + compiler.run() }) } }) diff --git a/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0004_012.json b/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0004_012.json index 2155bbfa9f7..5bf7ce7251a 100644 --- a/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0004_012.json +++ b/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0004_012.json @@ -5,6 +5,12 @@ "col": 12 }, "data": { - "Ok": [] + "Ok": [ + { + "language": "rust", + "value": "std/src/sync/mod.rs" + }, + "Useful synchronization primitives.\n\n## The need for synchronization\n\nConceptually, a Rust program is a series of operations which will\nbe executed on a computer. The timeline of events happening in the\nprogram is consistent with the order of the operations in the code.\n\nConsider the following code, operating on some global static variables:\n\n```rust\nstatic mut A: u32 = 0;" + ] } } diff --git a/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0005_012.json b/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0005_012.json index c297747e7c1..8c9fde99b37 100644 --- a/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0005_012.json +++ b/tests/fixtures/hover/save_data/test_tooltip_mod_use_external.rs.0005_012.json @@ -5,6 +5,12 @@ "col": 12 }, "data": { - "Ok": [] + "Ok": [ + { + "language": "rust", + "value": "std/src/sync/mod.rs" + }, + "Useful synchronization primitives.\n\n## The need for synchronization\n\nConceptually, a Rust program is a series of operations which will\nbe executed on a computer. The timeline of events happening in the\nprogram is consistent with the order of the operations in the code.\n\nConsider the following code, operating on some global static variables:\n\n```rust\nstatic mut A: u32 = 0;" + ] } } diff --git a/tests/fixtures/hover/save_data/test_tooltip_std.rs.0015_017.json b/tests/fixtures/hover/save_data/test_tooltip_std.rs.0015_017.json index 5fd627d906d..77fa7edc57f 100644 --- a/tests/fixtures/hover/save_data/test_tooltip_std.rs.0015_017.json +++ b/tests/fixtures/hover/save_data/test_tooltip_std.rs.0015_017.json @@ -11,7 +11,7 @@ "value": "library/alloc/src/string.rs" }, "https://doc.rust-lang.org/nightly/alloc/string/", - "A UTF-8 encoded, growable string.\n\nThis module contains the [`String`] type, a trait for converting\n[`ToString`]s, and several error types that may result from working with\n[`String`]s.\n\n# Examples\n\nThere are multiple ways to create a new [`String`] from a string literal:\n\n```rust\nlet s = \"Hello\".to_string();\n\nlet s = String::from(\"world\");\nlet s: String = \"also this\".into();\n```\n\nYou can create a new [`String`] from an existing one by concatenating with\n`+`:\n\n```rust\nlet s = \"Hello\".to_string();\n\nlet message = s + \" world!\";\n```\n\nIf you have a vector of valid UTF-8 bytes, you can make a [`String`] out of\nit. You can do the reverse too.\n\n```rust\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n\nlet bytes = sparkle_heart.into_bytes();\n\nassert_eq!(bytes, [240, 159, 146, 150]);\n```" + "A UTF-8–encoded, growable string.\n\nThis module contains the [`String`] type, the [`ToString`] trait for\nconverting to strings, and several error types that may result from\nworking with [`String`]s.\n\n# Examples\n\nThere are multiple ways to create a new [`String`] from a string literal:\n\n```rust\nlet s = \"Hello\".to_string();\n\nlet s = String::from(\"world\");\nlet s: String = \"also this\".into();\n```\n\nYou can create a new [`String`] from an existing one by concatenating with\n`+`:\n\n```rust\nlet s = \"Hello\".to_string();\n\nlet message = s + \" world!\";\n```\n\nIf you have a vector of valid UTF-8 bytes, you can make a [`String`] out of\nit. You can do the reverse too.\n\n```rust\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n\nlet bytes = sparkle_heart.into_bytes();\n\nassert_eq!(bytes, [240, 159, 146, 150]);\n```" ] } } \ No newline at end of file