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 7 pull requests #114130

Merged
merged 17 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
38 changes: 19 additions & 19 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -502,7 +502,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand All @@ -527,7 +527,7 @@ dependencies = [
"regex",
"rustc_tools_util",
"serde",
"syn 2.0.8",
"syn 2.0.27",
"tempfile",
"termize",
"tester",
Expand Down Expand Up @@ -842,7 +842,7 @@ version = "0.1.73"
dependencies = [
"itertools",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -943,7 +943,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -1309,7 +1309,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -2456,7 +2456,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -2643,7 +2643,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -3586,7 +3586,7 @@ dependencies = [
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"unic-langid",
]

Expand Down Expand Up @@ -3855,7 +3855,7 @@ version = "0.1.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"synstructure 0.13.0",
]

Expand Down Expand Up @@ -4462,7 +4462,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -4629,7 +4629,7 @@ checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -4910,9 +4910,9 @@ dependencies = [

[[package]]
name = "syn"
version = "2.0.8"
version = "2.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9"
checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -4939,7 +4939,7 @@ checksum = "285ba80e733fac80aa4270fbcdf83772a79b80aa35c97075320abfee4a915b06"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"unicode-xid",
]

Expand Down Expand Up @@ -5089,7 +5089,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -5310,7 +5310,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
]

[[package]]
Expand Down Expand Up @@ -5740,7 +5740,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"wasm-bindgen-shared",
]

Expand Down Expand Up @@ -5774,7 +5774,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"syn 2.0.27",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
Expand Down
15 changes: 9 additions & 6 deletions compiler/rustc_const_eval/src/util/compare_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ pub fn is_subtype<'tcx>(
// we would get unification errors because we're unable to look into opaque types,
// even if they're constrained in our current function.
for (key, ty) in infcx.take_opaque_types() {
span_bug!(
ty.hidden_type.span,
"{}, {}",
tcx.type_of(key.def_id).instantiate(tcx, key.args),
ty.hidden_type.ty
);
let hidden_ty = tcx.type_of(key.def_id).instantiate(tcx, key.args);
if hidden_ty != ty.hidden_type.ty {
span_bug!(
ty.hidden_type.span,
"{}, {}",
tcx.type_of(key.def_id).instantiate(tcx, key.args),
ty.hidden_type.ty
);
}
}
errors.is_empty()
}
3 changes: 1 addition & 2 deletions compiler/rustc_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ proc-macro = true

[dependencies]
synstructure = "0.13.0"
# FIXME(Nilstrieb): Updating this causes changes in the diagnostics output.
syn = { version = "=2.0.8", features = ["full"] }
syn = { version = "2.0.9", features = ["full"] }
proc-macro2 = "1"
quote = "1"
25 changes: 14 additions & 11 deletions compiler/rustc_trait_selection/src/solve/canonicalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ impl<'a, 'tcx> Canonicalizer<'a, 'tcx> {
// - var_infos: [E0, U1, E1, U1, E1, E6, U6], curr_compressed_uv: 1, next_orig_uv: 6
// - var_infos: [E0, U1, E1, U1, E1, E2, U2], curr_compressed_uv: 2, next_orig_uv: -
//
// This algorithm runs in `O(nm)` where `n` is the number of different universe
// indices in the input and `m` is the number of canonical variables.
// This should be fine as both `n` and `m` are expected to be small.
// This algorithm runs in `O(n²)` where `n` is the number of different universe
// indices in the input. This should be fine as `n` is expected to be small.
let mut curr_compressed_uv = ty::UniverseIndex::ROOT;
let mut existential_in_new_uv = false;
let mut next_orig_uv = Some(ty::UniverseIndex::ROOT);
Expand Down Expand Up @@ -263,14 +262,18 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
ty::ReError(_) => return r,
};

let var = ty::BoundVar::from(
self.variables.iter().position(|&v| v == r.into()).unwrap_or_else(|| {
let var = self.variables.len();
self.variables.push(r.into());
self.primitive_var_infos.push(CanonicalVarInfo { kind });
var
}),
);
let existing_bound_var = match self.canonicalize_mode {
CanonicalizeMode::Input => None,
CanonicalizeMode::Response { .. } => {
self.variables.iter().position(|&v| v == r.into()).map(ty::BoundVar::from)
}
};
let var = existing_bound_var.unwrap_or_else(|| {
let var = ty::BoundVar::from(self.variables.len());
self.variables.push(r.into());
self.primitive_var_infos.push(CanonicalVarInfo { kind });
var
});
let br = ty::BoundRegion { var, kind: BrAnon(None) };
ty::Region::new_late_bound(self.interner(), self.binder_index, br)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/eval_ctxt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
Ok(response) => response,
};

let has_changed = !canonical_response.value.var_values.is_identity()
let has_changed = !canonical_response.value.var_values.is_identity_modulo_regions()
|| !canonical_response.value.external_constraints.opaque_types.is_empty();
let (certainty, nested_goals) = match self.instantiate_and_apply_query_response(
goal.param_env,
Expand Down
6 changes: 3 additions & 3 deletions library/core/src/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_set()
/// .entries(self.0.iter())
/// .finish() // Ends the struct formatting.
/// .finish() // Ends the set formatting.
/// }
/// }
///
Expand Down Expand Up @@ -648,7 +648,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_list()
/// .entries(self.0.iter())
/// .finish() // Ends the struct formatting.
/// .finish() // Ends the list formatting.
/// }
/// }
///
Expand Down Expand Up @@ -905,7 +905,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// fmt.debug_map()
/// .entries(self.0.iter().map(|&(ref k, ref v)| (k, v)))
/// .finish() // Ends the struct formatting.
/// .finish() // Ends the map formatting.
/// }
/// }
///
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ impl str {
/// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rmatches`] method can be used.
///
/// [`rmatches`]: str::matches
/// [`rmatches`]: str::rmatches
///
/// # Examples
///
Expand Down
Loading
Loading