Merge from rustc

This commit is contained in:
Ralf Jung 2023-05-10 08:31:30 +02:00
commit efa68d02d2
608 changed files with 16536 additions and 6479 deletions

@ -1 +1 @@
Subproject commit 569b648b5831ae8a515e90c80843a5287c3304ef
Subproject commit 26b73d15a68fb94579f6d3590585ec0e9d81d3d5

View file

@ -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)
},

View file

@ -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;

View file

@ -0,0 +1,7 @@
[package]
name = "generate-windows-sys"
version = "0.1.0"
edition = "2021"
[dependencies.windows-bindgen]
version = "0.49"

View file

@ -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(())
}

View file

@ -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);
}
}
}
}

View file

@ -1,4 +1,3 @@
#![feature(const_ptr_read)]
const UNALIGNED_READ: () = unsafe {
let x = &[0u8; 4];

View file

@ -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;

View file

@ -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();