diff options
| author | Ralf Jung <post@ralfj.de> | 2023-05-10 08:31:30 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-05-10 08:31:30 +0200 |
| commit | efa68d02d2ee74f7b70703caef44ff53b92fe910 (patch) | |
| tree | 082e0bc9195c513423a06ef48bb1825f2c2feb97 /src/tools | |
| parent | 53801d3f085f8b635f0e0f668584c1d618cb1d9d (diff) | |
| parent | 65dfca8488d635552eb246eb8e15df646e987cff (diff) | |
| download | rust-efa68d02d2ee74f7b70703caef44ff53b92fe910.tar.gz rust-efa68d02d2ee74f7b70703caef44ff53b92fe910.zip | |
Merge from rustc
Diffstat (limited to 'src/tools')
| m--------- | src/tools/cargo | 0 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/dereference.rs | 1 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs | 5 | ||||
| -rw-r--r-- | src/tools/generate-windows-sys/Cargo.toml | 7 | ||||
| -rw-r--r-- | src/tools/generate-windows-sys/src/main.rs | 37 | ||||
| -rw-r--r-- | src/tools/jsondoclint/src/validator.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/tests/fail/const-ub-checks.rs | 1 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/ui_tests.rs | 4 |
9 files changed, 54 insertions, 6 deletions
diff --git a/src/tools/cargo b/src/tools/cargo -Subproject 569b648b5831ae8a515e90c80843a5287c3304e +Subproject 26b73d15a68fb94579f6d3590585ec0e9d81d3d diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs index 7f3f26bed7c..b27ffe73ffd 100644 --- a/src/tools/clippy/clippy_lints/src/dereference.rs +++ b/src/tools/clippy/clippy_lints/src/dereference.rs @@ -1424,6 +1424,7 @@ fn ty_auto_deref_stability<'tcx>( continue; }, ty::Param(_) => TyPosition::new_deref_stable_for_result(precedence, ty), + ty::Alias(ty::Inherent, _) => unreachable!("inherent projection should have been normalized away above"), ty::Alias(ty::Projection, _) if ty.has_non_region_param() => { TyPosition::new_deref_stable_for_result(precedence, ty) }, diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs index 4c4c003ca46..67b7d3691dc 100644 --- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs +++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs @@ -385,6 +385,9 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty< Node::Expr(parent_expr) => { if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr) { + // FIXME: the `subst_identity()` below seems incorrect, since we eventually + // call `tcx.try_subst_and_normalize_erasing_regions` further down + // (i.e., we are explicitly not in the identity context). let fn_sig = cx.tcx.fn_sig(callee_def_id).subst_identity().skip_binder(); if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id) && let Some(param_ty) = fn_sig.inputs().get(arg_index) @@ -435,7 +438,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty< let output_ty = fn_sig.output(); if output_ty.contains(*param_ty) { if let Ok(new_ty) = cx.tcx.try_subst_and_normalize_erasing_regions( - new_subst, cx.param_env, output_ty) { + new_subst, cx.param_env, EarlyBinder(output_ty)) { expr = parent_expr; ty = new_ty; continue; diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml new file mode 100644 index 00000000000..23e88844bd0 --- /dev/null +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "generate-windows-sys" +version = "0.1.0" +edition = "2021" + +[dependencies.windows-bindgen] +version = "0.49" diff --git a/src/tools/generate-windows-sys/src/main.rs b/src/tools/generate-windows-sys/src/main.rs new file mode 100644 index 00000000000..91d981462e8 --- /dev/null +++ b/src/tools/generate-windows-sys/src/main.rs @@ -0,0 +1,37 @@ +use std::fs; +use std::io::{self, Write}; +use std::path::PathBuf; + +/// This is printed to the file before the rest of the contents. +const PRELUDE: &str = r#"// This file is autogenerated. +// +// To add bindings, edit windows_sys.lst then use `./x run generate-windows-sys` to +// regenerate the bindings. +// +// ignore-tidy-filelength +"#; + +fn main() -> io::Result<()> { + let mut path: PathBuf = + std::env::args_os().nth(1).expect("a path to the rust repository is required").into(); + path.push("library/std/src/sys/windows/c/windows_sys.lst"); + + // Load the list of APIs + let buffer = fs::read_to_string(&path)?; + let names: Vec<&str> = buffer + .lines() + .filter_map(|line| { + let line = line.trim(); + if line.is_empty() || line.starts_with("//") { None } else { Some(line) } + }) + .collect(); + + // Write the bindings to windows-sys.rs + let bindings = windows_bindgen::standalone_std(&names); + path.set_extension("rs"); + let mut f = std::fs::File::create(&path)?; + f.write_all(PRELUDE.as_bytes())?; + f.write_all(bindings.as_bytes())?; + + Ok(()) +} diff --git a/src/tools/jsondoclint/src/validator.rs b/src/tools/jsondoclint/src/validator.rs index a1f675a3b40..bf8a64acf08 100644 --- a/src/tools/jsondoclint/src/validator.rs +++ b/src/tools/jsondoclint/src/validator.rs @@ -273,7 +273,9 @@ impl<'a> Validator<'a> { Type::QualifiedPath { name: _, args, self_type, trait_ } => { self.check_generic_args(&**args); self.check_type(&**self_type); - self.check_path(trait_, PathKind::Trait); + if let Some(trait_) = trait_ { + self.check_path(trait_, PathKind::Trait); + } } } } diff --git a/src/tools/miri/tests/fail/const-ub-checks.rs b/src/tools/miri/tests/fail/const-ub-checks.rs index fa522c30cbd..ff265fba6e2 100644 --- a/src/tools/miri/tests/fail/const-ub-checks.rs +++ b/src/tools/miri/tests/fail/const-ub-checks.rs @@ -1,4 +1,3 @@ -#![feature(const_ptr_read)] const UNALIGNED_READ: () = unsafe { let x = &[0u8; 4]; diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs index 4096e0a3826..d338bb41205 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs @@ -379,7 +379,6 @@ language_item_table! { // FIXME(swatinem): the following lang items are used for async lowering and // should become obsolete eventually. ResumeTy, ResumeTy, resume_ty, Target::Struct, GenericRequirement::None; - IdentityFuture, identity_future, identity_future_fn, Target::Fn, GenericRequirement::None; GetContext, get_context, get_context_fn, Target::Fn, GenericRequirement::None; Context, Context, context, Target::Struct, GenericRequirement::None; diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index a2f7b8ba7be..9473eabe442 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -9,8 +9,8 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: usize = 1953; -const ROOT_ENTRY_LIMIT: usize = 894; +const ISSUES_ENTRY_LIMIT: usize = 1920; +const ROOT_ENTRY_LIMIT: usize = 895; fn check_entries(tests_path: &Path, bad: &mut bool) { let mut directories: HashMap<PathBuf, usize> = HashMap::new(); |
