Skip to content

Commit e5c5d75

Browse files
authored
Merge pull request #2526 from rust-lang/rustc-pull
Rustc pull update
2 parents 21639e3 + 71bcc15 commit e5c5d75

File tree

97 files changed

+2182
-1424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2182
-1424
lines changed

.github/workflows/rustc-pull.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: rustc-pull
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run at 04:00 UTC every Monday and Thursday
7+
- cron: '0 4 * * 1,4'
8+
9+
jobs:
10+
pull:
11+
if: github.repository == 'rust-lang/rust-analyzer'
12+
uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main
13+
with:
14+
zulip-stream-id: 185405
15+
zulip-bot-email: "[email protected]"
16+
pr-base-branch: master
17+
branch-name: rustc-pull
18+
secrets:
19+
zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }}
20+
token: ${{ secrets.GITHUB_TOKEN }}

Cargo.lock

Lines changed: 23 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8989
vfs = { path = "./crates/vfs", version = "0.0.0" }
9090
edition = { path = "./crates/edition", version = "0.0.0" }
9191

92-
ra-ap-rustc_lexer = { version = "0.122", default-features = false }
92+
ra-ap-rustc_lexer = { version = "0.123", default-features = false }
9393
ra-ap-rustc_parse_format = { version = "0.121", default-features = false }
94-
ra-ap-rustc_index = { version = "0.122", default-features = false }
95-
ra-ap-rustc_abi = { version = "0.122", default-features = false }
96-
ra-ap-rustc_pattern_analysis = { version = "0.122", default-features = false }
94+
ra-ap-rustc_index = { version = "0.123", default-features = false }
95+
ra-ap-rustc_abi = { version = "0.123", default-features = false }
96+
ra-ap-rustc_pattern_analysis = { version = "0.123", default-features = false }
9797

9898
# local crates that aren't published to crates.io. These should not have versions.
9999

@@ -156,6 +156,7 @@ smallvec = { version = "1.15.1", features = [
156156
"const_generics",
157157
] }
158158
smol_str = "0.3.2"
159+
temp-dir = "0.1.16"
159160
text-size = "1.1.1"
160161
tracing = "0.1.41"
161162
tracing-tree = "0.4.0"

crates/base-db/src/input.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub type ProcMacroPaths =
3030
pub enum ProcMacroLoadingError {
3131
Disabled,
3232
FailedToBuild,
33+
ExpectedProcMacroArtifact,
3334
MissingDylibPath,
3435
NotYetBuilt,
3536
NoProcMacros,
@@ -39,7 +40,8 @@ impl ProcMacroLoadingError {
3940
pub fn is_hard_error(&self) -> bool {
4041
match self {
4142
ProcMacroLoadingError::Disabled | ProcMacroLoadingError::NotYetBuilt => false,
42-
ProcMacroLoadingError::FailedToBuild
43+
ProcMacroLoadingError::ExpectedProcMacroArtifact
44+
| ProcMacroLoadingError::FailedToBuild
4345
| ProcMacroLoadingError::MissingDylibPath
4446
| ProcMacroLoadingError::NoProcMacros
4547
| ProcMacroLoadingError::ProcMacroSrvError(_) => true,
@@ -51,10 +53,16 @@ impl Error for ProcMacroLoadingError {}
5153
impl fmt::Display for ProcMacroLoadingError {
5254
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5355
match self {
56+
ProcMacroLoadingError::ExpectedProcMacroArtifact => {
57+
write!(f, "proc-macro crate did not build proc-macro artifact")
58+
}
5459
ProcMacroLoadingError::Disabled => write!(f, "proc-macro expansion is disabled"),
5560
ProcMacroLoadingError::FailedToBuild => write!(f, "proc-macro failed to build"),
5661
ProcMacroLoadingError::MissingDylibPath => {
57-
write!(f, "proc-macro crate build data is missing a dylib path")
62+
write!(
63+
f,
64+
"proc-macro crate built but the dylib path is missing, this indicates a problem with your build system."
65+
)
5866
}
5967
ProcMacroLoadingError::NotYetBuilt => write!(f, "proc-macro not yet built"),
6068
ProcMacroLoadingError::NoProcMacros => {

crates/hir-def/src/expr_store.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::{
1616

1717
use cfg::{CfgExpr, CfgOptions};
1818
use either::Either;
19-
use hir_expand::{ExpandError, InFile, MacroCallId, mod_path::ModPath, name::Name};
19+
use hir_expand::{InFile, MacroCallId, mod_path::ModPath, name::Name};
2020
use la_arena::{Arena, ArenaMap};
2121
use rustc_hash::FxHashMap;
2222
use smallvec::SmallVec;
@@ -281,7 +281,6 @@ struct FormatTemplate {
281281
#[derive(Debug, Eq, PartialEq)]
282282
pub enum ExpressionStoreDiagnostics {
283283
InactiveCode { node: InFile<SyntaxNodePtr>, cfg: CfgExpr, opts: CfgOptions },
284-
MacroError { node: InFile<MacroCallPtr>, err: ExpandError },
285284
UnresolvedMacroCall { node: InFile<MacroCallPtr>, path: ModPath },
286285
UnreachableLabel { node: InFile<AstPtr<ast::Lifetime>>, name: Name },
287286
AwaitOutsideOfAsync { node: InFile<AstPtr<ast::AwaitExpr>>, location: String },

crates/hir-def/src/expr_store/lower.rs

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -960,38 +960,29 @@ impl ExprCollector<'_> {
960960
impl_trait_lower_fn: ImplTraitLowerFn<'_>,
961961
) -> TypeBound {
962962
match node.kind() {
963-
ast::TypeBoundKind::PathType(path_type) => {
963+
ast::TypeBoundKind::PathType(binder, path_type) => {
964+
let binder = match binder.and_then(|it| it.generic_param_list()) {
965+
Some(gpl) => gpl
966+
.lifetime_params()
967+
.flat_map(|lp| lp.lifetime().map(|lt| Name::new_lifetime(&lt.text())))
968+
.collect(),
969+
None => ThinVec::default(),
970+
};
964971
let m = match node.question_mark_token() {
965972
Some(_) => TraitBoundModifier::Maybe,
966973
None => TraitBoundModifier::None,
967974
};
968975
self.lower_path_type(&path_type, impl_trait_lower_fn)
969976
.map(|p| {
970-
TypeBound::Path(self.alloc_path(p, AstPtr::new(&path_type).upcast()), m)
977+
let path = self.alloc_path(p, AstPtr::new(&path_type).upcast());
978+
if binder.is_empty() {
979+
TypeBound::Path(path, m)
980+
} else {
981+
TypeBound::ForLifetime(binder, path)
982+
}
971983
})
972984
.unwrap_or(TypeBound::Error)
973985
}
974-
ast::TypeBoundKind::ForType(for_type) => {
975-
let lt_refs = match for_type.generic_param_list() {
976-
Some(gpl) => gpl
977-
.lifetime_params()
978-
.flat_map(|lp| lp.lifetime().map(|lt| Name::new_lifetime(&lt.text())))
979-
.collect(),
980-
None => ThinVec::default(),
981-
};
982-
let path = for_type.ty().and_then(|ty| match &ty {
983-
ast::Type::PathType(path_type) => {
984-
self.lower_path_type(path_type, impl_trait_lower_fn).map(|p| (p, ty))
985-
}
986-
_ => None,
987-
});
988-
match path {
989-
Some((p, ty)) => {
990-
TypeBound::ForLifetime(lt_refs, self.alloc_path(p, AstPtr::new(&ty)))
991-
}
992-
None => TypeBound::Error,
993-
}
994-
}
995986
ast::TypeBoundKind::Use(gal) => TypeBound::Use(
996987
gal.use_bound_generic_args()
997988
.map(|p| match p {
@@ -1981,13 +1972,7 @@ impl ExprCollector<'_> {
19811972
return collector(self, None);
19821973
}
19831974
};
1984-
if record_diagnostics {
1985-
if let Some(err) = res.err {
1986-
self.store
1987-
.diagnostics
1988-
.push(ExpressionStoreDiagnostics::MacroError { node: macro_call_ptr, err });
1989-
}
1990-
}
1975+
// No need to push macro and parsing errors as they'll be recreated from `macro_calls()`.
19911976

19921977
match res.value {
19931978
Some((mark, expansion)) => {
@@ -1997,10 +1982,6 @@ impl ExprCollector<'_> {
19971982
self.store.expansions.insert(macro_call_ptr, macro_file);
19981983
}
19991984

2000-
if record_diagnostics {
2001-
// FIXME: Report parse errors here
2002-
}
2003-
20041985
let id = collector(self, expansion.map(|it| it.tree()));
20051986
self.expander.exit(mark);
20061987
id

crates/hir-def/src/expr_store/lower/generics.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,18 @@ impl GenericParamsCollector {
180180
continue;
181181
};
182182

183-
let lifetimes: Option<Box<_>> = pred.generic_param_list().map(|param_list| {
184-
// Higher-Ranked Trait Bounds
185-
param_list
186-
.lifetime_params()
187-
.map(|lifetime_param| {
188-
lifetime_param
189-
.lifetime()
190-
.map_or_else(Name::missing, |lt| Name::new_lifetime(&lt.text()))
191-
})
192-
.collect()
193-
});
183+
let lifetimes: Option<Box<_>> =
184+
pred.for_binder().and_then(|it| it.generic_param_list()).map(|param_list| {
185+
// Higher-Ranked Trait Bounds
186+
param_list
187+
.lifetime_params()
188+
.map(|lifetime_param| {
189+
lifetime_param
190+
.lifetime()
191+
.map_or_else(Name::missing, |lt| Name::new_lifetime(&lt.text()))
192+
})
193+
.collect()
194+
});
194195
for bound in pred.type_bound_list().iter().flat_map(|l| l.bounds()) {
195196
self.lower_type_bound_as_predicate(ec, bound, lifetimes.as_deref(), target);
196197
}

crates/hir-def/src/expr_store/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum Path {
2727
}
2828

2929
// This type is being used a lot, make sure it doesn't grow unintentionally.
30-
#[cfg(target_arch = "x86_64")]
30+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
3131
const _: () = {
3232
assert!(size_of::<Path>() == 24);
3333
assert!(size_of::<Option<Path>>() == 24);

crates/hir-def/src/hir/type_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub enum TypeRef {
148148
Error,
149149
}
150150

151-
#[cfg(target_arch = "x86_64")]
151+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
152152
const _: () = assert!(size_of::<TypeRef>() == 24);
153153

154154
pub type TypeRefId = Idx<TypeRef>;

0 commit comments

Comments
 (0)